Click here to Skip to main content
15,886,199 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionSQLXMLBulkLoad? Pin
george ivanov16-Feb-06 5:18
george ivanov16-Feb-06 5:18 
QuestionAbout DAO Pin
Jacky Tsee16-Feb-06 4:34
Jacky Tsee16-Feb-06 4:34 
QuestionAdding ATL Support to MFC DLL Pin
a_kiani16-Feb-06 4:25
a_kiani16-Feb-06 4:25 
AnswerRe: Adding ATL Support to MFC DLL Pin
Michael Dunn16-Feb-06 7:40
sitebuilderMichael Dunn16-Feb-06 7:40 
GeneralRe: Adding ATL Support to MFC DLL Pin
a_kiani20-Feb-06 1:10
a_kiani20-Feb-06 1:10 
AnswerRe: Adding ATL Support to MFC DLL Pin
ThatsAlok17-Feb-06 3:13
ThatsAlok17-Feb-06 3:13 
GeneralRe: Adding ATL Support to MFC DLL Pin
zahedeh19-Feb-06 21:16
zahedeh19-Feb-06 21:16 
QuestionCopy large amount of data to clipboard Pin
t2x16-Feb-06 3:38
t2x16-Feb-06 3:38 
Hi,

im using this code to copy some data from a ListCtrl
to clipboard.
void CXYZ::copyToClipBoard()
{

CString strTemp="";
POSITION pos = this->GetFirstSelectedItemPosition();
if (pos == NULL)
TRACE("No items were selected!\n");
else
{
while ((pos) && (1))
{

int nItem = this->GetNextSelectedItem(pos);
pEl=Tree.getItem(nItem);
if (pEl->sev == 1)
strTemp+="Summary";
else if (pEl->sev == 2)
strTemp+="Unknown";

}
}
if(0 != OpenClipboard())
{
// clipboard varibale and buffer to hold text
HGLOBAL clipbuffer;
char * buffer;

// empty the clipboard first
EmptyClipboard();



// Allocate enough memory
clipbuffer = GlobalAlloc(GMEM_MOVEABLE, (strTemp.GetLength()+1)*sizeof(TCHAR));

// lock the buffer for entire system
buffer = (char*)GlobalLock(clipbuffer);

// copy the text to buffer
memcpy(buffer, strTemp,strTemp.GetLength()*sizeof(TCHAR));
buffer[strTemp.GetLength()+1] = (TCHAR) 0;

// unlock the buffer for entire system
GlobalUnlock(clipbuffer);

// set the type of the clipboard data
SetClipboardData(CF_TEXT,clipbuffer);

// close the clipboard
CloseClipboard();
}

This is working fine for about 150000 items.
But when i have about 500000 items i see a strange behaviour.
The memory usage is increasing for a short time. After this it drops
back to the value before the copy attemp but the process is stuck
in the while-part of this method.
Are there any limits of a CString i`m not aware of?
Or is there an other way to copy more than 150MB to clipboard?
And as last question what way is the fastes to concatenate many strings?
Are stringstreams better or what other ways are possible?

thx
t2x
AnswerRe: Copy large amount of data to clipboard Pin
Tim Smith16-Feb-06 3:45
Tim Smith16-Feb-06 3:45 
AnswerRe: Copy large amount of data to clipboard Pin
James R. Twine16-Feb-06 4:19
James R. Twine16-Feb-06 4:19 
AnswerRe: Copy large amount of data to clipboard Pin
ThatsAlok17-Feb-06 3:11
ThatsAlok17-Feb-06 3:11 
Questionfast code Pin
Waldermort16-Feb-06 1:39
Waldermort16-Feb-06 1:39 
AnswerRe: fast code Pin
James R. Twine16-Feb-06 1:58
James R. Twine16-Feb-06 1:58 
JokeRe: fast code Pin
Ryan Binns16-Feb-06 17:21
Ryan Binns16-Feb-06 17:21 
AnswerRe: fast code Pin
David Crow16-Feb-06 3:13
David Crow16-Feb-06 3:13 
JokeRe: fast code Pin
James R. Twine16-Feb-06 3:17
James R. Twine16-Feb-06 3:17 
Questionunicode to char? Pin
9ine16-Feb-06 1:36
9ine16-Feb-06 1:36 
AnswerRe: unicode to char? Pin
9ine16-Feb-06 1:37
9ine16-Feb-06 1:37 
GeneralRe: unicode to char? Pin
ThatsAlok16-Feb-06 3:05
ThatsAlok16-Feb-06 3:05 
AnswerRe: unicode to char? Pin
James R. Twine16-Feb-06 1:51
James R. Twine16-Feb-06 1:51 
GeneralRe: unicode to char? Pin
PJ Arends16-Feb-06 7:24
professionalPJ Arends16-Feb-06 7:24 
JokeRe: unicode to char? Pin
James R. Twine16-Feb-06 8:08
James R. Twine16-Feb-06 8:08 
QuestionParameters idenfying a system particularly windows Pin
cpp_prgmer16-Feb-06 0:52
cpp_prgmer16-Feb-06 0:52 
AnswerRe: Parameters idenfying a system particularly windows Pin
James R. Twine16-Feb-06 1:01
James R. Twine16-Feb-06 1:01 
Questionpurpose of undef in the code Pin
arunperi15-Feb-06 22:42
arunperi15-Feb-06 22:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.