Click here to Skip to main content
15,884,388 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: multi-processes's memory sharing problem? Pin
Michael Schubert4-Dec-09 5:25
Michael Schubert4-Dec-09 5:25 
GeneralRe: multi-processes's memory sharing problem? Pin
nenfa7-Dec-09 20:08
nenfa7-Dec-09 20:08 
QuestionAccessing Dialog member Variable problem Pin
kamalilam3-Dec-09 19:30
kamalilam3-Dec-09 19:30 
AnswerRe: Accessing Dialog member Variable problem Pin
«_Superman_»3-Dec-09 19:40
professional«_Superman_»3-Dec-09 19:40 
AnswerRe: Accessing Dialog member Variable problem Pin
Madhu Nair3-Dec-09 19:44
Madhu Nair3-Dec-09 19:44 
AnswerRe: Accessing Dialog member Variable problem Pin
Cedric Moonen3-Dec-09 20:10
Cedric Moonen3-Dec-09 20:10 
AnswerRe: Accessing Dialog member Variable problem Pin
Rajesh R Subramanian3-Dec-09 21:14
professionalRajesh R Subramanian3-Dec-09 21:14 
QuestionWhich window has the focus [modified] Pin
SujayG3-Dec-09 18:17
SujayG3-Dec-09 18:17 
I have to return the path of the selected file , EITHER in the Desktop or in the Windows Explorer.

I can get the path of the selected file both on the Windows Explorer and the desktop

My problem is that I am unable to find which window has the current focus

1) The user has selected a file on the desktop
2) The user has selected a file in the Windows explorer. ( So this has the focus now )

How do I programatically find that out

I am using the following code

HWND hWndDesktop = GetDesktopHandle(); // Gets the handle of the SyslistView32 window

DWORD dwThread = ::GetWindowThreadProcessId(hWndDesktop, NULL);

GUITHREADINFO gtf ;

gtf.cbSize = sizeof(GUITHREADINFO);

BOOL b = GetGUIThreadInfo(dwThread, >f);

if(hWndDesktop == gtf.hwndFocus)
{
// this window currently has the focus
}

But I am getting different handles for hWndDesktop and gtf.hwndFocus .

Please let me know if I am missing something

EDIT

I am trying to get the Window handle across processes .

Thanks
Sujay

modified on Friday, December 4, 2009 12:40 AM

AnswerRe: Which window has the focus Pin
«_Superman_»3-Dec-09 18:21
professional«_Superman_»3-Dec-09 18:21 
GeneralRe: Which window has the focus Pin
SujayG3-Dec-09 18:31
SujayG3-Dec-09 18:31 
GeneralRe: Which window has the focus [modified] Pin
Madhu Nair3-Dec-09 19:28
Madhu Nair3-Dec-09 19:28 
AnswerRe: Which window has the focus Pin
vasu_sri3-Dec-09 20:18
vasu_sri3-Dec-09 20:18 
QuestionIs there a convenient way to change a System environment variable in MFC? Pin
Erik3-Dec-09 18:16
Erik3-Dec-09 18:16 
AnswerRe: Is there a convenient way to change a System environment variable in MFC? Pin
T21023-Dec-09 19:27
T21023-Dec-09 19:27 
GeneralRe: Is there a convenient way to change a System environment variable in MFC? Pin
Erik3-Dec-09 23:36
Erik3-Dec-09 23:36 
QuestionRe: Is there a convenient way to change a System environment variable in MFC? Pin
David Crow4-Dec-09 3:41
David Crow4-Dec-09 3:41 
Questionwhy RES file contain ICO file path? Pin
HOW WHAT3-Dec-09 17:06
HOW WHAT3-Dec-09 17:06 
AnswerRe: why RES file contain ICO file path? [modified] Pin
Adam Roderick J3-Dec-09 17:14
Adam Roderick J3-Dec-09 17:14 
Questionerror LNK2001: unresolved external symbol _wWinMain@16 Pin
includeh103-Dec-09 15:32
includeh103-Dec-09 15:32 
QuestionRe: error LNK2001: unresolved external symbol _wWinMain@16 Pin
David Crow3-Dec-09 16:02
David Crow3-Dec-09 16:02 
AnswerRe: error LNK2001: unresolved external symbol _wWinMain@16 Pin
Adam Roderick J3-Dec-09 17:06
Adam Roderick J3-Dec-09 17:06 
Questionload bitmap into memory [modified] Pin
transoft3-Dec-09 11:54
transoft3-Dec-09 11:54 
AnswerRe: load bitmap into memory Pin
«_Superman_»3-Dec-09 13:04
professional«_Superman_»3-Dec-09 13:04 
GeneralRe: load bitmap into memory Pin
transoft4-Dec-09 2:18
transoft4-Dec-09 2:18 
QuestionHow to measure program speed? Pin
Grimes3-Dec-09 6:31
Grimes3-Dec-09 6:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.