Sign in to follow this  

Window Creation - A better method?

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
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).


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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this