//
Global variable
char sz_commmandline_arguments[256];
Code
more code
**********************************************************************************************************************
// MAIN PROGRAMLOOP
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
PSTR szCmdLine, int iCmdShow)
{
MSG msg;
WNDCLASSEX wndclass ;
int i_text_length = 0;
int i = 0;
// Main window class declaratie.
wndclass.cbSize = sizeof(WNDCLASSEX);
wndclass.style = CS_HREDRAW | CS_VREDRAW ;
wndclass.lpfnWndProc = WndProc ;
wndclass.cbClsExtra = 0 ;
wndclass.cbWndExtra = 0 ;
wndclass.hInstance = hInstance ;
wndclass.hCursor = LoadCursor (NULL, IDC_ARROW) ;
wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH) ;
wndclass.lpszMenuName = 0;
wndclass.lpszClassName = szAppName ;
wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wndclass.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
if (!RegisterClassEx (&wndclass))
{
MessageBox (NULL,"This program requires Windows NT!",szAppName, MB_ICONERROR) ;
return 0 ;
}
hwnd = CreateWindowEx (
WS_EX_APPWINDOW,
szAppName, // window class name
"LEDFUNCTIONS", // window caption
WS_OVERLAPPEDWINDOW,// | WS_VSCROLL | WS_HSCROLL, // window style
CW_USEDEFAULT, // initial x position
CW_USEDEFAULT, // initial y position
CW_USEDEFAULT, // initial x size
CW_USEDEFAULT, // initial y size
NULL, // parent window handle
NULL, // window menu handle
hInstance, // program instance handle
NULL // creation parameters
);
if(hwnd == NULL)
{
MessageBox(NULL, "Window Creation Failed!", "Error!",MB_ICONEXCLAMATION | MB_OK);
return 0;
}
DeleteObject ((HGDIOBJ) SetClassLong (hwnd, GCL_HBRBACKGROUND,(LONG) CreateSolidBrush (RGB (212,208 ,200))));
InvalidateRect (hwnd, NULL, TRUE);
ShowWindow (hwnd, iCmdShow);
UpdateWindow (hwnd);
for(i = 0; i < 256;i++); //Init array.
{
sz_commmandline_arguments = 0;
ch_textbuffer = 0;
}
i_text_length = strlen(szCmdLine); //If no arguments, no need to copy data.
if( i_text_length > 0)
{
for(i = 0;i < i_text_length;i++)
{
sz_commmandline_arguments = szCmdLine;
}
}
//**********************************************************************************************************************
// messageloop .
while (GetMessage (&msg, NULL, 0, 0) > 0) // > 0 means window messages.
{ // -1 equals error. 0 is de result of the MQ : PostQuitMessage.
TranslateMessage (&msg);
DispatchMessage (&msg);
}
return msg.wParam;
}