Archived

This topic is now archived and is closed to further replies.

what is the problem whit my code

This topic is 5494 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

OK here my code and yes i did an windows32 api project and all linked stuff o and i got visual c++ 6.0 soo here the code. #include <windows.h> #include <stdio.h> LRESULT CALLBACK WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam); int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { HWND hwnd; MSG msg; WNDCLASSEX wc; wc.cbSize = sizeof(wc); wc.style = CS_HREDRAW | CS_VREDRAW; wc.lpfnWndProc = WndProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = hInstance; wc.hIcon = LoadIcon(NULL, IDI_WINLOGO); wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH); wc.lpszMenuName = NULL; wc.lpszClassName = "Window Class1"; wc.hIcon = LoadIcon(NULL, IDI_WINLOGO); RegisterClassEx(&wc); hwnd = CreateWindow ("Window Class 1" "My First Window", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL); ShowWindow(hwnd, nCmdShow); UpdateWindow(hwnd); while (GetMessage(& msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } return msg.wParam; } LRESULT CALLBACK WndProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) { switch(Msg) { case WM_CREATE: break; case WM_SIZE: break; case WM_PAINT: break; case WM_DESTROY: PostQuitMessage(0); break; } return DefWindowProc(hWnd, Msg, wParam, lParam); } and here is the error i get Compiling... win main.cpp C:\Windows\Bureau\dump\c++\My project\windows 32 api\prj1\win main.cpp(46) : warning C4003: not enough actual parameters for macro ''CreateWindowA'' C:\Windows\Bureau\dump\c++\My project\windows 32 api\prj1\win main.cpp(46) : error C2059: syntax error : '')'' Error executing cl.exe. Please tell me what i have to do because before i was doing windows32 api and all went well do i have to reinstall Kevin

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
You forgot a comma after the first argument of CreateWindow.

You should also note that the class name in your wc variable ("Window Class1" differs from the class name in the call to CreateWindow ("Window Class 1". You have to make those the same before the program will run.

Share this post


Link to post
Share on other sites
une "comma" est une virgule

Vous avez besoin d''une virgule entre les deux "strings":


hwnd = CreateWindow ("Window Class1", //mettez une virgule ici
"My First Window",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
CW_USEDEFAULT,
NULL,
NULL,
hInstance,
NULL);


Share this post


Link to post
Share on other sites
Guest Anonymous Poster
nNno offense, but if you didn''t know what a comma is, how the hell do you expect to learn programming? (unless your native language is not english)

Share this post


Link to post
Share on other sites