Click here to Skip to main content
16,006,348 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: VC++ 6.0 IDE problem Pin
JensB2-May-03 3:46
JensB2-May-03 3:46 
GeneralRe: VC++ 6.0 IDE problem Pin
David Crow2-May-03 5:18
David Crow2-May-03 5:18 
GeneralRe: VC++ 6.0 IDE problem Pin
John R. Shaw2-May-03 19:01
John R. Shaw2-May-03 19:01 
GeneralRunning program more than 1 time Pin
JensB1-May-03 23:43
JensB1-May-03 23:43 
GeneralRe: Running program more than 1 time Pin
Rage1-May-03 23:51
professionalRage1-May-03 23:51 
GeneralRe: Running program more than 1 time Pin
JensB2-May-03 0:15
JensB2-May-03 0:15 
GeneralRe: Running program more than 1 time Pin
Rage2-May-03 1:24
professionalRage2-May-03 1:24 
GeneralRe: Running program more than 1 time Pin
JensB2-May-03 1:49
JensB2-May-03 1:49 
ok i will check it out directly @ msdn Smile | :)

I've downloaded the latest CSingleInstance v1.12 and implemented it on a new mdi application and it worked great.
BUT
When i try to implement it to my existing application, it doesn't work
i'll paste the appnameApp::InitInstance here:

CFile f;
SetRegistryKey("Company");
SetDialogBkColor(); // set dialog background color to gray
LoadStdProfileSettings(); // Load standard INI file options (including MRU)

AddDocTemplate(new CSingleDocTemplate(IDR_MAINFRAME,
RUNTIME_CLASS(CMyAppNameDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(CMyAppNameView)));
int iNrOfDialog = 1;
BOOL bGoOn=TRUE;
CDialog *pDialog;
int pushed;


m_bFromMain = false;

while (bGoOn)
{
switch (iNrOfDialog){
case 1:
{
pDialog = new CDlgWelcome2();
pDialog->DoModal();
delete pDialog;
pDialog = new CDlgWelcome();
pDialog->DoModal();
delete pDialog;
pDialog = new CDLogon();
pushed = pDialog->DoModal();
switch (pushed)
{
case (NEXT):
iNrOfDialog++;
break;
case (EXIT):
bGoOn = FALSE;
b_mExit = true;
break
}
delete pDialog;
break;
}
case 2:
{
pDialog = new CDlgList();
pushed = pDialog->DoModal();
....

so this code i don't have:
CMainFrame* pMainFrame = new CMainFrame;
m_pMainWnd = pMainFrame;

if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
return FALSE;


I've pasted the following code:
CInstanceChecker instanceChecker;
if (instanceChecker.PreviousInstanceRunning())
{
AfxMessageBox(_T("Previous version detected, will now restore it"), MB_OK);
instanceChecker.ActivatePreviousInstance();
return FALSE;
}
That i have put totally in the beginning of InitInstance.
And then before i go into the while repeating:
instanceChecker.TrackFirstInstanceRunning();

When i execute the program (use vc5) it gives an error on the line when i call the 'trackfirstinstanceRunning()'.
debug assertion failed:
sinstance.cpp
line: 145

What is on line 145:
ASSERT(AfxGetMainWnd() != NULL); //Did you forget to set up the mainfrm in InitInstance ?

I don't yet have a mainfrm, but a welcome form + logon form.
When can i know when the mainfrm is setup?

Any ideas? Frown | :(
GeneralRe: Running program more than 1 time Pin
JensB2-May-03 2:26
JensB2-May-03 2:26 
GeneralRe: Running program more than 1 time Pin
David Crow2-May-03 4:36
David Crow2-May-03 4:36 
QuestionDialup entries directory? Pin
Jump_Around1-May-03 23:34
Jump_Around1-May-03 23:34 
AnswerRe: Dialup entries directory? Pin
David Crow2-May-03 4:41
David Crow2-May-03 4:41 
GeneralRe: Dialup entries directory? Pin
Jump_Around2-May-03 21:47
Jump_Around2-May-03 21:47 
GeneralRe: Dialup entries directory? Pin
David Crow5-May-03 3:44
David Crow5-May-03 3:44 
GeneralDLL exported function Signature Pin
vikramlinux1-May-03 23:06
vikramlinux1-May-03 23:06 
GeneralRe: DLL exported function Signature Pin
User 66581-May-03 23:21
User 66581-May-03 23:21 
GeneralRe: DLL exported function Signature Pin
vikramlinux1-May-03 23:25
vikramlinux1-May-03 23:25 
GeneralRe: DLL exported function Signature Pin
David Crow2-May-03 4:43
David Crow2-May-03 4:43 
GeneralRe: DLL exported function Signature Pin
pankajdaga1-May-03 23:51
pankajdaga1-May-03 23:51 
GeneralRe: DLL exported function Signature Pin
John R. Shaw2-May-03 19:07
John R. Shaw2-May-03 19:07 
GeneralRe: DLL exported function Signature Pin
David Crow5-May-03 3:46
David Crow5-May-03 3:46 
GeneralRe: DLL exported function Signature Pin
John R. Shaw5-May-03 7:05
John R. Shaw5-May-03 7:05 
GeneralDLL question...driving me crazy though! Pin
pankajdaga1-May-03 22:58
pankajdaga1-May-03 22:58 
GeneralRe: DLL question...driving me crazy though! Pin
John R. Shaw2-May-03 19:26
John R. Shaw2-May-03 19:26 
GeneralRe: DLL question...driving me crazy though! Pin
pankajdaga3-May-03 3:43
pankajdaga3-May-03 3:43 

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.