Click here to Skip to main content
15,910,358 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionAsyncronus class and your method Pin
Ruscoff15-Dec-09 11:26
Ruscoff15-Dec-09 11:26 
AnswerRe: Asyncronus class and your method Pin
Moak15-Dec-09 12:59
Moak15-Dec-09 12:59 
GeneralRe: Asyncronus class and your method Pin
Ruscoff16-Dec-09 2:59
Ruscoff16-Dec-09 2:59 
QuestionMFC ListControl flicker in win7 Pin
yctsai15-Dec-09 8:08
yctsai15-Dec-09 8:08 
QuestionCIPAddressCtrl cannot create vc+= mfc Pin
saarfu15-Dec-09 5:08
saarfu15-Dec-09 5:08 
AnswerRe: CIPAddressCtrl cannot create vc+= mfc Pin
Abhi Lahare15-Dec-09 13:04
Abhi Lahare15-Dec-09 13:04 
QuestionVS2008 CMFCToolbar and inserting a combo box Pin
Jerry Evans15-Dec-09 4:29
Jerry Evans15-Dec-09 4:29 
QuestionUsing function from other class Pin
blackbolek15-Dec-09 2:41
blackbolek15-Dec-09 2:41 
Hi,

I've got an application with 3 dialogs: Monitor, UnitView, GroupStart. Each dialog has it's class named accordingly. Monitor is a main dialog which opens at the start of application. By clicking button on Monitor dialog you can open UnitView dialog. It is done like that:
<br />
        unitviewdialog[selection] = new CUnitView();<br />
	unitviewdialog[selection]->SetParent(this);<br />
<br />
	unis[selection] = new CDlgModalToModeless();<br />
	unis[selection]->DoDialog(unitviewdialog[selection]);<br />


Then on UnitView dialog you can click on next button to open GroupStart dialog:
<br />
                CGroupStart* dlg = new CGroupStart(this);<br />
		<br />
		dlg->DoModal();<br />
		delete dlg;<br />


There is a function SendMsg() which is public member of CMonitorDlg class, and which I need to use. I mean I have to call it from function which is public member of CGroupStart class.
Here is first few lines of this function:
<br />
BOOL CMonitorDlg::SendMsg(int destination, char *typec, char *content)<br />
{<br />
<br />
	int sum = 0;		<br />
<br />
  	coutbuff[0] = STX;  <br />
	coutbuff[1] = '0';<br />
	coutbuff[2] = '0';<br />


coutbuff is declared as char[410] and is public member of CMonitorDlg class.

Now - I'm calling this function from CGroupStart like that:
<br />
void CGroupStart::OnGstart() <br />
{<br />
char grpcmd[5];<br />
<br />
	if (groupid<0 || groupid>20)<br />
		return;<br />
<br />
	sprintf (grpcmd,"%d;1",groupid);<br />
	<br />
	((CMonitorDlg*)m_pWnd)->SendMsg(unit, "MO", grpcmd);<br />
<br />


The application crashes at this moment with Access Violation error.
I tried to run it under debugger, step by step and it took me to second line of SendMsg() function where it tries to assign STX to coutbuff[0]. So it looks like it cannot access coutbuff.
What am I doing wrong?
I'm using VC++ 6.0.
QuestionRe: Using function from other class Pin
David Crow15-Dec-09 2:53
David Crow15-Dec-09 2:53 
AnswerRe: Using function from other class [modified] Pin
blackbolek15-Dec-09 4:16
blackbolek15-Dec-09 4:16 
GeneralRe: Using function from other class Pin
Cedric Moonen15-Dec-09 4:26
Cedric Moonen15-Dec-09 4:26 
GeneralRe: Using function from other class Pin
blackbolek15-Dec-09 4:50
blackbolek15-Dec-09 4:50 
AnswerRe: Using function from other class Pin
Cedric Moonen15-Dec-09 3:21
Cedric Moonen15-Dec-09 3:21 
QuestionSorting In A Virtual ListControl Pin
jannathali15-Dec-09 1:13
jannathali15-Dec-09 1:13 
AnswerRe: Sorting In A Virtual ListControl Pin
Code-o-mat15-Dec-09 2:21
Code-o-mat15-Dec-09 2:21 
QuestionAccelerators in VC++ Pin
VCsamir14-Dec-09 23:21
VCsamir14-Dec-09 23:21 
AnswerRe: Accelerators in VC++ Pin
Moak15-Dec-09 0:37
Moak15-Dec-09 0:37 
AnswerRe: Accelerators in VC++ Pin
KarstenK15-Dec-09 2:08
mveKarstenK15-Dec-09 2:08 
AnswerRe: Accelerators in VC++ Pin
Code-o-mat15-Dec-09 2:08
Code-o-mat15-Dec-09 2:08 
QuestionActiveX controls child window of another ActiveX control Pin
Miriama2514-Dec-09 22:41
Miriama2514-Dec-09 22:41 
AnswerRe: ActiveX controls child window of another ActiveX control Pin
KarstenK14-Dec-09 23:09
mveKarstenK14-Dec-09 23:09 
GeneralRe: ActiveX controls child window of another ActiveX control Pin
Miriama2514-Dec-09 23:16
Miriama2514-Dec-09 23:16 
GeneralRe: ActiveX controls child window of another ActiveX control Pin
KarstenK14-Dec-09 23:41
mveKarstenK14-Dec-09 23:41 
GeneralRe: ActiveX controls child window of another ActiveX control [modified] Pin
Miriama2515-Dec-09 1:35
Miriama2515-Dec-09 1:35 
GeneralRe: ActiveX controls child window of another ActiveX control Pin
KarstenK15-Dec-09 1:57
mveKarstenK15-Dec-09 1:57 

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.