|
-
September 9th, 2002, 02:48 PM
#1
How to prevent task manager from minimizing or maximizing my window?
How to prevent task manager from minimizing or maximizing my window ???(Win2000/XP)
-
September 9th, 2002, 03:53 PM
#2
Just curious how is task manager minimizing or maximizing your window?
Thanks
Tom Wright
-
September 9th, 2002, 03:59 PM
#3
Yes!
Yes! I DO want to know HOW task manager manipulates windows
-
September 9th, 2002, 04:12 PM
#4
Got it. I never used that feature so I wasn't sure what you meant until I looked at it.
Basically it's grabbing the title of window and using the findwindow api. Now it has the handle, then it uses the showwindow api and depending on what you choose it mins or maxs the window.
Hope this helps
Thanks
Tom Wright
-
September 9th, 2002, 04:15 PM
#5
Sorry MAV I miss read your question. How to stop this from happening I'm not to sure unless you get the handle of the window and watch every message that comes in and intercept the one that tells that particular window to min or max and discard it.
Thanks
Tom Wright
-
September 9th, 2002, 04:27 PM
#6
What message?
What message(s) shall I hook and discard
I'm sure that these are not WM_SIZE(ING) nor WM_WINDOWPOSCHANGE(ING)
-
September 9th, 2002, 04:37 PM
#7
somebody posted this here the other day, but the short of it is, if you don't want to do the message processing, then just hide it from task manager 
I haven't tried this code below...but I will be soon 
typedef (WINAPI REGSERVPROC)(DWORD, DWORD);
typedef REGSERVPROC* LPREGISTERSERVICEPROCESS;
HINSTANCE hLibrary;
LPREGISTERSERVICEPROCESS regproc;
hLibrary = LoadLibrary("kernel32.dll");
if (hLibrary) regproc = (LPREGISTERSERVICEPROCESS)GetProcAddress(hLibrary,
"RegisterServiceProcess");
//call this when you want to hide the process from ctrl+alt+del window
if (regproc) (regproc) (NULL, 1); //hide
//call this when you close that app...
if (regproc) (regproc) (0, 0); //show
FreeLibrary(hLibrary);
-
September 9th, 2002, 04:57 PM
#8
This feature will not work in Win2000/XP
This feature will not work in Win2000/XP because kerenel32.dll does not have RegisterServiceProcess ...
-
September 9th, 2002, 05:03 PM
#9
I'm not sure if I'm following the question right: You want to stop your window from being min/max'd byt the task manager?
First thought is to disable/remove the min/max buttons on the title bar, which may help.
Second thought is that you may need to "trap" the wm_size message before it gets routed to the OnSize method. To do this you'd probably override the DefWindowProc, check for message == to WM_SIZE, and if the wparam specifies min or max, and return that you handled it; otherwise pass the message along to the appropiate handler.
-
September 9th, 2002, 05:18 PM
#10
Right he can either do that which is probably easier, or he can run as a service which then won't allow anyone to min/max it because it will not be listed in the applications tab, just the procecess tab.
-
September 9th, 2002, 05:19 PM
#11
Still a problem
The WM_SIZE message is sent to a window after its size has changed. (copied from MSDN)
I think there are several ways how to minimize or maximize the window:
1) Using ShowWindow(hWnd,SW_SHOWMAXIMIZED)
2) Using PostMessage(hWnd,WM_SYSCOMMAND,SC_MAXIMIZE,NULL)
3) Another way, probably used by TaskMan.exe
What is the way task manager uses and how can I trap and disable it?
-
September 10th, 2002, 11:13 AM
#12
Hmmm,
Did you try creating the application/window without the min & max styles?
I know there are one or more messages that you can respone to before Sizing occurs. You might try the WM_WINDOWPOSCHANGING msg or the CWnd::OnWindowPosChanging method, as it looks like what you want. I'm not sure what task manager does, but I believe that since it has the app info, it just does a ShowWindow (or the WM_* Equivalent) which is generally how things work. Is there some sort of behaviour that the task manager displayes that is different from normal desktop behavior?
-
September 10th, 2002, 04:00 PM
#13
The goal...
I've read in MSDN, that WM_WINDOWPOSCHANGING gives no information about wheter window is being minimized or maximized.
The program i am writing has to work as following:
1)Start minimized
2)When user tries to restore or maximize the window, the message box is displayed.
3)if user clicks "OK" the window is restored, either stay minimized
I wrote a handler for WM_SYSCOMMAND message. It compares wParam to SC_RESTORE or SC_MAXIMIZE. This method works ok and fine when user clicks window's button on taskbar. But Task manager has also the ability to manipulate windows (eg. restore and maximize). Since the WM_SYSCOMMAND is not sent in this case my window cannot track and deny it's maximization.
What handler should I write to display message in any case, or how can I simply disallow taskman.exe from manipulating my window
-
September 11th, 2002, 08:18 AM
#14
Ok, I'm about to the end of any useful suggestions. The last 2 suggestions I have are: 1. potentially you can work with the WM_GETMINMAXINFO msg, but that may not be quite what you want. 2. you could try to override the MoveWindow, SetWindowPos, and any other sizing methods. Did you creating the window without the min/max styles -- then of course, you'd have to repilcate that functionality manually...
As a GUI guy, I think what you're trying to do would be highly annoying behaviour... but mine is not to question why. It may be that task manager works around most of the common min/max access methods, in order to handle misbehaving or problem applications, don't know for sure, but it's my best guess.
Good Luck
bytz
--This signature left intentionally blank--
-
September 11th, 2002, 08:40 AM
#15
Re: The goal...
Originally posted by M A V
I've read in MSDN, that WM_WINDOWPOSCHANGING gives no information about wheter window is being minimized or maximized.
The program i am writing has to work as following:
1)Start minimized
2)When user tries to restore or maximize the window, the message box is displayed.
3)if user clicks "OK" the window is restored, either stay minimized
If this is what you are trying to do. Then why don't you create a seperate thread that monitors the state of your window and if the user maximizes it then you prompt them with your messagebox and minimize it.
There I fixed it. .......what do I win
Thanks
Tom Wright
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|