Jump to content
  • Advertisement

Archived

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

Vlion

Whats wrong with this window ?

This topic is 6614 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

Its not putting up a window. Its process runs, but no window. I`m using W98 and VC++5 Thnx, ~V''lion // Generated by CCodeWhiz http://codewhiz.cjb.net // Programmed by Frank Yu codewhiz@netscape.net // Please leave these comments here. #include LRESULT CALLBACK WindowFunc(HWND, UINT, WPARAM, LPARAM); char szWinName[] = "MainWin"; int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) { HWND hwnd; MSG msg; WNDCLASS wcl; //define a window class wcl.hInstance = hInstance; //hand to this instance wcl.lpszClassName = szWinName; // window class name wcl.lpfnWndProc = WindowFunc; //window function wcl.style = 0; // default style wcl.hIcon = LoadIcon(NULL, IDI_QUESTION); wcl.hCursor = LoadCursor(hInstance, "IDC_CURSOR4"); wcl.lpszMenuName = "IDR_MENU1"; wcl.cbClsExtra = 0; // no extra wcl.cbWndExtra = 0; //background wcl.hbrBackground = (HBRUSH)GetStockObject(LTGRAY_BRUSH); // register the window class if(!RegisterClass(&wcl)) return 0; // lets create a window hwnd = CreateWindowEx( szWinName, //name of window class "ALE 0.01", //title WS_OVERLAPPEDWINDOW, //window style -normal CW_USEDEFAULT, // X Coordiate, default CW_USEDEFAULT, // Y Coordiate, default CW_USEDEFAULT, //width, default CW_USEDEFAULT, //height, default NULL, //no parent window "IDR_MENU1", //use menu registered with this class hInstance, //handle of this instance of the program NULL //no additional arguments ); //Display window ShowWindow(hwnd, nShowCmd); UpdateWindow(hwnd); //create the message loop while(GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); //allow use of keyboard DispatchMessage(&msg); //return control to windows } return msg.wParam; } LRESULT CALLBACK WindowFunc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { switch(message) { case WM_DESTROY: //terminate the program PostQuitMessage(0); case break; default: //let windows do the job! you paid too much for it!!! return DefWindowProc(hwnd, message, wParam, lParam); } return 0; } I came, I saw, I got programmers block. ~V''lion

Share this post


Link to post
Share on other sites
Advertisement
Maybe instead of using default values for the height, width and position you could put in some values of your own... just a thought.

Share this post


Link to post
Share on other sites
If you want to use the menu associated with the WNDCLASS, just leave the menu parameter NULL in CreateWindow. Also, when you convert a menu resource to a string, you do this: MAKEINTRESOURCE( IDR_MENU1 ). IDR_MENU1 is just a macro for an integer, like this (but let the compiler juggle the actual numbers):

#define IDR_MENU1 10

You can find all those integer IDs for your project defined in resource.h.




- null_pointer
Sabre Multimedia



Edited by - null_pointer on 4/14/00 6:35:54 AM

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!