Click here to Skip to main content
15,920,576 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralPlease solve my set of problems. Pin
Azghar Hussain21-Sep-04 8:16
professionalAzghar Hussain21-Sep-04 8:16 
GeneralRe: Please solve my set of problems. Pin
David Crow21-Sep-04 8:37
David Crow21-Sep-04 8:37 
GeneralRe: Please solve my set of problems. Pin
Azghar Hussain21-Sep-04 20:20
professionalAzghar Hussain21-Sep-04 20:20 
GeneralRe: Please solve my set of problems. Pin
Antony M Kancidrowski21-Sep-04 23:56
Antony M Kancidrowski21-Sep-04 23:56 
GeneralRe: Please solve my set of problems. Pin
David Crow22-Sep-04 5:05
David Crow22-Sep-04 5:05 
GeneralRe: Please solve my set of problems. Pin
Antony M Kancidrowski21-Sep-04 23:54
Antony M Kancidrowski21-Sep-04 23:54 
GeneralFolder Custom view in WinExplorer using Shell Extensions Pin
aldema21-Sep-04 7:52
aldema21-Sep-04 7:52 
GeneralChild Window in other thread as parent Pin
Kenny Moens21-Sep-04 7:49
Kenny Moens21-Sep-04 7:49 
Hi,

I'm writing a Flight Simulator DLL, the DLL creates a thread that runs a UI that runs as a child of FS.

Now not any problem in FS window mode, but when I switch to full screen mode and click on the UI (which is shown on top of FS in full screen), windows deactivates the flight simulator by minimizing it and also minimizing the UI.

Without a thread it was working, but I wanted a sep thread for the UI since code behind the UI is doing expensive work.

I create the dialog as follows:
// initialise enumerator class
MyEnumWindowsProcCls Cls;
Cls.dwProcessId = GetCurrentProcessId();
Cls.hWnd = 0;
Cls.dwThreadId = 0;
	
// search for FS Window
EnumWindows(EnumWindowsProc,(LPARAM)&Cls);

fsWnd_ = new CWnd();
fsWnd_->Attach(Cls.hWnd);

dlg->Create(IDD_MAIN, fsWnd_);


The EnumWindowsProc catches the FS window:
BOOL CALLBACK EnumWindowsProc(HWND hWnd,LPARAM lParam)
{
	static MyEnumWindowsProcCls* pCls=(MyEnumWindowsProcCls*) lParam;
	DWORD dwProcessId;
	DWORD dwThreadId;
	dwThreadId=GetWindowThreadProcessId(hWnd,&dwProcessId);
	if (dwProcessId==pCls->dwProcessId)
	{
		char clas[512];
		GetClassName(hWnd,clas,sizeof(clas));
		HWND hWndParent=(HWND)GetWindowLong(hWnd,GWL_HWNDPARENT);
		if (hWndParent==NULL)
			if (strcmp(clas,"FS98MAIN")==0)
			{
				pCls->hWnd = hWnd;
				pCls->dwThreadId = dwThreadId;
				return FALSE;
			}
	}
	return TRUE;
}


Anybody an idea of what I'm doing wrong? Is it possible at all to create a child window in another thread?

Thx
Kenny
GeneralRe: Child Window in other thread as parent Pin
David Crow21-Sep-04 8:48
David Crow21-Sep-04 8:48 
GeneralRe: Child Window in other thread as parent Pin
Kenny Moens21-Sep-04 11:51
Kenny Moens21-Sep-04 11:51 
GeneralRe: Child Window in other thread as parent Pin
Antony M Kancidrowski22-Sep-04 0:00
Antony M Kancidrowski22-Sep-04 0:00 
Generalhelp needed in ....Image format conversion in VC++ Pin
Anonymous21-Sep-04 7:26
Anonymous21-Sep-04 7:26 
GeneralPutting shortcut to my app in startup folder Pin
BlackDice21-Sep-04 6:59
BlackDice21-Sep-04 6:59 
GeneralRe: Putting shortcut to my app in startup folder Pin
David Crow21-Sep-04 8:46
David Crow21-Sep-04 8:46 
GeneralWatermarking Visual C++ Code Pin
Garth T21-Sep-04 5:45
Garth T21-Sep-04 5:45 
GeneralRe: Watermarking Visual C++ Code Pin
Alexander M.,21-Sep-04 9:49
Alexander M.,21-Sep-04 9:49 
GeneralRe: Watermarking Visual C++ Code Pin
David Crow21-Sep-04 10:31
David Crow21-Sep-04 10:31 
GeneralRe: Watermarking Visual C++ Code Pin
Maximilien21-Sep-04 10:33
Maximilien21-Sep-04 10:33 
GeneralRe: Watermarking Visual C++ Code Pin
David Crow21-Sep-04 10:43
David Crow21-Sep-04 10:43 
Generalserial communication with WIN XP Pin
MMJJ21-Sep-04 5:42
MMJJ21-Sep-04 5:42 
QuestionHow to get the target file for shortcut? Pin
baskarchinnu21-Sep-04 5:32
baskarchinnu21-Sep-04 5:32 
AnswerRe: How to get the target file for shortcut? Pin
David Crow21-Sep-04 8:49
David Crow21-Sep-04 8:49 
GeneralRe: How to get the target file for shortcut? Pin
baskarchinnu23-Sep-04 0:19
baskarchinnu23-Sep-04 0:19 
GeneralRe: How to get the target file for shortcut? Pin
David Crow23-Sep-04 2:27
David Crow23-Sep-04 2:27 
Generaldisplaying an image Pin
jethind21-Sep-04 5:07
jethind21-Sep-04 5:07 

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.