Exemplo n.º 1
0
HRESULT CMainModule::PreMessageLoop( int nCmdShow )
{
	HRESULT hr = S_OK;

	if( SUCCEEDED(hr) ) {
	    hr = CAtlExeModuleT<CMainModule>::PreMessageLoop( nCmdShow );
	}

	if( SUCCEEDED(hr) ) {
		hr = setIeEmulation();
	}

	if( SUCCEEDED(hr) ) {
		hr = regClass();
	}

	if( SUCCEEDED(hr) )
	{
		AtlAxWinInit();
		RECT rect = { 200, 200, 920, 831 };
		m_wndMain.Create(NULL, rect, L"Trident Host", WS_OVERLAPPED | WS_SYSMENU | WS_THICKFRAME, 0 );
		if( m_wndMain.m_hWnd == NULL ) {
			hr = HRESULT_FROM_WIN32( GetLastError() );
		}
	}

	if( SUCCEEDED(hr) ) {
	    m_wndMain.ShowWindow(nCmdShow);
	}

	return hr;
}
Exemplo n.º 2
0
/* static */
const wxChar *wxApp::GetRegisteredClassName(const wxChar *name,
                                            int bgBrushCol,
                                            int extraStyles)
{
    const size_t count = gs_regClassesInfo.size();
#if defined(__INTEL_COMPILER) && 1 /* VDM auto patch */
#   pragma ivdep
#   pragma swp
#   pragma unroll
#   pragma prefetch
#   if 0
#       pragma simd noassert
#   endif
#endif /* VDM auto patch */
    for ( size_t n = 0; n < count; n++ )
    {
        if ( gs_regClassesInfo[n].regname == name )
            return gs_regClassesInfo[n].regname.c_str();
    }

    // we need to register this class
    WNDCLASS wndclass;
    wxZeroMemory(wndclass);

    wndclass.lpfnWndProc   = (WNDPROC)wxWndProc;
    wndclass.hInstance     = wxGetInstance();
    wndclass.hCursor       = ::LoadCursor(NULL, IDC_ARROW);
    wndclass.hbrBackground = (HBRUSH)wxUIntToPtr(bgBrushCol + 1);
    wndclass.style         = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS | extraStyles;


    ClassRegInfo regClass(name);
    wndclass.lpszClassName = regClass.regname.t_str();
    if ( !::RegisterClass(&wndclass) )
    {
        wxLogLastError(wxString::Format(wxT("RegisterClass(%s)"),
                       regClass.regname));
        return NULL;
    }

    wndclass.style &= ~(CS_HREDRAW | CS_VREDRAW);
    wndclass.lpszClassName = regClass.regnameNR.t_str();
    if ( !::RegisterClass(&wndclass) )
    {
        wxLogLastError(wxString::Format(wxT("RegisterClass(%s)"),
                       regClass.regname));
        ::UnregisterClass(regClass.regname.c_str(), wxGetInstance());
        return NULL;
    }

    gs_regClassesInfo.push_back(regClass);

    // take care to return the pointer which will remain valid after the
    // function returns (it could be invalidated later if new elements are
    // added to the vector and it's reallocated but this shouldn't matter as
    // this pointer should be used right now, not stored)
    return gs_regClassesInfo.back().regname.t_str();
}
Exemplo n.º 3
0
bool Window::createWindow()
{
  if (regClass(m_hinst, m_windowClassName) == 0) {
    return false;
  }

  m_hwnd = ::CreateWindow(m_windowClassName, _T("Window"),
                          0, 0, 0, 1, 1, HWND_MESSAGE, NULL, m_hinst, this);
  if (m_hwnd == 0) {
    return false;
  }

  SetWindowLong(m_hwnd, GWL_USERDATA, (LONG) this);
  return true;
}