Ciao ragazzi....ho provato a fare questo tentativo con la clipboard e non capisco perchè non vada! Dovrebbe scrivere "Ciao" Sulla editbox corrente
mha!codice:#include <all.h> #define Box(x) MessageBox(NULL,x,"Information",0) #define EBox(x) MessageBox(NULL,x,"Error!",MB_ICONERROR) int main() { Box("Start"); Sleep(1000); HWND hWnd = GetForegroundWindow(); OpenClipboard(hWnd); char szToCopy [] = "Ciao :):)"; HGLOBAL hResult = GlobalAlloc(GMEM_MOVEABLE, sizeof(szToCopy)); LPSTR lptstrCopy = (LPSTR)GlobalLock(hResult); memcpy(lptstrCopy, szToCopy, sizeof(szToCopy)); GlobalUnlock(hResult); if ( ::SetClipboardData( CF_OEMTEXT, hResult ) == NULL ) { EBox( "Unable to set Clipboard data" ); CloseClipboard(); return 0; } CloseClipboard(); SendMessage(hWnd,WM_PASTE,0,0); return 0; }


Rispondi quotando
