Esempio n. 1
0
int WINAPI _tWinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPTSTR lpstrCmdLine, int nCmdShow)
{
	HRESULT hRes = CMiniPieFrame::ActivatePreviousInstance(hInstance, lpstrCmdLine);

	if(FAILED(hRes) || S_FALSE == hRes)
	{
		return hRes;
	}

	hRes = ::CoInitializeEx(NULL, COINIT_MULTITHREADED);
	ATLASSERT(SUCCEEDED(hRes));

	AtlInitCommonControls(ICC_DATE_CLASSES);
	SHInitExtraControls();

	hRes = _Module.Init(NULL, hInstance);
	ATLASSERT(SUCCEEDED(hRes));

	AtlAxWinInit();

	int nRet = CMiniPieFrame::AppRun(lpstrCmdLine, nCmdShow);

	AtlAxWinTerm();

	_Module.Term();
	::CoUninitialize();

	return nRet;
}
Esempio n. 2
0
HRESULT CMainModule::PostMessageLoop()
{
	if( m_dwRegister ) {
		CoRevokeClassObject( m_dwRegister );
		m_dwRegister = 0;
	}

	AtlAxWinTerm();
	return CAtlExeModuleT<CMainModule>::PostMessageLoop();
}
Esempio n. 3
0
HRESULT CBrowserModule::PostMessageLoop() throw()
{
    if (m_pWnd)
    {
        delete m_pWnd;
        m_pWnd = NULL;
    }

    webserver_destroy();
    AtlAxWinTerm();

    return __super::PostMessageLoop();
}
Esempio n. 4
0
LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	static CComQIPtr<IWebBrowser2>pWebBrowser2;
	static HWND	hBrowser;
	switch (msg)
	{
	case WM_CREATE:
		::CoInitialize(0);
		g_Module.Init(0, ((LPCREATESTRUCT)lParam)->hInstance);
		AtlAxWinInit();
		hBrowser = CreateWindow(TEXT("AtlAxWin140"), TEXT("Shell.Explorer.2"), WS_CHILD | WS_VISIBLE | WS_TABSTOP, 0, 0, 0, 0, hWnd, 0, ((LPCREATESTRUCT)lParam)->hInstance, 0);
		if (hBrowser)
		{
			CComPtr<IUnknown>punkIE;
			if (AtlAxGetControl(hBrowser, &punkIE) == S_OK)
			{
				pWebBrowser2 = punkIE;
				if (pWebBrowser2)
				{
					if (SUCCEEDED(pWebBrowser2->QueryInterface(IID_IOleInPlaceActiveObject, (void**)&pOleInPlaceActiveObject)))
					{
						TCHAR szModulePath[MAX_PATH];
						GetModuleFileName(0, szModulePath, MAX_PATH);
						TCHAR szNavigateToResource[1024];
						wsprintf(szNavigateToResource, L"res://%s/%d", szModulePath, IDR_HTML1);
						pWebBrowser2->Navigate(szNavigateToResource, 0, 0, 0, 0);
						return 0;
					}
				}
			}
		}
		return -1;
	case WM_SETFOCUS:
		SetFocus(hBrowser);
		break;
	case WM_SIZE:
		MoveWindow(hBrowser, 0, 0, LOWORD(lParam), HIWORD(lParam), 0);
		break;
	case WM_DESTROY:
		pWebBrowser2.Release();
		AtlAxWinTerm();
		g_Module.Term();
		::CoUninitialize();
		PostQuitMessage(0);
		break;
	default:
		return DefWindowProc(hWnd, msg, wParam, lParam);
	}
	return 0;
}
Esempio n. 5
0
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPreInst, LPSTR pCmdLine, int nCmdShow)
{
	AtlAxWinInit();
	_Module.Init(ObjectMap, hInstance);
	MSG msg;
	WNDCLASS wndclass = {
		0,
		WndProc,
		0,
		0,
		hInstance,
		0,
		LoadCursor(0, IDC_ARROW),
		0,
		0,
		szClassName
	};
	RegisterClass(&wndclass);
	HWND hWnd = CreateWindow(
		szClassName,
		TEXT("SVG画像表示"),
		WS_OVERLAPPEDWINDOW,
		CW_USEDEFAULT,
		0,
		CW_USEDEFAULT,
		0,
		0,
		0,
		hInstance,
		0
	);
	ShowWindow(hWnd, SW_SHOWDEFAULT);
	UpdateWindow(hWnd);
	while (GetMessage(&msg, 0, 0, 0))
	{
		TranslateMessage(&msg);
		DispatchMessage(&msg);
	}
	_Module.Term();
	AtlAxWinTerm();
	return (int)msg.wParam;
}
Esempio n. 6
0
/*
 * Shutdown the plugin. Called when no more instanced of this plugin exist and
 * the browser wants to unload it.
 */
NPError OSCALL NP_Shutdown(void)
{
	AtlAxWinTerm();

	return NPERR_NO_ERROR;
}