当前位置: 首页>>代码示例>>C++>>正文


C++ CreateMainWindow函数代码示例

本文整理汇总了C++中CreateMainWindow函数的典型用法代码示例。如果您正苦于以下问题:C++ CreateMainWindow函数的具体用法?C++ CreateMainWindow怎么用?C++ CreateMainWindow使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了CreateMainWindow函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: DT

STDMETHODIMP 
CUpgradrToolbar::SetSite(IUnknown *pUnknownSite)
{
	DT(TRACE_I(FS(_T("Toolbar[%08X]: SetSite(%08X)"), this, pUnknownSite)));
	try {
		if (!!pUnknownSite)
		{
			// attach the window
			HWND hMyWindow;
			CComPtr<IUnknown> site(pUnknownSite);
			CComQIPtr<IOleWindow> window(site);
			window->GetWindow(&hMyWindow);
			if (!hMyWindow) 
			{
				TRACE_E(FS(_T("Toolbar[%08X]: Cannot retrieve toolbar base window"), this));
				return E_FAIL;
			}
			SubclassWindow(hMyWindow);

			// get a WebBrowser reference
			CComQIPtr<IServiceProvider> serviceProvider(site);
			serviceProvider->QueryService(IID_IWebBrowserApp, IID_IWebBrowser2, (void**)&m_spWebBrowser);
			site->QueryInterface(IID_IInputObjectSite, (void**)&m_spSite);

			// create main window
			CreateMainWindow();
		}
	}
	catch (CUpgradrRuntimeError &ex)
	{
		HandleError(ex.ErrorMessage());
		return E_FAIL;
	}
	return S_OK;
}
开发者ID:cherry-wb,项目名称:upgradr,代码行数:35,代码来源:UpgradrToolbar.cpp

示例2: InitInstance

//
//   FUNCTION: InitInstance(HINSTANCE, int)
//
//   PURPOSE: Saves instance handle and creates main window
//
//   COMMENTS:
//
//        In this function, we save the instance handle in a global variable and
//        create and display the main program window.
//
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
    INITCOMMONCONTROLSEX ics;  ics.dwSize = sizeof(ics);
    ics.dwICC = ICC_WIN95_CLASSES;
    InitCommonControlsEx(&ics);

#if !defined(PRODUCT)
    DebugLogClear();
#endif
    Settings_Init();
    //Joystick_Init();
    //Joystick_SelectJoystick(Settings_GetJoystick());
    if (!Emulator_Init())
        return FALSE;

    int conf = Settings_GetConfiguration();
    //if (conf == 0) //TODO
    if (!Emulator_InitConfiguration((NeonConfiguration)conf))
        return FALSE;

    Emulator_SetSound(Settings_GetSound());

    if (!CreateMainWindow())
        return FALSE;

    return TRUE;
}
开发者ID:VWarlock,项目名称:neonbtl,代码行数:37,代码来源:Main.cpp

示例3: WinMain

int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
{
	MSG msg = {0};

	// Create the Main Window
    CreateMainWindow(hInstance, iCmdShow);

	// Initialize Everything!
	if(!Game::GetInstance()->Initialize(g_hwnd,hInstance))
		return E_FAIL;

    while (WM_QUIT != msg.message)
    {
		if(PeekMessage(&msg, g_hwnd, 0, 0, PM_REMOVE))
		{
			TranslateMessage (&msg);
			DispatchMessage (&msg);
		}
		else
		{
			Game::GetInstance()->Tick();
		}
    }

	UnregisterClass( szAppName, wndclassex.hInstance );

    return msg.wParam;
}
开发者ID:TheOrestes,项目名称:D3D9,代码行数:28,代码来源:System.cpp

示例4: WinMain

int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInstance, 
                    LPSTR lpCmdLine, int nCmdShow)
{
    MSG msg; /* Application messages are saved here */    
    
    hInstance = hInst;
    hwndMain = CreateMainWindow();
    
    if (!hwndMain)
    {
        MessageBox(NULL, "Unable to create window", "pTrans", 
                MB_OK|MB_ICONSTOP);
    }
    
    /* Set the WS_EX_LAYERED style */
    SetWindowLong(hwndMain, GWL_EXSTYLE, GetWindowLong(hwndMain, GWL_EXSTYLE) |
        WS_EX_LAYERED);
        
    /* Make the window 60% alpha */
    SetLayeredWindowAttributes(hwndMain, 0, (255 * 60) / 100, LWA_ALPHA);
    /* Show the window */
    ShowWindow(hwndMain, nCmdShow);
    
    /* Get message from the message queue */
    while (GetMessage (&msg, NULL, 0, 0))
    {
        /* Translates virtual key messages to character messages */
        TranslateMessage(&msg);
        /* Sends message to the window proc */        
        DispatchMessage(&msg);
    }
    
    /* Return value, 0 if WM_QUIT message posted */
    return msg.wParam;
}
开发者ID:Investment89,项目名称:Public-Domain,代码行数:35,代码来源:Transparency-Windows-XP.cpp

