API Request

Post a reply


This question is a means of preventing automated form submissions by spambots.
Smilies
:D :) :( :o :shock: :? :cool: :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen: (wave) :ok: (nod)
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: API Request

Re: API Request

Post by Patrick » 03.11.2010 19:05:54

No, I can't. Mostly for the technical reason that you can't use pointers like that in cross-process window messages in the WM_USER range. While most of the things you're marshaling as IntPtr are not actually pointers, the "SearchFlag" thing won't work.

Assuming we fix that, how would the function behave when the process has more than one window?

API Request

Post by CircleDock » 03.11.2010 10:59:39

Can you please provide an API function as follows:

IntPtr WindowHandle = SendMessage(DexpotHandle, DEX_RETURNHWNDFROMPID, IntPtr ProcessID, ref IntPtr SearchFlag)

where

WindowHandle is a Pointer to the return value and is either Zero (no Window found) or a Window Handle.
ProcessID is a Pointer to a Process ID
SearchFlag is a Pointer to a flag value of Zero if only non-visible/non-minimsed Windows should be checked, or non-zero if all Windows are to be checked. Dexpot should replace this flag with a Pointer to a Desktop number (if Handle is non-zero) prior to return.

Patrick will have some idea why I need this function! ;) (Process IDs for tasks on Desktops other than the current one are accessible from the list of running processes but Dexpot appears to hide the Windows for Processes not running on the current Desktop. This function is to overcome that problem.)

Since you already know the Windows Handles for all the Windows open - and presumably store that information in a list of some description - it's a simple matter to get the owning Process ID:

Code: Select all

            int ProcessID = 0;
            int ThreadID = GetWindowThreadProcessId(hWnd, ref ProcessID);


:D

Mark

Top