home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / os / os2 / programm / 7917 < prev    next >
Encoding:
Internet Message Format  |  1993-01-23  |  4.1 KB

  1. Path: sparky!uunet!nestroy.wu-wien.ac.at!awiwuw11!8650533
  2. Organization: Wirtschaftsuniversitaet Wien, Vienna, Austria
  3. Date: Tuesday, 19 Jan 1993 10:58:06 CET
  4. From: <8650533@awiwuw11.wu-wien.ac.at>
  5. Message-ID: <93019.1058068650533@awiwuw11.wu-wien.ac.at>
  6. Newsgroups: comp.os.os2.programmer
  7. Subject: Problems getting Desktop window handle and set priority
  8. Lines: 88
  9.  
  10.  
  11. Hi all guys there!
  12.  
  13. I am currently finishing a program (my second one for OS/2) that should
  14. display a Popup-menu, when the mouse button 1 is pressed on the Desktop. There
  15. are only two problems I need help for:
  16.  
  17. 1. Assume that the Desktop looks like the following picture:(where i are icons
  18.    and w are windows)
  19.  
  20. +------------------------+
  21. | +-+ +-+          +---------- Here I will call it "Desktop", that is any
  22. | |I| |I|  +---------+   |     part of the screen, that is not a window or an
  23. | +-+ +-+  |         |   |     icon (all area where you can see the background
  24. |          |    W +-----+|     f.e. OS2LOGO.BMP)
  25. | +-+      |      |     ||
  26. | |i|      +------|  w  ||
  27. | +-+             |     ||
  28. |                 +-----+|
  29. +------------------------+
  30.  
  31. I have 2 parts,the main procedures in an EXE file and a DLL:
  32.  
  33.   .EXE                    .DLL
  34. +-------+              +-------+
  35. | main  | <----------> | hook  |
  36. +-------+              +-------+
  37.  
  38. The DLL contains a hook that should catch all messages addressed to the
  39. "Desktop" of type WM_BUTTON1DOWN. Like pressing button 2 on the Desktop to
  40. get the Shutdown menu, I want to catch all button 1 clicks on the Desktop to
  41. display my own Popup-menu (displaying the Popup-menu works).
  42.  
  43. To hook uses the PQMSG structure passed by OS/2 to get the destination window
  44. handle and the message to compare, if button 1 is clicked on the "Desktop".
  45.  
  46. The problem is the following: How do I query the window handle of the "Desktop"
  47. which is exactly the window handle for above picture (i.e. all the Desktop
  48. without icons and windows, also the same window handle that is used to display
  49. button 2's Shutdown-menu when button 2 is clicked on).
  50.  
  51. (I used PMSPY to get a window handle (on my system its 0x3601660 permanently!)
  52. an to hardcode (for testing) into the DLL to compare with the HWND in the
  53. PQMSG structure. If mouse button 1 is then pressed my Popup-menu is invoked
  54. correctly, but also if it is pressed on an icon (which isn't useful). Pressing
  55. button 1 on any window is correctly ignored. The drawback of this method is
  56. that PMSPY requires the user to point to any point on the "Desktop" to get the
  57. window handle of it, which of course I can't use.
  58.  
  59. A friend of mine meant, that the situation is the following:
  60. --Z order -->
  61. | | |  a is the window handle returned by WinQueryDesktop(), b is the window
  62. | i |  handle, which PMSPY would return, containing the "Desktop" with all the
  63. | i |  icons, and c is/are the window handles for any window/windows.
  64. | | |
  65. a b c
  66.  
  67. If this is correct, than my question could also be seen as how to get the
  68. window handle of b (without the icons)?
  69.  
  70. Maybe I have to use WinQueryWindow() to get the window handle for b?)
  71.  
  72. 2. I used the code samples of KILLEM20 and PROCS (from ftp-os2.nmsu.edu) to get
  73. the PID (process ID) of a running program (that works). Then I used this PID
  74. to change the priority of this process by using the DosSetPriority() API. This
  75. API returns error 305 (or 306 I can't remember) which means (in the doku.)
  76. that the process changing the other process' priority isn't the parent process,
  77. which is of course right.
  78.  
  79. Now my question: Is there any clever trick to be able to change an other
  80. process' priority??? (If a program invokes another process as a child, changing
  81. the priority of the child process isn't a problem, but by doing so, all
  82. child processes terminate also if the parent process terminates (due to a bug
  83. or close from the tasklist))
  84.  
  85.  
  86. +-----------------------------------------------------------------------------+
  87.  
  88. For any help thanks in advance!!!
  89.  
  90. (Please mail any suggestions also directly to me (8650533@awiwuw11.wu-wien.ac.a
  91. t) because I can only check the netnews twice a week and I don't want to miss
  92. anything.)
  93.  
  94. Again, thanks and nice greetings from Austria (from the heart of Europe)
  95.                                  Stangl Roman
  96.  
  97.  
  98.