|
Then check out the Double.IsInfinity() method.
"The largest fire starts but with the smallest spark." - David Crow
|
|
|
|
|
|
Hi All,
In VS 6 I copy data from a custom control on a dialog using my own clipboard management (see code below) and would like to paste it into a CEdit on the same dialog. I believe I am getting it to the clipboard correctly, in CF_TEXT format because I can paste the text into WordPad or Notepad just fine. I am unable, however, to paste my clipboard contents to the CEdit either with the CEdit context menu or Ctrl+V. Making this all the more confusing is that if I copy text from Wordpad, which presumably is in CF_TEXT format, I am able to paste into the standard CEdit just fine.
Any ideas would be greatly appreaciated!
Thanks,
Doug
CString cellText = "This is a test";<br />
<br />
<br />
OpenClipboard();<br />
EmptyClipboard();<br />
<br />
<br />
int dataStringLen = cellText.GetLength();<br />
HANDLE dataHandle = GlobalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT,dataStringLen + 1);<br />
char *memPtr = (char *)GlobalLock(dataHandle);<br />
<br />
<br />
memcpy(memPtr,(char *)(LPCTSTR)cellText,dataStringLen + 1);<br />
memPtr[dataStringLen] = '\0';<br />
<br />
<br />
GlobalUnlock(dataHandle);<br />
SetClipboardData(CF_TEXT,dataHandle);<br />
GlobalFree(dataHandle);<br />
<br />
CloseClipboard();
Doug Knudson
|
|
|
|
|
<br />
if(OpenClipboard()){<br />
CString cellText = "This is a test";<br />
HGLOBAL clipbuffer; <br />
EmptyClipboard(); <br />
clipbuffer = GlobalAlloc(GMEM_DDESHARE, cellText.GetLength()+1); <br />
<br />
char * buffer; <br />
buffer = (char*)GlobalLock(clipbuffer); <br />
strcpy(buffer, LPCSTR(cellText)); <br />
GlobalUnlock(clipbuffer); <br />
SetClipboardData(CF_TEXT,clipbuffer); <br />
CloseClipboard();<br />
}<br />
hi
|
|
|
|
|
Thank you very much! Works like a charm!
Doug
Doug Knudson
|
|
|
|
|
Hello i How can i read a string from a listbox ( MFC)
Thanx a lot !
|
|
|
|
|
By using the CListBox::GetText() method.
"The largest fire starts but with the smallest spark." - David Crow
|
|
|
|
|
Mahhouraaaaaa wrote: How can i read a string from a listbox ( MFC)
CString strData;
m_list.GetText(m_list.GetCurSel(),strData); m_list is the Control variable of the CListBox Control.
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
I try to share .pch (precompiled header files) across my library (more than 50) but i failed.
Using VC+ 6.0 is possible to share the .pch file reducing compilation time but when i try this in VC+2005 i ave found a lot of problems...
Can anyone help me?
Tanks and sorry for the poor english...
|
|
|
|
|
topus wrote: ...but i failed.
What failed?
topus wrote: Using VC+ 6.0 is possible to share the .pch file reducing compilation time...
I suppose you could in theory, assuming the files comprising each project were the same, but are you sure you want to? Why not just let the .pch file get built once for each project and be done with it? Your apt to spend more time trying to 'share' the file than you would just building it for each project.
"The largest fire starts but with the smallest spark." - David Crow
|
|
|
|
|
Lock at this:
"Rebuild using shared precompiled headers doesn't work"
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=105308&SiteId=1
|
|
|
|
|
Hi everybody:
i have a child frame with four splitters and five views, when i resize the child frame (decreasing for example) only the size of the first view decreases until it becomes zero, so the second view`s size starts to decrease, and so one
i want to make all the views shrinks equally when resizing the child frame
any help is appreciated
thanks alot
|
|
|
|
|
WM_SIZE
"What classes are you using ? You shouldn't call stuff if you have no idea what it does" Christian Graus in the C# forum
led mike
|
|
|
|
|
i know it must go in the onsize handler in the child
but i want to know how to do it?
|
|
|
|
|
Tarek Jabri wrote: i want to make all the views shrinks equally
Tarek Jabri wrote: but i want to know how to do it?
I don't understand what the problem is?
As the parent window size changes you have to calculate what "equal" is and then adjust the components (views, splitters, whatever) that are required, right?
"What classes are you using ? You shouldn't call stuff if you have no idea what it does" Christian Graus in the C# forum
led mike
|
|
|
|
|
Hi,
I have developed a small application, using ODBC with Access.
I then ported my tables to SQL Server 2000.
When I Open() a Recordset, all my tables are opened in read/write-mode, except two tables, that I use all the time.
These two tables differ from the other tables only, that they contain a CTime field.
Here is my code
Favorit.m_strFilter="Username='"+myUser+"' AND Dokument='"+Number+"'";
Favorit.Open();
if(!Favorit.IsBOF())
{
Favorit.MoveFirst();
Favorit.Edit();
}
else
{
Favorit.AddNew();
Favorit.m_User=myUser;
Favorit.m_Dokument=Number;
Favorit.SetFieldNull(&(Favorit.m_Gelesen));
}
Favorit.m_Favorit=bChecked;
Favorit.Update();
Favorit.Close();
When AddNew() I get the message, that this record is readonly. It works well in Access, but AddNew() throws an exception, that this record is readonly. Why? And how can I repair it?
Juergen
|
|
|
|
|
What does CRecordset::CanUpdate() indicate?
"The largest fire starts but with the smallest spark." - David Crow
|
|
|
|
|
CanUpdate() returns FALSE right after Open()
I also checked the rights on my SQL-Server but they seem to be ok. All other tables work well even when Update() is called.
I also dropped the table and created it new. Same effect
Juergen
|
|
|
|
|
e-DJ wrote: CanUpdate() returns FALSE right after Open()
Are JOIN s involved?
"The largest fire starts but with the smallest spark." - David Crow
|
|
|
|
|
Nope,
it's just a plain table.
DBFavoriten::DBFavoriten(CDatabase* pdb)
: CRecordset(pdb)
{
m_Dokument = _T("");
m_User = _T("");
m_Favorit = 0;
m_Gelesen=CTime(NULL);
m_nFields = 4;
m_nDefaultType = dynaset;
}
CString DBFavoriten::GetDefaultConnect()
{
return _T("ODBC;DSN=QM-DB");
}
CString DBFavoriten::GetDefaultSQL()
{
return _T("[Gelesen]");
}
void DBFavoriten::DoFieldExchange(CFieldExchange* pFX)
{
pFX->SetFieldType(CFieldExchange::outputColumn);
RFX_Text(pFX, _T("[Dokument]"), m_Dokument);
RFX_Text(pFX, _T("[Username]"), m_User);
RFX_Long(pFX, _T("[Favorit]"), m_Favorit);
RFX_Date(pFX, _T("[Gelesen]"), m_Gelesen);
}
Juergen
|
|
|
|
|
Is the QM-DB DSN configured as read-only?
"The largest fire starts but with the smallest spark." - David Crow
|
|
|
|
|
No,
as I said before, my database contains about 7 tables. All of them work perfectly well, except the one mentioned.
I think, maybe it's the CTime. It's the only table, that contains this datafield. I will try to replace CTime with long and write some conversion-members.
Juergen
|
|
|
|
|
e-DJ wrote: I think, maybe it's the CTime.
I doubt it. I've had several record sets with CTime member variables. They update fine.
"The largest fire starts but with the smallest spark." - David Crow
|
|
|
|
|
Yes,
I have another table without CTime and this table is also opened read-only One I haven't tried before.
I wrote a small application, that does nothing else, except connecting to my SQl-Server database and appending a record. And it worked. The record was appended, but when I tried to delete this record again, SQL-Server told me something about relations and deleting more than one line. So I have some garbage-data in my database, that can not be deleted again. I have to drop the complete table.
I think I quit it and try to share my access-file on a fileserver. It's awful, but I don't know, why SQL-Server opens some of my tables read-only. I need this application by the end of the month and I thought, well it runs on access, now I migrate access to SQL-Server and everything is fine. Bad luck, haven't thought about Microsoft
By the way, when reading from the access-file it is much faster than reading from SQL-Server, which is really strange.
Juergen
|
|
|
|
|
Strange things happen.
I created my SQL-Server database completely new and suddenly my tables work now.
At least most of them. Two tables are still readonly, but the rest is working. So I think, it's not a problem of my application, it's a problem of SQl-Server
Juergen
|
|
|
|