|
-
May 6th, 2009, 06:44 AM
#1
[MFC Newbie] workflow for calling function from InitInstance
Hi everybody.
As some of you might have read in my previous thread (http://www.codeguru.com/forum/showthread.php?t=476458) I'm trying to add a commandline interface to an existing MFC application.
I'm new to MFC, but do have some C++ experience.
Even though I'm new to MFC, I've found out that it's a SDI app, and I've read about the relationship between the CMainFram, CView and CDocument classes.
Here is what I want to do: Once I locate a switch (or option) in my commandline, I want to execute a function from my InitInstance() - code exampel below:
Code:
BOOL CMyMlvApp::InitInstance()
{
....
CommandLineParser cmdInfo;
ParseCommandLine(cmdInfo);
if(cmdInfo.IsLoad())
{
//Here I want to call the load-function
AfxMessageBox("Hello World from Load");
}
if(cmdInfo.IsVerify())
{
//Here I want to call the verify-function
AfxMessageBox("Hello World from Verify");
}
if(cmdInfo.IsReset())
{
//Here I want to call the reset-function
AfxMessageBox("Hello World from Reset");
}
// Dispatch commands specified on the command line
if (!ProcessShellCommand(cmdInfo))
return FALSE;
....
}
I've located the functions I want to call in the CDocument class
Code:
void CMyMlvDoc::OnFunctionVerify()
{
CRtMem RtMem(&m_MlvConfig,m_ProcessorId);
if (RtMem.m_Status==RT_OK)
{
CVerifyDlg dlg(&RtMem,&m_hexlineList);
dlg.m_VerifyDescription=GetTitle();
dlg.DoModal();
}
else
AfxMessageBox("Verify failed");
}
I have tried creating an object of CMyMlvDoc, and calling the "OnFunctionVerify()", but it's protected. And I've tried copying the content of the function directly into the InitInstance - no succes.
So what I want to know is: how is the workflow for calling this function in my InitInstance-function?
If you need any more information, let me know
//Kasper D.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|