window properties

This is a discussion on window properties within the C++ Programming forums, part of the General Programming Boards category; im having problems with making the window maximized and uncloseable... basically, im wanting the window to maximize and be uncloseable ...

  1. #1
    Registered User
    Join Date
    Jul 2005
    Posts
    33

    window properties

    im having problems with making the window maximized and uncloseable... basically, im wanting the window to maximize and be uncloseable unless requirements are met. (example -- passwords in a screensavers) any help or a site i can go to?

  2. #2
    Registered User Queatrix's Avatar
    Join Date
    Apr 2005
    Posts
    1,342
    To do this just make the window style: WS_POPUP. (And that style only.)
    Then make you'r window position: x = -5, y - =5.
    And make your windows size: x = GetSystemMetrics(SM_CXSCREEN) + 10, y = GetSystemMetrics(SM_CYSCREEN) + 10.
    Then make declare your windows WM_DESTROY statement, but leave it blank.

  3. #3
    Registered User
    Join Date
    Jul 2005
    Posts
    33
    ok, i need some help with that explanation, im more visual, maybe a website? I'm looking for it, but most of the stuff coming up is for VC++, and MSDN isnt helping...
    Last edited by Warhawk; 09-13-2005 at 05:11 PM. Reason: oops

  4. #4
    Registered User
    Join Date
    Jul 2005
    Posts
    33
    heres some code i picked up, but im having a problem with it:

    Code:
    #include <iostream>
    
    #define WINDOW_WIDTH 640     //sets window width
    #define WINDOW_HEIGHT 480   //sets window height
    
    CreateWindow(CLASSNAME, "Basic Window",
    WS_POPUP| WS_VISIBLE,
    (GetSystemMetrics(SM_CXSCREEN)>>1) - (WINDOW_WIDTH>>1),
    (GetSystemMetrics(SM_CYSCREEN)>>1) - (WINDOW_HEIGHT>>1),
    WINDOW_WIDTH,WINDOW_HEIGHT,NULL,NULL,hinstance,NULL);
    the code in red is what is bringing up the error message...
    it says: expected constructor, destructor, or type conversion before '(' token.

    expected `,' or `;' before '(' token
    Last edited by Warhawk; 09-13-2005 at 05:57 PM.

  5. #5
    Cheesy Poofs! PJYelton's Avatar
    Join Date
    Sep 2002
    Location
    Boulder
    Posts
    1,728
    Is this for a Win32 program or a console program? If you post your code that'll help.

  6. #6
    Registered User
    Join Date
    Jul 2005
    Posts
    33
    basic C++ program using dev-C++

    this is just a demo... that is where the code is supposed to go, right?
    Last edited by Warhawk; 09-13-2005 at 06:04 PM.

  7. #7
    Registered User
    Join Date
    Jul 2005
    Posts
    33
    no help... gosh i feel loved

  8. #8
    Cheesy Poofs! PJYelton's Avatar
    Join Date
    Sep 2002
    Location
    Boulder
    Posts
    1,728
    I've never used dev-C++ so I'm not sure how possible if it can be used to create window programs. I suggest you post this question in the Windows Programming board here (or have a mod move this one) and make sure you post all of your code.

    Unfortunately windows programming is very difficult and if you are just starting out I doubt you'll find it understandable. Its possible to maximize a console window for a simple program but I don't think you can make it uncloseable.

    Look in this thread for ideas to make the window maximized:

    C++ Full Screen

  9. #9
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398
    ...I'm not sure how possible if it can be used to create window programs.
    Yes, it can. But I haven't used it either.

    Its possible to maximize a console window for a simple program but I don't think you can make it uncloseable.
    I don't think it's possible either... since you are not writing the code that creates the "DOS box"

    I'm not sure how much "support code" you need for CreateWindow().... It may only work as part of a full Windows GUI application. (?)

    Did you include <windows.h> ?
    Is there a main() or WinMain() function ?

    CreateWindow() seems to require two strings, a class name and a window name. I think CLASSNAME is wrong here, unless it's a pointer to a string.

    And, you've messed-up the last "NULL" with an extra space: ...WINDOW_WIDTH,WINDOW_HEIGHT,NULL,NULL,hinstance,NUL L);

    Then make declare your windows WM_DESTROY statement, but leave it blank.
    Right! Here's the famous Forger's Tutorial which shows how a window is normally closed:

    You click on the X
    Windows sends a WM_DESTROY message to your window
    Your program (WinProc) responds with PostQuitMessage, which shuts-down your program.

  10. #10
    Registered User
    Join Date
    Jul 2005
    Posts
    33
    thanks alot, that clears up alot of stuff! the explanation in the first link was great!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. WM_CAPTION causing CreateWindowEx() to fail.
    By Necrofear in forum Windows Programming
    Replies: 8
    Last Post: 04-06-2007, 09:23 AM
  2. 6 measly errors
    By beene in forum Game Programming
    Replies: 11
    Last Post: 11-14-2006, 11:06 AM
  3. My Window Class
    By Epo in forum Game Programming
    Replies: 2
    Last Post: 07-10-2005, 03:33 PM
  4. Pong is completed!!!
    By Shamino in forum Game Programming
    Replies: 11
    Last Post: 05-26-2005, 11:50 AM
  5. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 01:34 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21