SetClipboardData + CF_BITMAP

vecchio56 Messages postés 6535 Date d'inscription lundi 16 décembre 2002 Statut Membre Dernière intervention 22 août 2010 - 14 mai 2004 à 15:40
BruNews Messages postés 21040 Date d'inscription jeudi 23 janvier 2003 Statut Modérateur Dernière intervention 21 août 2019 - 14 mai 2004 à 16:26
J'essaye de mettre un bitmap dans la clipboard, mais vu que je ne sais pas trop comment ca marche les bitmap, je galère un peu. Voila ou j'en suis:

HBITMAP hbmp = LoadBitmap(hInst, (LPCTSTR)IDB_BITMAP);
HGLOBAL hgbl = GlobalAlloc(GMEM_MOVEABLE , sizeof(HBITMAP));
LPBYTE mem = (LPBYTE)GlobalLock(hgbl);
memcpy(mem, hbmp, sizeof(HBITMAP));
GlobalUnlock(hgbl);
OpenClipboard(hWnd);
EmptyClipboard();
SetClipboardData(CF_BITMAP, hgbl);
CloseClipboard();

mais ce ne marche pas, ce serait sympa si quelqu'un pouvait m'aider

2 réponses

vecchio56 Messages postés 6535 Date d'inscription lundi 16 décembre 2002 Statut Membre Dernière intervention 22 août 2010 14
14 mai 2004 à 15:54
Bon pour le coup je crois que j'ai cherché trop compliqué, apparemment pas besoin de GlobalAlloc
0
BruNews Messages postés 21040 Date d'inscription jeudi 23 janvier 2003 Statut Modérateur Dernière intervention 21 août 2019
14 mai 2004 à 16:26
Reponse complete peut interesser du monde.

HBITMAP hbmp = LoadBitmap(hInst, (LPCTSTR)IDB_BITMAP);
if(!hbmp) return;
OpenClipboard(hWnd);
EmptyClipboard();
SetClipboardData(CF_BITMAP, hbmp);
CloseClipboard();

ciao...
BruNews, Admin CS, MVP Visual C++
0
Rejoignez-nous