示例5: WinMain

//=============================================================================
// Starting point for a Windows application
//=============================================================================
int WINAPI WinMain(HINSTANCE hInstance,
	HINSTANCE hPrevInstance,
	LPSTR     lpCmdLine,
	int       nCmdShow)
{
	MSG     msg;

	// Create the main window
	if (!CreateMainWindow(hInstance, nCmdShow))
		return false;

	for (int i = 0; i<256; i++)   // initialize virtual key array
		vkKeys[i] = false;

	// main message loop
	int done = 0;
	while (!done)
	{
		if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
		{
			//look for quit message
			if (msg.message == WM_QUIT)
				done = 1;

			//decode and pass messages on to WinProc
			TranslateMessage(&msg);
			DispatchMessage(&msg);
		}
	}

	return msg.wParam;
}
开发者ID:codebachi,项目名称:ProjectDX_Kelly,代码行数:35,代码来源:key_down.cpp

示例6: main

/* fonction principale */
int main(int argc,char *argv[])
{
  Window window;
  Display *display;
  Visual *visual;
  XEvent event;
  XImage *ximage;
  GC gc;
  int process_fils;
  int depth,done;
  long event_mask;
  char buffer;
  
  /* creation de la fenetre de l'application */
  CreateMainWindow(SCREEN_WIDTH, SCREEN_HEIGHT, "Pong");
  
  /* recuperation des variables */
  window=GetAppWindow();
  display=GetAppDisplay();
  
  
  /* affichage de la fenetre */
  XMapWindow(display,window);
  
  
		while(TRUE)
		Pong();
  return 0;
}
开发者ID:neriki,项目名称:old_c_exp,代码行数:30,代码来源:main.c

示例7: WinMain

//=============================================================================
// Starting point for a Windows application
// Parameters are:
//   hInstance - 현재 어플 인스턴스
//   hPrevInstance - 항상 NULL, 그냥 구색용 매개변수
//   lpCmdLine - pointer to null-terminated string of command line arguments
//   nCmdShow - specifies how the window is to be shown
//=============================================================================
int WINAPI WinMain(HINSTANCE hInstance,
	HINSTANCE hPrevInstance,
	LPSTR     lpCmdLine,
	int       nCmdShow)
{
	MSG	 msg;

	// 윈도우 생성
	if (!CreateMainWindow(hInstance, nCmdShow))
		return false;

	// 메인 메세지 룹
	int done = 0;
	while (!done)
	{
		// PeekMessage is a non-blocking method for checking for Windows messages.
		if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
		{
			// look for quit message
			if (msg.message == WM_QUIT)
				done = 1;

			//메세지 디코딩
			TranslateMessage(&msg);
			// 메세지를 WinProc 콜백으로 전달
			DispatchMessage(&msg);
		}
	}
	return msg.wParam;
}
开发者ID:codebachi,项目名称:ProjectDX_Kelly,代码行数:38,代码来源:helloworld.cpp

示例8: MiniGUIMain

int MiniGUIMain (int args, const char* arg[])
{
	HWND hMainWnd;
	MSG Msg;
	MAINWINCREATE CreateInfo;	
	
	DoSysCmd("date >> CurrentVer");
	DoSysCmd("echo \""PROVER"\" >> CurrentVer");
	init();
	InitCreateInfo (&CreateInfo);
	hMainWnd = CreateMainWindow (&CreateInfo);
	if (hMainWnd == HWND_INVALID)
		return -1;
	ShowWindow (hMainWnd, SW_SHOWNORMAL);
	SetCursorPos (805, 605) ;
	while ( GetMessage (&Msg, hMainWnd) )
	{
		TranslateMessage (&Msg);
		DispatchMessage (&Msg);
	}
	I_DEV_IOBoard_Exit();
	MainWindowThreadCleanup (hMainWnd);
	system_close();
	exit(0);

	return 0;
}
开发者ID:moyuanming,项目名称:NWeight,代码行数:27,代码来源:st_main.c

示例9: azAssert

