Advertisement

WM_ACTIVATE

Started by September 04, 2000 06:05 AM
5 comments, last by Ironblayde 24 years, 4 months ago
I wrote a map editor using Visual C++ and DirectX for tile-based games that runs in a window awhile back. Everything works fine except for one thing that's been bothering me. If the map editor is the active application, with another window underneath it, and you activate the window underneath, that window doesn't get shown fully. My map editor obscures part of the window - usually only the title bar and window border. This clipped screenshot from my desktop shows what I mean:

Notepad is the active application in this pic, but as you can see, the title bar, menu bar, and window border are still covered by the map editor. To determine whether or not my window is active, my WindowProc() has the following code in it (in a switch statement):
        
case WM_ACTIVATE:
    if (LOWORD(wparam) == WA_INACTIVE)
        focus = FALSE;
    else
        focus = TRUE;
    return(0);
    break;        
Then, if (!focus), nothing in my main program loop executes except checking the message queue. Otherwise the map editor window updates about 30 times a second. What am I doing wrong that poor old Notepad is getting its title bar mangled? -Ironblayde  Aeon Software EDIT: One other thing that happens too. If the Windows screensaver kicks in while the map editor window is active, the map editor shows one last frame... after the screensaver has set fullscreen graphics! So the result is a starfield where the stars are slowly eliminating that one last frame my map editor felt it had to show. Edited by - Ironblayde on 9/4/00 6:11:23 AM
"Your superior intellect is no match for our puny weapons!"
You probably didn''t attach a clipper to you own window... that is the only reason I can think off...

So what you need to do is... connect a IDIRECTCLIPPER interface to the "MAIN" form of you application... then everything will work just fine...

Hope this helps, Dark
ICQ: 130925152Email: e.j.folkertsma@student.utwente.nl
Advertisement
And double-check that you gave your window handle to DirectDraw!

Happy Coding!


- null_pointer
Sabre Multimedia
I use WM_ACTIVATEAPP myself. Windows / DirectX sends that message first, I believe, and it''s also the message that the DX API docs mention that it sends.

WhoopA, the Official Kicker of Butts

--- Home Page, visit at your own risk!
The future is not set. There is no fate, but what we make of ourselves.
Everywhere I look, I see rabbits. Maybe I should take down all my Sailor Moon stuff.
WhoopA, the Official Kicker of Butts--- Where have I been all these years?
Dark: No, I''m not using a DirectDraw clipper, I''m just blitting to the window''s client area and using messages like WM_SIZE, WM_MOVE, etc. to make sure the coordinates stay correct. Do you think it would help the problem to use a DirectDraw clipper? I mean, the problem doesn''t deal with drawing outside my window. But then, I''ve never used a clipper in a windowed app before. Does it take other windows into account?

null_pointer: If by sending the window handle to DirectDraw you just mean using it in the call to IDirectDraw7::SetCooperativeLevel(), yes, I''m doing that.

WhoopA: I tried adding code to detect the WM_ACTIVATEAPP message as well, but the problem persists...

Thanks guys... I guess I''ll start playing around with a DirectDraw clipper and see what happens.

-Ironblayde
Aeon Software
"Your superior intellect is no match for our puny weapons!"
When doing windowed DirectDraw, ALWAYS attach a clipper to it. It is very simple and will solve all of your overdraw problems.



Steve 'Sly' Williams
Tools Developer
Krome Studios
Steve 'Sly' Williams  Monkey Wrangler  Krome Studios
turbo game development with Borland compilers
Advertisement
Looks like you were right. Thanks everyone!

-Ironblayde
Aeon Software
"Your superior intellect is no match for our puny weapons!"

This topic is closed to new replies.

Advertisement