Re: Re[2]: hWnd of cursor

new topic     » goto parent     » topic index » view thread      » older message » newer message

On Sun, 02 Mar 2003 00:45:30 -0500, Greg Haberek <g.haberek at comcast.net> 
wrote:

>
> i'll take a copy..
>

Me too. I'll add it to the library, if that's okay.

> ----- Original Message ----- From: aku saya <akusaya at gmx.net>
> Subject: Re[2]: hWnd of cursor
>
>
> Thanks very much, I was able to implement it.
> If someone wants the code, I will send it.
> ______________________________________________
>
>>> I want to know what is the hWnd of the current typing cursor
>>> (only one at a time).
>>>
>>> Not only in my application, but also outside of it.
>>>
>>> How to get it?
>>>
>>> Thanks!
>>>
>
> D> The Windows API call you will need is called 'GetGUIThreadInfo'. With 
> this, D> you can get the handle of the foreground (focus) control that 
> has the D> current caret.
>
> D> Here some details from the Mircosoft SDK...
>
> D> GetGUIThreadInfo
> D> The GetGUIThreadInfo function retrieves information about the active 
> window D> or a specified graphical user interface (GUI) thread.
>
> D> BOOL GetGUIThreadInfo(
> D>   DWORD idThread,       // thread identifier
> D>   LPGUITHREADINFO lpgui  // thread information
> D> );
> D> Parameters
> D> idThread [in] Identifies the thread for which information is to be D> 
> retrieved. To retrieve this value, use the GetWindowThreadProcessId D> 
> function. If this parameter is NULL, the function returns information for 
> D> the foreground thread. lpgui [out] Pointer to a GUITHREADINFO 
> structure D> that receives information describing the thread. Note that 
> you must set D> GUITHREADINFO.cbSize to sizeof(GUITHREADINFO) before 
> calling this function. D> Return Values
> D> If the function succeeds, the return value is nonzero.
>
> D> If the function fails, the return value is zero. To get extended error 
> D> information, call GetLastError.
>
> D> Remarks
> D> This function succeeds even if the active window is not owned by the 
> D> calling process. If the specified thread does not exist or have an 
> input D> queue, the function will fail.
>
> D> This function is useful for retrieving out-of-context information 
> about a D> thread. The information retrieved is the same as if an 
> application D> retrieved the information about itself.
>
> D> Requirements Windows NT/2000/XP: Included in Windows NT 4.0 SP3 and 
> later.
> D>   Windows 95/98/Me: Included in Windows 98 and later.
> D>   Header: Declared in Winuser.h; include Windows.h.
> D>   Library: Use User32.lib.
>
>
> D> The GUITHREADINFO structure contains information about a GUI thread.
>
> D> typedef struct tagGUITHREADINFO {
> D>     DWORD   cbSize;
> D>     DWORD   flags;
> D>     HWND    hwndActive;
> D>     HWND    hwndFocus;
> D>     HWND    hwndCapture;
> D>     HWND    hwndMenuOwner;
> D>     HWND    hwndMoveSize;
> D>     HWND    hwndCaret;
> D>     RECT    rcCaret;
> D> } GUITHREADINFO, *PGUITHREADINFO;
> D> Members
> D> cbSize Specifies the size of this structure, in bytes. The caller must 
> set D> this to sizeof(GUITHREADINFO). flags Specifies the thread state. 
> This D> member can be one or more of the following values. Value Meaning 
> D> GUI_16BITTASK Windows XP: Represents the thread's application type. 
> This D> bit is set if the thread corresponds to a 16-bit application. D> 
> GUI_CARETBLINKING  Represents the caret's blink state. This bit is set if 
> D> the caret is visible.  GUI_INMENU  Represents the thread's menu state. 
> This D> bit is set if the thread is in menu mode.  GUI_INMOVESIZE  
> Represents the D> thread's move state. This bit is set if the thread is 
> in a move or size D> loop.  GUI_POPUPMENUMODE  Represents the thread's 
> pop-up menu state. This D> bit is set if the thread has an active pop-up 
> menu.  GUI_SYSTEMMENUMODE  D> Represents the thread's system menu state. 
> This bit is set if the thread is D> in a system menu mode.
>
>
> D> hwndActive Handle to the active window within the thread. hwndFocus 
> Handle D> to the window that has the keyboard focus. hwndCapture Handle 
> to the window D> that has captured the mouse. hwndMenuOwner Handle to the 
> window that owns D> any active menus. hwndMoveSize Handle to the window 
> in a move or size loop. D> hwndCaret Handle to the window that is 
> displaying the caret. rcCaret A RECT D> structure that describes the 
<snip>

>
>


-- 

cheers,
Derek Parnell

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu