Thread: Main window position

  1. #1
    the Corvetter
    Join Date
    Sep 2001
    Posts
    1,584

    Main window position

    Do you use CW_USEDEFAULT? Or do you put your own values in it?
    1978 Silver Anniversary Corvette

  2. #2
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    You can put either value, it is up to you.
    "...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers

  3. #3
    the Corvetter
    Join Date
    Sep 2001
    Posts
    1,584
    Of course you can, but what do you prefer?
    1978 Silver Anniversary Corvette

  4. #4
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    I don't do too much straight GDI type stuff anymore, I mainly use DirectX. However when I do need to, I usually use CW_USEDEFAULT though.

  5. #5
    the Corvetter
    Join Date
    Sep 2001
    Posts
    1,584
    Just our of curiosity (and a little off topic), where did you learn to program in DirectX? My buddy and I are going to start doing that, and I'm looking for some promising docs on it...
    1978 Silver Anniversary Corvette

  6. #6
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    Originally posted by Garfield
    Just our of curiosity (and a little off topic), where did you learn to program in DirectX? My buddy and I are going to start doing that, and I'm looking for some promising docs on it...
    Pretty much just doing stuff on my own. They taught the basics at school but I had to learn some of the other components entirely on my own (i.e. Direct3D). I'm sure there are a lot of good tutorials out there...perhaps at

    www.flipcode.com
    www.gametutorials.com

    Are you going to be doing DirectDraw stuff? Basic 2D game or something? If you need some specific help or a sample of something I can give you some of my old source code if you want. Well if you want to talk further about DirectX send me a private message and I can answer your questions.

  7. #7
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    A quick note about putting in your own values for positioning a window. Make sure that you do put some care into where you put your window. Most importantly, make sure it is on screen. HKEY_CURRENT_CONFIG\display\Setting has a key called Resolution. This is what I usually use when I want to put a window in the middle of someone's screen or something. Enjoy.

  8. #8
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    An easier way to get the screen res is

    Code:
    hdc=GetDC(NULL);
    iWidth	=GetDeviceCaps(hdc,HORZRES);
    iHeight	=GetDeviceCaps(hdc,VERTRES);
    ReleaseDC(hdc);
    
    // or as a RECT
    hDesktop=GetDesktopWindow();
    GetWindowRect(hDesktop,&DesktopRect);
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. creating a child window
    By rakan in forum Windows Programming
    Replies: 2
    Last Post: 01-23-2007, 03:22 PM
  2. Button positioning
    By Lionmane in forum Windows Programming
    Replies: 76
    Last Post: 10-21-2005, 05:22 AM
  3. my wndProc is out of scope
    By Raison in forum Windows Programming
    Replies: 35
    Last Post: 06-25-2004, 07:23 AM
  4. Struct *** initialization
    By Saravanan in forum C Programming
    Replies: 20
    Last Post: 10-09-2003, 12:04 PM
  5. Invoking MSWord
    By Donn in forum C Programming
    Replies: 21
    Last Post: 09-08-2001, 04:08 PM