Tech Support > Microsoft Windows > Development Resources > Window Positioning Problem
Window Positioning Problem
Posted by Alvin on December 27th, 2003


I am writing a program that its main window should display on top of another
full-screen DirectDraw application window.
My program used API function below:
SetWindowPos(MyHwnd, HWND_TOPMOST, x, y, 0, 0,
SWP_NOACTIVATE|SWP_SHOWWINDOW|SWP_NOSIZE);

It works and successfully displayed my program's window on top of the
DirectDraw window. But when I press my program's window using mouse
click(seem to be got focus or become a foreground window), the DirectDraw
window being minimized automatically.

I thought some ways to prevent the DirectDraw window becomes minimized, I
have tried to write a hook DLL and within the DLL subclassed the DirectDraw
window's WndProc to intercept the WM_NCACTIVATE message and make it return
FALSE.

The DLL works successfully to prevent it to be minimized automatically, but
another problem occurs, although the DirectDraw window not to be minimized
but the taskbar automatically displayed after a few seconds, it likes a
behaviour that just the minimization completed(the taskbar auto-showed).

I want to find a solution that how to make my program's window displayed on
top of some other full-screen DirectDraw application window? Two windows
should displayed on screen at the same time. If not using DLL hook, there
have any other ways to prevent DirectDraw window to be minimized when lost
focus??

Thanks



Similar Posts