本文整理汇总了C++中CAppModule类的典型用法代码示例。如果您正苦于以下问题:C++ CAppModule类的具体用法?C++ CAppModule怎么用?C++ CAppModule使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CAppModule类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _tWinMain
int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR lpstrCmdLine, int nCmdShow)
{
HRESULT hRes = ::CoInitialize(NULL);
// If you are running on NT 4.0 or higher you can use the following call instead to
// make the EXE free threaded. This means that calls come in on a random RPC thread.
// HRESULT hRes = ::CoInitializeEx(NULL, COINIT_MULTITHREADED);
ATLASSERT(SUCCEEDED(hRes));
// this resolves ATL window thunking problem when Microsoft Layer for Unicode (MSLU) is used
::DefWindowProc(NULL, 0, 0, 0L);
AtlInitCommonControls(ICC_BAR_CLASSES); // add flags to support other controls
hRes = _Module.Init(NULL, hInstance);
ATLASSERT(SUCCEEDED(hRes));
int nRet = Run(lpstrCmdLine, nCmdShow);
_Module.Term();
::CoUninitialize();
return nRet;
}
示例2: RunThread
// thread proc
static DWORD WINAPI RunThread(LPVOID lpData)
{
CMessageLoop theLoop;
_Module.AddMessageLoop(&theLoop);
_RunData* pData = (_RunData*)lpData;
CMainFrame wndFrame;
if(wndFrame.CreateEx() == NULL)
{
ATLTRACE(_T("Frame window creation failed!\n"));
return 0;
}
wndFrame.ShowWindow(pData->nCmdShow);
::SetForegroundWindow(wndFrame); // Win95 needs this
delete pData;
int nRet = theLoop.Run();
_Module.RemoveMessageLoop();
return nRet;
}
示例3: _tWinMain
int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR lpstrCmdLine, int nCmdShow) {
HRESULT hRes = ::CoInitialize(NULL);
ATLASSERT(SUCCEEDED(hRes));
// this object must in main/ WinMain
crash_report::CrAutoInstallHelper helper;
if (!InstallCrashReport(helper)) {
return -1;
}
/* Create another thread */
g_CrashThreadInfo.m_bStop = false;
g_CrashThreadInfo.m_hWakeUpEvent = CreateEvent(NULL, FALSE, FALSE, _T("WakeUpEvent"));
ATLASSERT(g_CrashThreadInfo.m_hWakeUpEvent!=NULL);
DWORD dwThreadId = 0;
g_hWorkingThread = CreateThread(NULL, 0, CrashThread, (LPVOID)&g_CrashThreadInfo, 0, &dwThreadId);
ATLASSERT(g_hWorkingThread!=NULL);
// this resolves ATL window thunking problem when Microsoft Layer for Unicode (MSLU) is used
::DefWindowProc(NULL, 0, 0, 0L);
AtlInitCommonControls(ICC_BAR_CLASSES); // add flags to support other controls
hRes = _Module.Init(NULL, hInstance);
ATLASSERT(SUCCEEDED(hRes));
int nRet = Run(lpstrCmdLine, nCmdShow);
_Module.Term();
// Close another thread
g_CrashThreadInfo.m_bStop = true;
SetEvent(g_CrashThreadInfo.m_hWakeUpEvent);
// Wait until thread terminates
WaitForSingleObject(g_hWorkingThread, INFINITE);
::CoUninitialize();
return nRet;
}
示例4: _tWinMain
int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR lpstrCmdLine, int nCmdShow)
{
#ifdef _DEBUG // ATLTRACEで日本語を使うために必要
_tsetlocale(LC_ALL, _T("japanese"));
#endif
HRESULT hRes = ::CoInitialize(NULL);
// If you are running on NT 4.0 or higher you can use the following call instead to
// make the EXE free threaded. This means that calls come in on a random RPC thread.
// HRESULT hRes = ::CoInitializeEx(NULL, COINIT_MULTITHREADED);
ATLASSERT(SUCCEEDED(hRes));
// this resolves ATL window thunking problem when Microsoft Layer for Unicode (MSLU) is used
::DefWindowProc(NULL, 0, 0, 0L);
AtlInitCommonControls(ICC_BAR_CLASSES); // add flags to support other controls
hRes = _Module.Init(NULL, hInstance);
ATLASSERT(SUCCEEDED(hRes));
FILE* fp_out = freopen("result.txt", "w", stdout);
g_atomicMegaThreadActive.store(true);
std::thread threadMegaLoop(CMegaAppImpl::StartMegaLoop);
int nRet = Run(lpstrCmdLine, nCmdShow);
g_atomicMegaThreadActive.store(false);
threadMegaLoop.join();
fclose(fp_out);
_Module.Term();
::CoUninitialize();
return nRet;
}
示例5: _tWinMain
int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR /*lpstrCmdLine*/, int /*nCmdShow*/)
{
HRESULT hRes = ::OleInitialize(NULL);
ATLASSERT(SUCCEEDED(hRes));
// this resolves ATL window thunking problem when Microsoft Layer for Unicode (MSLU) is used
::DefWindowProc(NULL, 0, 0, 0L);
AtlInitCommonControls(
ICC_WIN95_CLASSES |
ICC_DATE_CLASSES |
ICC_USEREX_CLASSES |
ICC_COOL_CLASSES |
ICC_PAGESCROLLER_CLASS |
ICC_NATIVEFNTCTL_CLASS);
// We use a RichEdit control
HINSTANCE hInstRich = ::LoadLibrary(CRichEditCtrl::GetLibraryName());
ATLASSERT(hInstRich != NULL);
hRes = _Module.Init(NULL, hInstance);
ATLASSERT(SUCCEEDED(hRes));
int nRet = 0;
// BLOCK: Run application
{
CTestWizard wizard;
wizard.ExecuteWizard();
}
::FreeLibrary(hInstRich);
_Module.Term();
::OleUninitialize();
return nRet;
}
示例6: _tWinMain
int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR /*lpstrCmdLine*/, int /*nCmdShow*/)
{
HRESULT hRes = ::CoInitialize(NULL);
// If you are running on NT 4.0 or higher you can use the following call instead to
// make the EXE free threaded. This means that calls come in on a random RPC thread.
// HRESULT hRes = ::CoInitializeEx(NULL, COINIT_MULTITHREADED);
ATLASSERT(SUCCEEDED(hRes));
::PRDataSource *pprdsNew = new ::PRSpoolerDataFile();
tstring file = _T("D:\\SUNNET\\SkyBoard\\Component\\PosterPrinter\\PrintResizer\\prpreview\\objfre_w2k_x86\\i386\\483.tmp");
if (pprdsNew->Open( file )) {
//this->OnNewDataSource(pprdsNew);
} else {
MessageBox(0, L"Fail", 0, 0);
}
// this resolves ATL window thunking problem when Microsoft Layer for Unicode (MSLU) is used
::DefWindowProc(NULL, 0, 0, 0L);
AtlInitCommonControls(ICC_BAR_CLASSES); // add flags to support other controls
hRes = _Module.Init(NULL, hInstance);
ATLASSERT(SUCCEEDED(hRes));
int nRet = 0;
// BLOCK: Run application
{
CMainDlg dlgMain;
nRet = dlgMain.DoModal();
}
_Module.Term();
::CoUninitialize();
return nRet;
}
示例7: Run
int Run(LPTSTR /*lpstrCmdLine*/ = NULL, int nCmdShow = SW_SHOWDEFAULT)
{
CMessageLoop theLoop;
_Module.AddMessageLoop(&theLoop);
//
AsyncInet::Init();
//
WindowRunner wr;
HWND h = wr.Create(NULL);
ATLASSERT(h);
//
SiteCrank crank;
crank.Init();
crank.Run(&wr);
//
VerifyImgDlg wndMain;
if(wndMain.Create(0) == NULL)
{
ATLTRACE(_T("Main window creation failed!\n"));
return 0;
}
wndMain.ShowWindow(nCmdShow);
int nRet = theLoop.Run();
wr.DestroyWindow();
_Module.RemoveMessageLoop();
return nRet;
}
示例8: _tWinMain
int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR lpstrCmdLine, int nCmdShow)
{
HRESULT hRes = ::CoInitialize(NULL);
// If you are running on NT 4.0 or higher you can use the following call instead to
// make the EXE free threaded. This means that calls come in on a random RPC thread.
// HRESULT hRes = ::CoInitializeEx(NULL, COINIT_MULTITHREADED);
ATLASSERT(SUCCEEDED(hRes));
// this resolves ATL window thunking problem when Microsoft Layer for Unicode (MSLU) is used
::DefWindowProc(NULL, 0, 0, 0L);
HMODULE hInstRichEdit = ::LoadLibrary(_T("Msftedit.dll"));
AtlInitCommonControls(ICC_BAR_CLASSES); // add flags to support other controls
GdiplusStartupInput m_gdiplusStartupInput;
ULONG_PTR m_gdiplusToken;
Status sta = GdiplusStartup(&m_gdiplusToken, &m_gdiplusStartupInput, NULL); //GDI+³õʼ»¯
hRes = _Module.Init(NULL, hInstance);
ATLASSERT(SUCCEEDED(hRes));
int nRet = Run(lpstrCmdLine, nCmdShow);
GdiplusShutdown(m_gdiplusToken);
if( hInstRichEdit != NULL )
{
FreeLibrary( hInstRichEdit );
}
_Module.Term();
::CoUninitialize();
return nRet;
}
示例9: Run
int Run(LPTSTR /*lpstrCmdLine*/ = NULL, int nCmdShow = SW_SHOWDEFAULT) {
FLAGS_logtostderr = false;
FLAGS_alsologtostderr = true;
google::InitGoogleLogging("ImageEditor.exe");
LoadLibrary(WinUtils::GetAppFolder() + L"gdiplus.dll");
CMessageLoop theLoop;
_Module.AddMessageLoop( &theLoop );
ImageEditor::ImageEditorWindow wndMain("screenshot.png");
wndMain.setInitialDrawingTool(ImageEditor::Canvas::dtCrop);
//wndMain.ShowWindow( nCmdShow );
ImageEditorWindow::DialogResult dr = wndMain.DoModal(0, ImageEditorWindow::wdmWindowed);
//LOG(INFO) << "DoModal returned "<<dr;
//int nRet = theLoop.Run();
_Module.RemoveMessageLoop();
//wndMain.DestroyWindow();
return 0;
}
示例10: LoadLuaRunTime
extern "C" __declspec(dllexport) void LoadLuaRunTime(char* szInstallDir,char* szParam)
{
TSTRACEAUTO();
HRESULT hr = ::CoInitialize(NULL);
hr = _Module.Init(NULL, gInstance);
CMessageLoop theLoop;
_Module.AddMessageLoop(&theLoop);
CLRTAgent lrtAgent;
if (lrtAgent.InitLua(szInstallDir,szParam))
{
TSDEBUG4CXX(_T(">>>>>theLoop.Run()"));
theLoop.Run();
TSDEBUG4CXX(_T("<<<<<theLoop.Run()"));
}
_Module.RemoveMessageLoop();
_Module.Term();
::CoUninitialize();
TerminateProcess(::GetCurrentProcess(), S_OK);
return;
}
示例11: server_main
int server_main()
{
HRESULT hRes = _Module.Init(NULL, GetModuleHandle(NULL));
ATLASSERT(SUCCEEDED(hRes));
weasel::Server server;
boost::scoped_ptr<weasel::RequestHandler> handler(new TestRequestHandler);
server.SetRequestHandler(handler.get());
if (!server.Start())
return -4;
cerr << "server running." << endl;
int ret = server.Run();
cerr << "server quitting." << endl;
return ret;
}
示例12: Run
int Run(LPTSTR /*lpstrCmdLine*/ = NULL, int nCmdShow = SW_SHOWDEFAULT)
{
CMessageLoop theLoop;
_Module.AddMessageLoop(&theLoop);
CMainFrame wndMain;
if(wndMain.CreateEx() == NULL)
{
ATLTRACE(_T("Main window creation failed!\n"));
return 0;
}
wndMain.ShowWindow(nCmdShow);
int nRet = theLoop.Run();
_Module.RemoveMessageLoop();
return nRet;
}
示例13: DllMain
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
{
if (dwReason == DLL_PROCESS_ATTACH) {
_Module.Init(ObjectMap, hInstance);
DisableThreadLibraryCalls(hInstance);
CRegKey regCfg;
DWORD dwSize = _MAX_PATH;
if (ERROR_SUCCESS != regCfg.Open(HKEY_CURRENT_USER, _T("Software"), KEY_READ) ||
ERROR_SUCCESS != regCfg.Open(regCfg, REG_COMPANY_KEY, KEY_READ) ||
ERROR_SUCCESS != regCfg.Open(regCfg, REG_PRODUCT_KEY, KEY_READ) ||
ERROR_SUCCESS != regCfg.Open(regCfg, _T("Config"), KEY_READ) ||
ERROR_SUCCESS != regCfg.QueryValue(g_cbTRiAS, _T("TRiASName"), &dwSize) ||
0 == dwSize)
{
strcpy (g_cbTRiAS, g_cbTRiASDefaultName); // default
}
}
else if (dwReason == DLL_PROCESS_DETACH) {
_Module.Term();
}
return TRUE; // ok
}
示例14: InitializeGui
int InitializeGui(HINSTANCE hInstance, LPARAM param)
{
CoInitialize(NULL);
AtlInitCommonControls(ICC_LISTVIEW_CLASSES | ICC_TREEVIEW_CLASSES);
Scylla::initAsGuiApp();
IsDllMode = false;
HRESULT hRes = _Module.Init(NULL, hInstance);
ATLASSERT(SUCCEEDED(hRes));
int nRet = 0;
// BLOCK: Run application
{
MainGui dlgMain;
pMainGui = &dlgMain; // o_O
CMessageLoop loop;
_Module.AddMessageLoop(&loop);
dlgMain.Create(GetDesktopWindow(), param);
dlgMain.ShowWindow(SW_SHOW);
loop.Run();
}
_Module.Term();
CoUninitialize();
return nRet;
}
示例15: IsDebuggerPresent
int
WINAPI
_tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR lpstrCmdLine, int nCmdShow)
{
//NdasUiDbgCall( 1, "in, IsDebuggerPresent() = %d\n", IDebugClient2::IsKernelDebuggerEnabled() );
NdasUiDbgCall( 1, "in, IsDebuggerPresent() = %d\n", IsDebuggerPresent() );
OutputDebugString( _T("IsDebuggerPresent()\n") );
// If you are running on NT 4.0 or higher you can use the following call instead to
// make the EXE free threaded. This means that calls come in on a random RPC thread.
// HRESULT hRes = ::CoInitializeEx(NULL, COINIT_MULTITHREADED);
HRESULT hRes = ::CoInitialize(NULL);
ATLASSERT(SUCCEEDED(hRes));
// this resolves ATL window thunking problem when Microsoft Layer for Unicode (MSLU) is used
::DefWindowProc( NULL, 0, 0, 0L );
::AtlInitCommonControls( ICC_COOL_CLASSES | ICC_BAR_CLASSES );
// add flags to support other controls
hRes = _Module.Init(NULL, hInstance);
ATLASSERT(SUCCEEDED(hRes));
int ret = Run( lpstrCmdLine, nCmdShow );
_Module.Term();
::CoUninitialize();
NdasUiDbgCall( 1, "*********out**********\n" );
return ret;
}