🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

SetClipboardData() wants to hang Windows a lot

Started by
-1 comments, last by GameDev.net 24 years, 7 months ago
I'm using VC++ 4.0 to make a program, one of the parts of initialisation is to fill the clipboard with 256 bytes.

Now is there anything wrong with this code...

HANDLE dat = (HANDLE)malloc(256); // allocate memorydat = memset(dat, 'A', 256); // set it to all A's*((char *)dat) + 255) = '\0'; // terminate with NULLwhile (!OpenClipboard(NULL))  ; // open clipboard for current windowSetClipboardData(CF_TEXT, dat); // set clipboardCloseClipboard(); // close clipboard

Everytime I try to do this, Windows crashes (no blue screen or anything, just locks up totally). I haven't been able to work out why it doesn't work.

Can anyone help?

Cheers,

leroy.

This topic is closed to new replies.

Advertisement