//----------------------------------------------------------------------------------------------------------------------
//
//----------------------------------------------------------------------------------------------------------------------
void azMain::Run(azIApplication& a_rApplication)
{
	azAssert(s_pMainInstance != NULL, "Static Main instance is not properly set");

	CreateMainWindow();

	a_rApplication.Initialize();
	m_bIsExitRequested = false;

    MSG oMessage;
    while (!m_bIsExitRequested)
    {
        if (PeekMessage(&oMessage, NULL, 0, 0, PM_REMOVE))
        {
            // Handling Windows messages
            TranslateMessage(&oMessage);
            DispatchMessage(&oMessage);
        }
        else
        {
            // Update scene
            a_rApplication.Update();
        }
    }

	a_rApplication.Terminate();

	DestroyMainWindow();
}
开发者ID:arouton,项目名称:Aztec,代码行数:32,代码来源:azMain.cpp

示例10: WinMain

/************************************************************************
 * Ponto inicial para uma aplicacao Windows
 * Os parametros sao:
 * hInstance - aponta a instancia da aplicacao
 * hPrevInstance - sempre NULL parametro ja obsoleto
 * lpCmdLine - ponteiro para uma string null-terminated contendo os parametros de linha de comando
 * nCmdShow - determina como a janela deve ser exibida
 * 
 * Gilson Cavalcanti - [email protected]
 ************************************************************************/
int WINAPI WinMain( HINSTANCE hInstance,
					HINSTANCE hPrevInstance,
					LPSTR lpCmdLine,
					int nCmdShow) {
	MSG msg;

	// Verifica se ja existe uma outra instancia desta aplicacao
	if (OutraInstancia())
		return false;

	// Cria a janela 
	if (!CreateMainWindow(hInstance, nCmdShow))
		return false;

	// Main message loop
	int done = 0;
	while (!done) {
		// Faz um teste sem bloquear a execucao para escutar mensagens do Windows
		if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
			// Se ouviu uma mensagem de quit
			if (msg.message == WM_QUIT)
				done = 1;
			// Decodifica e passa mensagens para o WinProc
			TranslateMessage(&msg);
			DispatchMessage(&msg);
		}
	}
	return msg.wParam;
}
开发者ID:gilsoncav,项目名称:PUCG_HelloWorld,代码行数:39,代码来源:winmain.cpp

示例11: InitInstance

//
//   FUNCTION: InitInstance(HINSTANCE, int)
//
//   PURPOSE: Saves instance handle and creates main window
//
//   COMMENTS:
//
//        In this function, we save the instance handle in a global variable and
//        create and display the main program window.
//
BOOL InitInstance(HINSTANCE /*hInstance*/, int /*nCmdShow*/)
{
    INITCOMMONCONTROLSEX ics;  ics.dwSize = sizeof(ics);
    ics.dwICC = ICC_WIN95_CLASSES;
    InitCommonControlsEx(&ics);

#if !defined(PRODUCT)
    DebugLogClear();
#endif
    Settings_Init();

    ParseCommandLine();  // Override settings by command-line option if needed

    if (!Emulator_Init())
        return FALSE;
    WORD conf = (WORD) Settings_GetConfiguration();
    if (conf == 0) conf = EMU_CONF_NEMIGA303;
    if (!Emulator_InitConfiguration(conf))
        return FALSE;
    Emulator_SetSound(Settings_GetSound());
    Emulator_SetSpeed(Settings_GetRealSpeed());

    if (!CreateMainWindow())
        return FALSE;

    return TRUE;
}
开发者ID:nzeemin,项目名称:nemigabtl,代码行数:37,代码来源:Main.cpp

示例12: CreateMainWindow

C3DConnexion::C3DConnexion(HINSTANCE hInst, HWND hWnd)
{
	HRESULT hr;
	CComPtr<IUnknown> p3DxDevice;
	CComPtr<ISimpleDevice> p3DxSimpleDevice;
	m_ValidFlag = FALSE;

	m_hParentWnd = hWnd;
	CreateMainWindow(hInst, 0, 0, 100, 100, "3DConnexion.cpp");


	hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
	hr = p3DxDevice.CoCreateInstance(__uuidof(Device));
	if (SUCCEEDED(hr))
	{
		hr = p3DxDevice.QueryInterface(&p3DxSimpleDevice);
		if (SUCCEEDED(hr)) {
			m_3DSensor    = p3DxSimpleDevice->Sensor;
			m_3DKeyboard  = p3DxSimpleDevice->Keyboard;
			p3DxSimpleDevice->LoadPreferences(_T("3DMouse Controller"));
			p3DxSimpleDevice->Connect();
			m_ValidFlag = TRUE;
		}
	}
}
开发者ID:ogata-lab,项目名称:RT3DConnexion,代码行数:25,代码来源:3DConnexion.cpp

