Click here to Skip to main content
15,918,125 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: execute an app from code Pin
Snyp12-Apr-04 11:26
Snyp12-Apr-04 11:26 
GeneralRe: execute an app from code Pin
Tim Smith12-Apr-04 18:21
Tim Smith12-Apr-04 18:21 
QuestionASSERT_VALID ? Pin
Jnewg512-Apr-04 7:13
Jnewg512-Apr-04 7:13 
AnswerRe: ASSERT_VALID ? Pin
Anthony_Yio13-Apr-04 0:21
Anthony_Yio13-Apr-04 0:21 
GeneralCWinThread "issues" Pin
T1TAN12-Apr-04 6:59
T1TAN12-Apr-04 6:59 
GeneralRe: CWinThread "issues" Pin
John M. Drescher12-Apr-04 8:18
John M. Drescher12-Apr-04 8:18 
GeneralRe: CWinThread "issues" Pin
T1TAN12-Apr-04 8:53
T1TAN12-Apr-04 8:53 
GeneralRe: CWinThread "issues" Pin
John M. Drescher12-Apr-04 8:58
John M. Drescher12-Apr-04 8:58 
T1TAN wrote:
i (obviously) forgot to mention that the app i'm doing is dialog based.

Oh. I saw that, I'm sorry about the long rant about doc/view but you still have to be careful of GUI calls with dialog based apps.

Did you check the source for wincore.cpp, at Line 304? What version of VC are you using? I looked at my version of vc6 and it is not a valid instruction but it is exactly where I thought the problem to be. I mean it is between the CWnd::FromHandle(HWND hWnd) or CWnd::FromHandlePermanent(HWND hWnd). Niether of these functions will work accross threads.

[EDIT]
Ok line 304 in wincore.cpp is in VC7. Here:
CWnd* PASCAL CWnd::FromHandle(HWND hWnd)
{
	CHandleMap* pMap = afxMapHWND(TRUE); //create map if not exist
	ASSERT(pMap != NULL);


The assert fails because the handle map is null when you are calling this member from a thread that did not create the window. This is fixed by putting the dialog in the main application thread.
[/EDIT]

John
GeneralRe: CWinThread "issues" Pin
T1TAN12-Apr-04 9:17
T1TAN12-Apr-04 9:17 
GeneralRe: CWinThread "issues" Pin
John M. Drescher12-Apr-04 9:33
John M. Drescher12-Apr-04 9:33 
GeneralRe: CWinThread "issues" Pin
T1TAN12-Apr-04 9:41
T1TAN12-Apr-04 9:41 
GeneralRe: CWinThread "issues" Pin
John M. Drescher12-Apr-04 10:36
John M. Drescher12-Apr-04 10:36 
GeneralRe: CWinThread "issues" Pin
dreamerzz18-Apr-04 0:07
dreamerzz18-Apr-04 0:07 
GeneralRe: CWinThread "issues" Pin
John M. Drescher18-Apr-04 18:13
John M. Drescher18-Apr-04 18:13 
GeneralRe: CWinThread "issues" Pin
dreamerzz20-Apr-04 2:15
dreamerzz20-Apr-04 2:15 
GeneralRe: CWinThread "issues" Pin
John M. Drescher20-Apr-04 4:28
John M. Drescher20-Apr-04 4:28 
GeneralCreating string from BSTR Pin
yanuart12-Apr-04 6:25
yanuart12-Apr-04 6:25 
GeneralRe: Creating string from BSTR Pin
Darshan Jani12-Apr-04 7:02
Darshan Jani12-Apr-04 7:02 
GeneralRe: Creating string from BSTR Pin
GuimaSun12-Apr-04 7:07
GuimaSun12-Apr-04 7:07 
GeneralKeep the Client DC state in a Bitmap Pin
stelitsisan12-Apr-04 5:40
stelitsisan12-Apr-04 5:40 
GeneralCustomized CFileDialog Pin
benny232312-Apr-04 5:28
benny232312-Apr-04 5:28 
GeneralRe: Customized CFileDialog Pin
David Crow12-Apr-04 7:40
David Crow12-Apr-04 7:40 
GeneralRe: Customized CFileDialog Pin
benny232312-Apr-04 8:36
benny232312-Apr-04 8:36 
GeneralRe: Customized CFileDialog Pin
David Crow12-Apr-04 9:22
David Crow12-Apr-04 9:22 
GeneralMy Service gets stopped when checked for dependensies Pin
Anonymous12-Apr-04 5:01
Anonymous12-Apr-04 5:01 

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.