home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!nestroy.wu-wien.ac.at!awiwuw11!8650533
- Organization: Wirtschaftsuniversitaet Wien, Vienna, Austria
- Date: Tuesday, 19 Jan 1993 10:58:06 CET
- From: <8650533@awiwuw11.wu-wien.ac.at>
- Message-ID: <93019.1058068650533@awiwuw11.wu-wien.ac.at>
- Newsgroups: comp.os.os2.programmer
- Subject: Problems getting Desktop window handle and set priority
- Lines: 88
-
-
- Hi all guys there!
-
- I am currently finishing a program (my second one for OS/2) that should
- display a Popup-menu, when the mouse button 1 is pressed on the Desktop. There
- are only two problems I need help for:
-
- 1. Assume that the Desktop looks like the following picture:(where i are icons
- and w are windows)
-
- +------------------------+
- | +-+ +-+ +---------- Here I will call it "Desktop", that is any
- | |I| |I| +---------+ | part of the screen, that is not a window or an
- | +-+ +-+ | | | icon (all area where you can see the background
- | | W +-----+| f.e. OS2LOGO.BMP)
- | +-+ | | ||
- | |i| +------| w ||
- | +-+ | ||
- | +-----+|
- +------------------------+
-
- I have 2 parts,the main procedures in an EXE file and a DLL:
-
- .EXE .DLL
- +-------+ +-------+
- | main | <----------> | hook |
- +-------+ +-------+
-
- The DLL contains a hook that should catch all messages addressed to the
- "Desktop" of type WM_BUTTON1DOWN. Like pressing button 2 on the Desktop to
- get the Shutdown menu, I want to catch all button 1 clicks on the Desktop to
- display my own Popup-menu (displaying the Popup-menu works).
-
- To hook uses the PQMSG structure passed by OS/2 to get the destination window
- handle and the message to compare, if button 1 is clicked on the "Desktop".
-
- The problem is the following: How do I query the window handle of the "Desktop"
- which is exactly the window handle for above picture (i.e. all the Desktop
- without icons and windows, also the same window handle that is used to display
- button 2's Shutdown-menu when button 2 is clicked on).
-
- (I used PMSPY to get a window handle (on my system its 0x3601660 permanently!)
- an to hardcode (for testing) into the DLL to compare with the HWND in the
- PQMSG structure. If mouse button 1 is then pressed my Popup-menu is invoked
- correctly, but also if it is pressed on an icon (which isn't useful). Pressing
- button 1 on any window is correctly ignored. The drawback of this method is
- that PMSPY requires the user to point to any point on the "Desktop" to get the
- window handle of it, which of course I can't use.
-
- A friend of mine meant, that the situation is the following:
- --Z order -->
- | | | a is the window handle returned by WinQueryDesktop(), b is the window
- | i | handle, which PMSPY would return, containing the "Desktop" with all the
- | i | icons, and c is/are the window handles for any window/windows.
- | | |
- a b c
-
- If this is correct, than my question could also be seen as how to get the
- window handle of b (without the icons)?
-
- Maybe I have to use WinQueryWindow() to get the window handle for b?)
-
- 2. I used the code samples of KILLEM20 and PROCS (from ftp-os2.nmsu.edu) to get
- the PID (process ID) of a running program (that works). Then I used this PID
- to change the priority of this process by using the DosSetPriority() API. This
- API returns error 305 (or 306 I can't remember) which means (in the doku.)
- that the process changing the other process' priority isn't the parent process,
- which is of course right.
-
- Now my question: Is there any clever trick to be able to change an other
- process' priority??? (If a program invokes another process as a child, changing
- the priority of the child process isn't a problem, but by doing so, all
- child processes terminate also if the parent process terminates (due to a bug
- or close from the tasklist))
-
-
- +-----------------------------------------------------------------------------+
-
- For any help thanks in advance!!!
-
- (Please mail any suggestions also directly to me (8650533@awiwuw11.wu-wien.ac.a
- t) because I can only check the netnews twice a week and I don't want to miss
- anything.)
-
- Again, thanks and nice greetings from Austria (from the heart of Europe)
- Stangl Roman
-
-
-