API

tomashin

New member
../images/Emo5.gif API

שלום. אני מחפש קוד API שיוצר חלון. אני מחפש בגוגל,MSDN כל אחד מראה משהו אחר ואני מבולבל. אני אודה לאיש שיתן לי קוד שעובד. תודה רבה ויום נעים
 

nosfera2

New member
חלון ריק ב C STYLE

#include <windows.h> LRESULT CALLBACK MsgProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam ) { switch(iMsg) { case WM_DESTROY: PostQuitMessage(0); return 0; } return DefWindowProc( hWnd, iMsg, wParam, lParam); } INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, INT nCmdShow) { WNDCLASSEX wc; HWND hWnd; MSG msg; wc.cbClsExtra = 0L; wc.cbSize = sizeof(WNDCLASSEX); wc.cbWndExtra = 0L; wc.hbrBackground = (HBRUSH)GetStockObject( WHITE_BRUSH ); wc.hCursor = NULL; wc.hIcon = NULL; wc.hIconSm = NULL; wc.hInstance = hInst; wc.lpfnWndProc = MsgProc; wc.lpszClassName ="Your Class Name"; wc.lpszMenuName = NULL; wc.style = CS_HREDRAW | CS_VREDRAW; if ( !RegisterClassEx( &wc ) ) return 1; hWnd = CreateWindow( "Your Class Name", "My Window", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInst, NULL ); ShowWindow( hWnd, nCmdShow ); UpdateWindow( hWnd ); while ( GetMessage( &msg, NULL, 0, 0 ) ) { TranslateMessage( &msg ); DispatchMessage( &msg ); } return msg.wParam; }​
בעיקרון צריך להוסיף אירוע ל Paint אבל מכיוון שהחלון ריק זה לא משנה.
 
למעלה