Click here to Skip to main content
15,897,187 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralGetting an HWND from an HINSTANCE Pin
Harold Bamford2-Oct-02 6:21
Harold Bamford2-Oct-02 6:21 
GeneralRe: Getting an HWND from an HINSTANCE Pin
Phil J Pearson2-Oct-02 7:14
Phil J Pearson2-Oct-02 7:14 
GeneralRe: Getting an HWND from an HINSTANCE Pin
Chris Richardson2-Oct-02 9:58
Chris Richardson2-Oct-02 9:58 
GeneralRe: Getting an HWND from an HINSTANCE Pin
Harold Bamford2-Oct-02 11:46
Harold Bamford2-Oct-02 11:46 
GeneralRe: Getting an HWND from an HINSTANCE Pin
Chris Richardson2-Oct-02 11:59
Chris Richardson2-Oct-02 11:59 
GeneralRe: Getting an HWND from an HINSTANCE Pin
Phil J Pearson2-Oct-02 12:10
Phil J Pearson2-Oct-02 12:10 
GeneralRe: Getting an HWND from an HINSTANCE Pin
Chris Richardson2-Oct-02 12:19
Chris Richardson2-Oct-02 12:19 
GeneralRe: Getting an HWND from an HINSTANCE Pin
Harold Bamford2-Oct-02 12:20
Harold Bamford2-Oct-02 12:20 
Chris,

I suspected I was mixing apples and oranges. But it still doesn't seem to work.
BOOL CIOGuidesView::enumwndfn(CWnd * wnd)
{
	WININFO wininfo(wnd);
		

	wnd->GetWindowText(wininfo.title);
		

	DWORD ProcessId; 
	GetWindowThreadProcessId (wnd->GetSafeHwnd(), &ProcessId ); 
		

	// We open a handle to the process, which can be compared with the handle
	// returned by ShellExecuteEx.
	HANDLE a_hProcess = OpenProcess( PROCESS_QUERY_INFORMATION, FALSE, ProcessId );
	wininfo.hInst = (HINSTANCE)a_hProcess;
	CloseHandle(a_hProcess);  // only need it for comparison purposes
		
	//wininfo.hInst = (HINSTANCE)ProcessId;  // the wrong way...

	m_WinInfoArray.Add(wininfo);

	return TRUE;
}

This still yields no exact matches on hProcess (from ShellExecuteEx) and a_hProcess (from OpenProcess).

I am beginning to wonder if AcroRd32.exe does something especially weird. I'll try something with another type of file...

I appreciate you looking at this. It has me bamboozled!
GeneralRe: Getting an HWND from an HINSTANCE Pin
Chris Richardson2-Oct-02 12:40
Chris Richardson2-Oct-02 12:40 
GeneralRe: Getting an HWND from an HINSTANCE Pin
Harold Bamford2-Oct-02 12:48
Harold Bamford2-Oct-02 12:48 
GeneralRe: Getting an HWND from an HINSTANCE Pin
Chris Richardson2-Oct-02 12:55
Chris Richardson2-Oct-02 12:55 
GeneralRe: Getting an HWND from an HINSTANCE Pin
JT Anderson2-Oct-02 13:07
JT Anderson2-Oct-02 13:07 
GeneralRe: Getting an HWND from an HINSTANCE Pin
Harold Bamford3-Oct-02 7:39
Harold Bamford3-Oct-02 7:39 
GeneralSaving File Formats Pin
SanShou2-Oct-02 6:17
SanShou2-Oct-02 6:17 
GeneralRe: Saving File Formats Pin
JohnnyG2-Oct-02 6:38
JohnnyG2-Oct-02 6:38 
GeneralRe: Saving File Formats Pin
SanShou2-Oct-02 7:10
SanShou2-Oct-02 7:10 
GeneralRe: Saving File Formats Pin
Phil J Pearson2-Oct-02 7:21
Phil J Pearson2-Oct-02 7:21 
GeneralRe: Saving File Formats Pin
Rickard Andersson202-Oct-02 8:28
Rickard Andersson202-Oct-02 8:28 
GeneralRe: Saving File Formats Pin
Scott H. Settlemier2-Oct-02 9:57
Scott H. Settlemier2-Oct-02 9:57 
GeneralRe: Saving File Formats Pin
SanShou2-Oct-02 10:11
SanShou2-Oct-02 10:11 
GeneralRe: Saving File Formats Pin
Patje2-Oct-02 21:27
Patje2-Oct-02 21:27 
GeneralSet index in CListCtrl Pin
Telefonen2-Oct-02 5:54
Telefonen2-Oct-02 5:54 
GeneralRe: Set index in CListCtrl Pin
Chris Richardson2-Oct-02 9:55
Chris Richardson2-Oct-02 9:55 
GeneralChanging dialog properties programatically Pin
adamUK2-Oct-02 5:53
adamUK2-Oct-02 5:53 
QuestionHow do I convert a double to char Pin
Jose Cruz2-Oct-02 5:20
Jose Cruz2-Oct-02 5:20 

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.