BOOL CiConApp::InitInstance() { AfxEnableControlContainer(); ::AfxOleInit(); // Standard initialization // If you are not using these features and wish to reduce the size // of your final executable, you should remove from the following // the specific initialization routines you do not need.#ifdef _AFXDLL Enable3dControls(); // Call this when using MFC in a shared DLL #else Enable3dControlsStatic(); // Call this when linking to MFC statically #endif DeleteTempFile(); bool bReceiveOnly=true;//#undef __ONE_INSTANCE__ #define __ONE_INSTANCE__#ifdef __ONE_INSTANCE__ bReceiveOnly=false; //{{add by yry at 2005.4.29可运行多个客户端的在此改动 if (AlreadyRunning("iCon.exe")) { HWND pWnd =FindWindow(NULL,iConWINDOWTEXT); if(pWnd)//有一个正常的实例在运行,则退出 { return FALSE; } else { STARTUPINFO si; PROCESS_INFORMATION pi;
看看这个!
{
AfxEnableControlContainer();
::AfxOleInit();
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif DeleteTempFile(); bool bReceiveOnly=true;//#undef __ONE_INSTANCE__
#define __ONE_INSTANCE__#ifdef __ONE_INSTANCE__
bReceiveOnly=false;
//{{add by yry at 2005.4.29可运行多个客户端的在此改动
if (AlreadyRunning("iCon.exe"))
{
HWND pWnd =FindWindow(NULL,iConWINDOWTEXT);
if(pWnd)//有一个正常的实例在运行,则退出
{
return FALSE;
}
else
{
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory( &pi, sizeof(pi) );
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si); char strAppPath[200]="\\KilliCon.exe";
char strPath[MAX_PATH];
char* p = NULL;
::GetModuleFileName(m_hInstance, strPath, MAX_PATH);
p = strrchr(strPath, '\\');
if (p)
{
*p = 0;
strcat(strPath, strAppPath);
strcpy(strAppPath, strPath); }
// Start the child process
if (CreateProcess(strAppPath, "", NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi))
{
Sleep(5000);
}
}
}
#endif
g_hLanguageInstance = m_hInstance; if (InitNetworkManagerClient(bReceiveOnly) == FALSE)
{
AfxMessageBox(_T("Failed to initialize network!"));
return FALSE;
}
//}}add end InitMulticast(); TCHAR strCommandLine[4096]=_T(""); strcpy(strCommandLine, m_lpCmdLine); OnCommandLine(strCommandLine);
if (g_nRunType == -1)
{
AfxMessageBox("The param is error!");
return FALSE;
} {//蓝牙模块
m_pDlgBlueTooth=new CDlgBlueTooth();
m_pDlgBlueTooth->Create(CDlgBlueTooth::IDD);
m_pDlgBlueTooth->SetWindowPos(NULL,0,0,320,240,SWP_SHOWWINDOW);
} m_piConDlg = new CiConDlg(CWnd::GetDesktopWindow()); m_pMsgNotify = new CMsgNotifyApp();
m_pMsgNotify->CreateThread(); if (m_piConDlg)
{
CAutolockRes lock; m_pMainWnd = m_piConDlg;
m_piConDlg->Create(CiConDlg::IDD, CWnd::GetDesktopWindow()); m_piConWeb = CreateiConWeb(this); m_bRuning = true;
return TRUE;
} /*
CiConDlg dlg;
CAutolockRes lock; m_pMainWnd = &dlg;
m_piConDlg = &dlg;
m_piConWeb = CreateiConWeb(this); dlg.DoModal(); if (m_piConWeb)
{
m_piConWeb->ReleaseConnections();
m_piConWeb = NULL;
} UninitNetworkManagerClient();
::CoUninitialize();
*/
return FALSE;
}---------------------------------------------
BOOL CMsgNotifyApp::InitInstance()
{
m_pMainWnd = &m_dlgMsgNotify; CAutolockRes lock; m_dlgMsgNotify.Create(CMsgNotifyDlg::IDD, CWnd::GetDesktopWindow()); return TRUE;
}int CMsgNotifyApp::ExitInstance()
{
/*if (m_pDlgMsgNotify)
{
m_pDlgMsgNotify->DestroyWindow();
m_pDlgMsgNotify = NULL;
}*/ return CWinThread::ExitInstance();
}BEGIN_MESSAGE_MAP(CMsgNotifyApp, CWinThread)
END_MESSAGE_MAP()
// CMsgNotifyApp 消息处理程序
-----------------------------------------------------------------
大家好,改登录界面是在上面那个地方改,我想把原来登录界面完全改成别外一个登录界面,不知道是不是在上面改,请各位指教
--------------------------------------------------------------
BOOL CiConApp::InitInstance()
{
AfxEnableControlContainer();
::AfxOleInit();
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need. #ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif DeleteTempFile(); bool bReceiveOnly=true; //#undef __ONE_INSTANCE__
#define __ONE_INSTANCE__ #ifdef __ONE_INSTANCE__
bReceiveOnly=false;
//{{add by yry at 2005.4.29可运行多个客户端的在此改动
if (AlreadyRunning("iCon.exe"))
{
HWND pWnd =FindWindow(NULL,iConWINDOWTEXT);
if(pWnd)//有一个正常的实例在运行,则退出
{
return FALSE;
}
else
{
STARTUPINFO si;
PROCESS_INFORMATION pi; ZeroMemory( &pi, sizeof(pi) );
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si); char strAppPath[200]="\\KilliCon.exe";
char strPath[MAX_PATH];
char* p = NULL;
::GetModuleFileName(m_hInstance, strPath, MAX_PATH); p = strrchr(strPath, '\\');
if (p)
{
*p = 0;
strcat(strPath, strAppPath);
strcpy(strAppPath, strPath); }
// Start the child process
if (CreateProcess(strAppPath, "", NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi))
{
Sleep(5000);
}
}
}
#endif
g_hLanguageInstance = m_hInstance; if (InitNetworkManagerClient(bReceiveOnly) == FALSE)
{
AfxMessageBox(_T("Failed to initialize network!"));
return FALSE;
}
//}}add end InitMulticast(); TCHAR strCommandLine[4096]=_T(""); strcpy(strCommandLine, m_lpCmdLine); OnCommandLine(strCommandLine);
if (g_nRunType == -1)
{
AfxMessageBox("The param is error!");
return FALSE;
} {//蓝牙模块
m_pDlgBlueTooth=new CDlgBlueTooth();
m_pDlgBlueTooth->Create(CDlgBlueTooth::IDD);
m_pDlgBlueTooth->SetWindowPos(NULL,0,0,320,240,SWP_SHOWWINDOW);
} m_piConDlg = new CiConDlg(CWnd::GetDesktopWindow()); m_pMsgNotify = new CMsgNotifyApp();
m_pMsgNotify->CreateThread(); if (m_piConDlg)
{
CAutolockRes lock; m_pMainWnd = m_piConDlg;
m_piConDlg->Create(CiConDlg::IDD, CWnd::GetDesktopWindow()); m_piConWeb = CreateiConWeb(this); m_bRuning = true;
return TRUE;
} /*
CiConDlg dlg;
CAutolockRes lock; m_pMainWnd = &dlg;
m_piConDlg = &dlg;
m_piConWeb = CreateiConWeb(this); dlg.DoModal(); if (m_piConWeb)
{
m_piConWeb->ReleaseConnections();
m_piConWeb = NULL;
} UninitNetworkManagerClient();
::CoUninitialize();
*/
return FALSE;
} ---------------------------------------------
BOOL CMsgNotifyApp::InitInstance()
{
m_pMainWnd = &m_dlgMsgNotify; CAutolockRes lock; m_dlgMsgNotify.Create(CMsgNotifyDlg::IDD, CWnd::GetDesktopWindow()); return TRUE;
} int CMsgNotifyApp::ExitInstance()
{
/*if (m_pDlgMsgNotify)
{
m_pDlgMsgNotify->DestroyWindow();
m_pDlgMsgNotify = NULL;
}*/ return CWinThread::ExitInstance();
} BEGIN_MESSAGE_MAP(CMsgNotifyApp, CWinThread)
END_MESSAGE_MAP()
// CMsgNotifyApp 消息处理程序