示例13: CreateCounterDialog

int CreateCounterDialog(HWND hWnd)
{
	MSG           Msg;
	HWND          hcwd;
	MAINWINCREATE CreateInfo;
#ifdef _LITE_VERSION
	SetDesktopRect(0, 0, 1024, 768);
#endif
	CreateInfo.dwStyle        = WS_VISIBLE | WS_BORDER | WS_CAPTION;
	CreateInfo.dwExStyle      = WS_EX_NONE;
	CreateInfo.spCaption      = MSG_CALCULATION;
	CreateInfo.hMenu          = 0;
	CreateInfo.hCursor        = GetSystemCursor(0);
	CreateInfo.hIcon          = 0;
	CreateInfo.MainWindowProc = CounterDialogProc;
	CreateInfo.lx             = 0;
	CreateInfo.ty             = 0;
	CreateInfo.rx             = 320;
	CreateInfo.by             = 240;
	CreateInfo.iBkColor       = COLOR_lightwhite;
	CreateInfo.dwAddData      = 0;
	CreateInfo.hHosting       = hWnd;

	hcwd = CreateMainWindow(&CreateInfo);

	ShowWindow(hcwd, SW_SHOWNORMAL);

	while (GetMessage(&Msg, hcwd)) {
		TranslateMessage(&Msg);
		DispatchMessage(&Msg);
	}

	MainWindowThreadCleanup(hcwd);
	return 0;
}
开发者ID:HsiangYu,项目名称:SQ_demo1,代码行数:35,代码来源:counter.c

示例14: CreateMainWindowAndReturnExitCodeWhenItCloses

int CreateMainWindowAndReturnExitCodeWhenItCloses( const HINSTANCE i_thisInstanceOfTheProgram, const int i_initialWindowDisplayState )
{
	// Try to create the main window
	if ( CreateMainWindow( i_thisInstanceOfTheProgram, i_initialWindowDisplayState ) )
	{
		if (Gameplay::Initialize(s_mainWindow))
		{
			// If the main window was successfully created wait for it to be closed
			const int exitCode = WaitForMainWindowToCloseAndReturnExitCode(i_thisInstanceOfTheProgram);

			Gameplay::Shutdown();

			return exitCode;
		}
		else
		{
			//Our game code failed to initialize.  Return a made-up error code
			return -2;
		}
	}
	else
	{
		// If the main window wasn't created return a made-up error code
		return -1;
	}
}
开发者ID:nonathaj,项目名称:EAE_Engineering_2,代码行数:26,代码来源:WindowsProgram.cpp

示例15: WinMain

//=============================================================================
// Starting point for a Windows application
//=============================================================================
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
                    LPSTR lpCmdLine, int nCmdShow)
{
    // Check for memory leak if debug build
    #if defined(DEBUG) | defined(_DEBUG)
        _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
    #endif

		runtimeLog.open("log.txt");

    MSG msg;

    // Create the game, sets up message handler
    game = new Grpg;

    // Create the window
    if (!CreateMainWindow(hwnd, hInstance, nCmdShow))
        return 1;

    try{
        game->initialize(hwnd);     // throws GameError

        // main message loop
        int done = 0;
        while (!done)
        {
            if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) 
            {
                // look for quit message
                if (msg.message == WM_QUIT)
                    done = 1;

                // decode and pass messages on to WinProc
                TranslateMessage(&msg);
                DispatchMessage(&msg);
            } else
                game->run(hwnd);    // run the game loop
        }
        SAFE_DELETE (game);     // free memory before exit
        return msg.wParam;
    }
    catch(const GameError &err)
    {
        game->deleteAll();
        DestroyWindow(hwnd);
        MessageBox(NULL, err.getMessage(), "Error", MB_OK);
    }
    catch(exception e)
    {
        game->deleteAll();
        DestroyWindow(hwnd);
        MessageBox(NULL, "Unknown error occured in game.", "Error", MB_OK);
    }

    SAFE_DELETE (game);     // free memory before exit

	runtimeLog.close();
    return 0;
}
开发者ID:Capeguy,项目名称:GPAssignment2,代码行数:62,代码来源:winmain.cpp


注:本文中的CreateMainWindow函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。