Tady je kostra minimalniho funckniho programu pod windows, vypreparoval jsem to z toho, co mi vygeneroval wizard VS.NET...
Parametr z prikazove radky je v lpCmdLine.
lpCmdLine :
[in] Pointer to a null-terminated string specifying the command line for the application, excluding the program name. To retrieve the entire command line, use the GetCommandLine function.
Jak manipulovat s Clipboardem jsem tam ukazal na jednoduchem zkopirovani paramtru do clipboardu...
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <windows.h>
#include <tchar.h>
#include <winuser.h>
#include <string.h>
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
GLOBALHANDLE hGlobal;
DWORD dwSize = strlen(lpCmdLine);
char * pString;
hGlobal = GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, dwSize+1);
pString = (char *) GlobalLock(hGlobal);
memcpy(pString, lpCmdLine, dwSize);
GlobalUnlock(hGlobal);
OpenClipboard(NULL);
EmptyClipboard();
SetClipboardData(CF_TEXT, hGlobal);
CloseClipboard();
GlobalFree(hGlobal);
return 0;
}
|