Jump to content
  • Advertisement
Sign in to follow this  
Prim

Window Creation - A better method?

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

    /* The class is registered, let's create the program*/
    hwnd = CreateWindowEx (
           0,                   /* Extended possibilites for variation */
           "WindowsApp",         /* Classname */
           "Firework Test©",       /* Title Text */
           WS_VISIBLE | WS_SYSMENU | WS_MINIMIZEBOX, /* default window */
           CW_USEDEFAULT,       /* Windows decides the position */
           CW_USEDEFAULT,       /* where the window ends up on the screen */
           (640 + 6),                 /* The programs width */
           (400 + 32),                 /* and height in pixels */
           HWND_DESKTOP,        /* The window is a child-window to desktop */
           NULL,                /* No menu */
           hThisInstance,       /* Program Instance handler */
           NULL                 /* No Window Creation data */
           );

In my coding, I had to include the width and height of the WinXP border (It wasn't automatically tagged on). Is there a way I can have Windows automatically tag it on? /me wonders how my program would look on WinME theme, cause border size is different.

Share this post


Link to post
Share on other sites
Advertisement
I'm surprised that works since WS_SYSMENU specifically says WS_CAPTION must be specified also.

Share this post


Link to post
Share on other sites
Hello :)

There is a better way :


BOOL AdjustWindowRectEx(
LPRECT lpRect, // client-rectangle structure
DWORD dwstyle, // window styles
BOOL bMenu, // menu-present option
DWORD dwExstyle // extended window style
);


Will adject your rect using your style and exstyle. Works on all versions of Windows (from 95 to XP).

HTH,

Share this post


Link to post
Share on other sites
There are a whole host of window resizing functions, which you can use to set the size of the client area. Alternately, you can retrieve the window border information from Windows and tack it on yourself.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!