Click here to Skip to main content
15,904,288 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Getting rid of the top blue bar... Pin
#realJSOP9-Nov-01 10:21
professional#realJSOP9-Nov-01 10:21 
GeneralRetrieving main thread handle or ID Pin
9-Nov-01 7:40
suss9-Nov-01 7:40 
GeneralRe: Retrieving main thread handle or ID Pin
Joel Lucsy9-Nov-01 7:47
Joel Lucsy9-Nov-01 7:47 
GeneralRe: Retrieving main thread handle or ID Pin
9-Nov-01 8:19
suss9-Nov-01 8:19 
GeneralRe: Retrieving main thread handle or ID Pin
Tim Deveaux10-Nov-01 3:39
Tim Deveaux10-Nov-01 3:39 
GeneralRe: Retrieving main thread handle or ID Pin
10-Nov-01 5:46
suss10-Nov-01 5:46 
GeneralRe: Retrieving main thread handle or ID Pin
Tim Smith10-Nov-01 6:13
Tim Smith10-Nov-01 6:13 
GeneralRe: Retrieving main thread handle or ID Pin
Tim Deveaux10-Nov-01 7:54
Tim Deveaux10-Nov-01 7:54 
Well, I think of the top level window with the caption etc (i.e. CWinThread::m_pMainWnd in the MFC world) as being the 'main' window - the one to close to terminate the app - but I guess you could argue the point.

I've used ::GetTopWindow and ::GetNextWindow to get the top level windows on the desktop, and if you knew, say, the caption of the window you were looking for, you would be able to identify it with ::SendMessage(hwnd,WM_GETTEXT...(yes, keep in mind that there can be more than one 'top level' window in a process).

Given that nasty bit of strongly coupled heuristic hoop jumping through, you might want to add GetWindowThreadProcessId and GetWindowModuleFileName to the mix.

later...
Now that I think of it, for some apps you can eliminate some of the windows that don't return anything for WM_GETTEXT. But Tim has a point - identifying the 'main' window is tricky - you need to have a clue as to the caption or perhaps window class in order to pull this off, I think.

This is a question that's been seen here before, and I don't think a general solution has been proposed. Maybe if you posted more info about your current problem someone might have a specific fix you could use in your situation.
GeneralRe: Retrieving main thread handle or ID Pin
10-Nov-01 10:53
suss10-Nov-01 10:53 
GeneralPass array or single HWND into function Pin
9-Nov-01 7:16
suss9-Nov-01 7:16 
GeneralRe: Pass array or single HWND into function Pin
Tim Smith9-Nov-01 7:44
Tim Smith9-Nov-01 7:44 
GeneralRe: Pass array or single HWND into function Pin
9-Nov-01 7:50
suss9-Nov-01 7:50 
GeneralRe: Pass array or single HWND into function Pin
Carlos Antollini9-Nov-01 7:57
Carlos Antollini9-Nov-01 7:57 
GeneralRe: Pass array or single HWND into function Pin
9-Nov-01 7:58
suss9-Nov-01 7:58 
GeneralRe: Pass array or single HWND into function Pin
Tim Smith9-Nov-01 8:10
Tim Smith9-Nov-01 8:10 
GeneralThanks!!! Pin
9-Nov-01 8:18
suss9-Nov-01 8:18 
GeneralDestroying / closing windows Pin
ParaSwarm9-Nov-01 6:59
ParaSwarm9-Nov-01 6:59 
GeneralRe: Destroying / closing windows Pin
Carlos Antollini9-Nov-01 7:21
Carlos Antollini9-Nov-01 7:21 
GeneralRe: Destroying / closing windows Pin
Nish Nishant9-Nov-01 8:05
sitebuilderNish Nishant9-Nov-01 8:05 
GeneralRegistry Pin
Deian9-Nov-01 6:44
Deian9-Nov-01 6:44 
GeneralRe: Registry Pin
Carlos Antollini9-Nov-01 7:02
Carlos Antollini9-Nov-01 7:02 
QuestionIs it possible to custom draw the scroll bar in CListCtrl? Pin
RobJones9-Nov-01 3:58
RobJones9-Nov-01 3:58 
GeneralDisable Help button on the "Customize Toolbar" dialog box Pin
9-Nov-01 3:45
suss9-Nov-01 3:45 
GeneralHelp.... Pin
sardinka9-Nov-01 3:42
sardinka9-Nov-01 3:42 
GeneralRe: Help.... Pin
Michael P Butler9-Nov-01 4:06
Michael P Butler9-Nov-01 4:06 

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.