Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

WS_MAXIMIZE on initial CreateWindow (doesn't work)

This refers to Petzold's "sketch" program. It

comes up initially "minimized", and I wanted it

to come up "maximized", so I read how to do it

in the win32api, and it seemed all I had to do

was "OR" WS_MAXIMIZE with the existing dwStyle

paramater (WS_OVERLAPPEDWINDOW), and that would cause

the window to be maximized initially. Negative!

Why oh why do they seem to always leave something

important out of their documentation? (Msoft, I mean).

Obviously there is more to do - have any of you

window's gurus ran into this (maybe a long time ago)?

Also, is it going to be possible for me to prevent

this window from ever being altered? (in other words,

I want it to either be "maximized", or "hidden",

but never made any different than when it is first

created? I would really like it to just start up

and be "fullscreen", but I can't find that described

anywhere in the win32api. Help.

Jerry Burnett alcman@neto.com





Comments

  • After trying a bunch of different things

    (very unscientific) I was able to get this

    window max'd by hardcoding the initial

    x and y position (0,0) and size (800,600)

    on the createwindow function. (getsystem-

    metrics gave me back something less than

    600, about 540, when I asked for full-screen

    height ???). Now I need to omit that little

    blue bar across the top (the one that you can

    click on, and then start moving the screen

    around - BAD MOVE - I definitely DO NOT want

    this screen to be fiddled with that way).

    I can't find any special "windows class", or

    "style", that will "unmake" that bar, and just

    give me the whole shebang window in the

    color I specified. Do any of you guru's know

    how to get rid of that "repositioning bar"?

    Or better yet, am I doing this all wrong?

    I really want a full screen (800x600) window,

    that I can "hide" (using alt-tab), and retrieve

    (using small icon click on the lower win98

    task bar), and that I can draw to as my heart

    desires and my code dictates. Is this the

    wrong approach?

    Thanks, Jerry Burnett alcman@neto.com


  • OK, I dont have the Petzold book anywhere near me and I certainly dont have access to your code, but I'm willing to bet $1000 that you set WS_MAXIMIZE in CreateWindowEx and then used ShowWindow(SW_SHOWNORMAL) or whatever. This isnt Microsoft fault so stop bashing.




  • Ok, to maximize a window is to take all desktop space - task bar. The left of you are talking about is the task bar height.


    To do what you want, this may work:

    - Make sure no menu in your class!

    - CreateWindowEx with dwExStyle = 0L and dwStyle = WS_POPUP.

    - In WM_ACTIVATEAPP, do this:

    SetWindowPos(

    hWnd,

    HWND_TOPMOST,

    0,

    0,

    GetSystemMetrics( SM_CXSCREEN ),

    GetSystemMetrics( SM_CYSCREEN ),

    0L );


    This will gurantee your window will take all screen size and will be above any other window even if the user starts another top-most window after yours (e.g. winamp), they hide/show the taskbar or changed screen size.


    Thanks


  • : Ok, to maximize a window is to take all desktop space - task bar. The left of you are talking about is the task bar height.


    : To do what you want, this may work:

    : - Make sure no menu in your class!

    : - CreateWindowEx with dwExStyle = 0L and dwStyle = WS_POPUP.

    : - In WM_ACTIVATEAPP, do this:

    : SetWindowPos(

    : hWnd,

    : HWND_TOPMOST,

    : 0,

    : 0,

    : GetSystemMetrics( SM_CXSCREEN ),

    : GetSystemMetrics( SM_CYSCREEN ),

    : 0L );


    : This will gurantee your window will take all screen size and will be above any other window even if the user starts another top-most window after yours (e.g. winamp), they hide/show the taskbar or changed screen size.


    : Thanks





  • That works! There is another older book

    "Windows 95 API HOW-TO", and they have

    a C++ example of a "screen-saver", which

    uses a full screen, of course. Sure enough,

    they define an "extended" window with the

    POPUP extended style. I don't think I would

    have ever guessed to use a popup style for

    a fullscreen - I think of popups as little

    selector type windows. Also, getsystemmetrics

    uses the term SYSCREEN for the "full" screen

    height (600 in my case), but the term

    SYFULLSCREEN only returns 540 (leaving room

    for the taskbar popup). I keep getting thrown

    off by assuming ordinary meanings to the

    mnemonics used - not good!

    Petzold's book is expensive, but I lucked out

    and found it at "Half-Priced" books - lucky me.

    Also, if you specify HWND_TOP instead of

    HWND_TOPMOST, you can still get your taskbar

    and be able to start other things on the side,

    but you have to "repaint" the full screen.

    If you have ever seen a "shareware" product,

    THUMBS-PLUS, they offer a slide show which

    uses a full screen. I was SURE they had to

    be using GDI (instead of directx), and now

    I am guessing they must define their "slide

    show" window as a "popup" - right?

    Thanks,

    Jerry Burnett alcman@neto.com


  • Havent seen THUMBS-PLUS but I'm sure they used POPUP, cant think of any other way (Unless normal OVERLAPPED with client area = screen size and positioned so that the caption and border are out of screen, but that's stupid!)


    Have you got Spy++? It comes with VC++. Can use the Find Window tool then check the styles used. It will reveal all secrets!


    Good luck


  • rinoobrinoob Member Posts: 14
    ShowWindow(hWnd, SW_MAXIMIZE);

    ... will work (maximise) regardless of wether or not WS_MAXIMIZE was passed to CreateWindowEx.

    As Microsoft provided a clumsy API bashing them for it is perfectly reasonable.

    : OK, I dont have the Petzold book anywhere near me and I certainly
    : dont have access to your code, but I'm willing to bet $1000 that you
    : set WS_MAXIMIZE in CreateWindowEx and then used
    : ShowWindow(SW_SHOWNORMAL) or whatever. This isnt Microsoft fault so
    : stop bashing.


  • Justin BibJustin Bib USAMember Posts: 0

    _______ [ http://forcoder.org ] free ebooks and video tutorials about < MATLAB, C, C++, Objective-C, PL/SQL, Ruby, Scratch, JavaScript, Delphi, C#, Python, Visual Basic, Java, Go, Visual Basic .NET, Perl, Assembly, PHP, R, Swift Clojure, FoxPro, Erlang, ABAP, Lisp, LabVIEW, Prolog, Crystal, Dart, Logo, Ada, Fortran, Bash, Alice, COBOL, Kotlin, Hack, Scheme, Scala, Transact-SQL, Lua, SAS, Julia, F#, D, ML, VBScript, Rust, Awk, Apex /> ___________

Sign In or Register to comment.