• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ GetMessage函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: main

// для GCC - другая
int main()
#endif
{
	w = ImageWidth, h = ImageHeight;
	encode_start();
	//memset(&CamImg, 0, sizeof(CamImg));
	
	
	
	MSG msg;
	WNDCLASSA wcl;
	// 0. Регистрируем оконный класс

	wcl.hInstance = NULL;
	wcl.lpszClassName = szWinName;
	wcl.lpfnWndProc = MyFunc;
	wcl.style = 0;
	wcl.hIcon = LoadIcon(NULL, IDI_APPLICATION);
	wcl.hCursor = LoadCursor(NULL, IDC_ARROW);
	wcl.lpszMenuName = NULL;

	wcl.cbClsExtra = 0;
	wcl.cbWndExtra = 0;

	wcl.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);

	if(!RegisterClassA(&wcl)) return 0;

	// 1. Создаём окно

	hWnd = CreateWindowA(szWinName, "Video", 
		WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 1024, 700, HWND_DESKTOP, NULL, 
		NULL, NULL);

	HWND hStartRecord = CreateWindowA(
									"BUTTON", // Window class
									"Start", // Title
									WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON,
									650,
									200,
									100,
									50,
									hWnd,
									(HMENU)ID_START_BUTTON, // для WM_COMMAND
									NULL /*hThisInst*/,
									NULL
								);
	
	HWND hStopRecord = CreateWindowA(
									"BUTTON", // Window class
									"Stop", // Title
									WS_TABSTOP | WS_VISIBLE | WS_CHILD | BS_DEFPUSHBUTTON,
									650,
									100,
									100,
									50,
									hWnd,
									(HMENU)ID_STOP_BUTTON, // для WM_COMMAND
									NULL /*hThisInst*/,
									NULL
								);
	
	// 2. Отображаем окно на экран
	ShowWindow(hWnd, SW_SHOW);
	UpdateWindow(hWnd);

	// 3. Запускаем таймер (20 мсек, 50 кадров в секунду)
	SetTimer(hWnd, 1, 20, NULL);

	// 4. стартуем получение кадров с камеры
	InitVideo();

	// 5. Стандартный цикл обработки событий
	while(GetMessage(&msg, NULL, 0, 0))
	{
		TranslateMessage(&msg);
		DispatchMessage(&msg);
	}

	return msg.wParam;
}
开发者ID:suratovvlad,项目名称:videostream,代码行数:82,代码来源:SampleVideo.cpp


示例2: Notepad_WinMain


//.........这里部分代码省略.........
			char *st = strstr( lpCmdLine, "|" ) ;
			if( st!=NULL ) {
				SavFile=(char*)malloc(strlen(st)+1);
				strcpy( SavFile, st+1 ) ;
				st[0]='\0';
				IniFile=(char*)malloc(strlen(lpCmdLine)+1);
				strcpy( IniFile, lpCmdLine ) ;
			}
		}
	}
	TestIfParentIsKiTTY() ;
#endif
	
	notepad_hinst = hinstance;
 	HANDLE hAccel = LoadAccelerators (notepad_hinst, MAKEINTRESOURCE(NOTEPAD_IDR_ACCEL)) ;

	wc.style = 0;
	wc.lpfnWndProc = Notepad_WndProc;
	wc.cbClsExtra = 0;
	wc.cbWndExtra = 0;
	wc.hInstance = NULL;
	//wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
	wc.hIcon = LoadIcon(notepad_hinst, MAKEINTRESOURCE(NOTEPAD_IDI_MAINICON));
	wc.hCursor = LoadCursor(NULL, IDC_ARROW);
	wc.hbrBackground = (HBRUSH)(1 + COLOR_BTNFACE);
	wc.lpszMenuName =  NULL;
	wc.lpszClassName = Notepad_szprogname ;

	if(!RegisterClass(&wc)) return FALSE;

	//menu et sous menu
	hSMApropos = CreateMenu();
	AppendMenu(hSMApropos, MF_STRING, NOTEPAD_IDM_ABOUT, Notepad_LoadString(NOTEPAD_STR_ABOUT));

	hSMEdition = CreateMenu();
	AppendMenu(hSMEdition, MF_STRING, NOTEPAD_IDM_CUT, Notepad_LoadString(NOTEPAD_STR_CUT));
	AppendMenu(hSMEdition, MF_STRING, NOTEPAD_IDM_COPY, Notepad_LoadString(NOTEPAD_STR_COPY));
	AppendMenu(hSMEdition, MF_STRING, NOTEPAD_IDM_PASTE, Notepad_LoadString(NOTEPAD_STR_PASTE));
	AppendMenu(hSMEdition, MF_STRING, NOTEPAD_IDM_SELECTALL, Notepad_LoadString(NOTEPAD_STR_SELECTALL));
	AppendMenu(hSMEdition, MF_STRING, NOTEPAD_IDM_UNDO, Notepad_LoadString(NOTEPAD_STR_UNDO));
	AppendMenu(hSMEdition, MF_SEPARATOR, 0, NULL );
	AppendMenu(hSMEdition, MF_STRING, NOTEPAD_IDM_SETFONT, Notepad_LoadString(NOTEPAD_STR_SETFONT));

	hSMFichier = CreateMenu();
	AppendMenu(hSMFichier, MF_STRING, NOTEPAD_IDM_NEW, Notepad_LoadString(NOTEPAD_STR_NEW));
	AppendMenu(hSMFichier, MF_STRING, NOTEPAD_IDM_OPEN, Notepad_LoadString(NOTEPAD_STR_OPEN));
	AppendMenu(hSMFichier, MF_STRING|MF_GRAYED|MF_DISABLED, NOTEPAD_IDM_SAVE, Notepad_LoadString(NOTEPAD_STR_SAVE));
	AppendMenu(hSMFichier, MF_STRING, NOTEPAD_IDM_SAVEAS, Notepad_LoadString(NOTEPAD_STR_SAVEAS));
#ifdef NOMAIN
	AppendMenu(hSMFichier, MF_SEPARATOR, 0, NULL );
	AppendMenu(hSMFichier, MF_STRING, NOTEPAD_IDM_LOAD_INI, TEXT("ini file"));
	AppendMenu(hSMFichier, MF_STRING, NOTEPAD_IDM_LOAD_SAV, TEXT("sav file"));
	if( ParentWindow!=NULL ) {
		AppendMenu(hSMFichier, MF_SEPARATOR, 0, NULL );
		AppendMenu(hSMFichier, MF_STRING, NOTEPAD_IDM_RESIZE, TEXT("&Resize"));
		}
#endif
	AppendMenu(hSMFichier, MF_SEPARATOR, 0, NULL );
	AppendMenu(hSMFichier, MF_STRING, NOTEPAD_IDM_QUIT, Notepad_LoadString(NOTEPAD_STR_QUIT));

	hMenu = CreateMenu();
	AppendMenu(hMenu,MF_POPUP,(UINT)hSMFichier,Notepad_LoadString(NOTEPAD_STR_FILE));
	AppendMenu(hMenu,MF_POPUP,(UINT)hSMEdition,Notepad_LoadString(NOTEPAD_STR_EDIT));

#ifdef NOMAIN
	HMENU hSMDelim = CreateMenu() ;
	AppendMenu(hSMDelim, MF_STRING|MF_CHECKED, NOTEPAD_IDM_CRLF, Notepad_LoadString(NOTEPAD_STR_CRLF));
	AppendMenu(hSMDelim, MF_STRING|MF_CHECKED, NOTEPAD_IDM_SCOLON, Notepad_LoadString(NOTEPAD_STR_SCOLON));
	AppendMenu(hSMDelim, MF_STRING|MF_UNCHECKED, NOTEPAD_IDM_SLASH, Notepad_LoadString(NOTEPAD_STR_SLASH));
	AppendMenu(hMenu,MF_POPUP,(UINT)hSMDelim,Notepad_LoadString(NOTEPAD_STR_DELIM));
	AppendMenu(hMenu,MF_STRING, NOTEPAD_IDM_SEND, Notepad_LoadString(NOTEPAD_STR_SEND));
#endif
	AppendMenu(hMenu,MF_POPUP,(UINT)hSMApropos,Notepad_LoadString(NOTEPAD_STR_HELP));

	//hwnd = CreateWindow(Notepad_szprogname, Notepad_szprogname, WS_OVERLAPPEDWINDOW,CW_USEDEFAULT, CW_USEDEFAULT, cxScreen, cyScreen, NULL, hMenu, hinstance, NULL);
	hwnd = CreateWindowEx(WS_EX_ACCEPTFILES,Notepad_szprogname, Notepad_szprogname, WS_OVERLAPPEDWINDOW,CW_USEDEFAULT, CW_USEDEFAULT, cxScreen, cyScreen, NULL, hMenu, hinstance, NULL);
	
	if (!hwnd) return FALSE;

	ShowWindow(hwnd, nCmdShow) ;
	UpdateWindow(hwnd) ;

#ifdef NOMAIN
	InitKiTTYNotepad( hwnd ) ;
	if( strstr( lpCmdLine, "-ed " ) == lpCmdLine )
		if( strlen(lpCmdLine)>4 )
		SendMessage( hwnd, WM_COMMAND, NOTEPAD_IDM_LOAD, (LPARAM)(lpCmdLine+4) ) ;
#else
	if( strlen(lpCmdLine)>0 )
		SendMessage( hwnd, WM_COMMAND, NOTEPAD_IDM_LOAD, (LPARAM)lpCmdLine ) ;
#endif
	
	while (GetMessage(&msg, NULL, 0, 0)) {
		if(!TranslateAccelerator(hwnd, hAccel, &msg)){
			TranslateMessage(&msg);
			DispatchMessage(&msg);
			}
		}
	return msg.wParam;
	}
开发者ID:pigfoot,项目名称:KiTTY,代码行数:101,代码来源:notepad.c


示例3: pvm_win_window_thread

//int WINAPI
void    pvm_win_window_thread()
{
    MSG Message;

    if(pvm_win_setup_window())
    {
        init_err = 1;
        printf("pvm_win_setup_window failed\n");
        return;
    }

    // Allocate enough memory for the BITMAPINFOHEADER and 256 RGBQUAD palette entries
    LPBITMAPINFO lpbi;
    lpbi = (LPBITMAPINFO) malloc(sizeof(BITMAPINFOHEADER) + (256 * sizeof(RGBQUAD)));

    lpbi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
    lpbi->bmiHeader.biWidth = VSCREEN_WIDTH;
    lpbi->bmiHeader.biHeight = VSCREEN_HEIGHT;
    lpbi->bmiHeader.biPlanes = 1;
    lpbi->bmiHeader.biBitCount = 24;
    lpbi->bmiHeader.biCompression = BI_RGB;
    lpbi->bmiHeader.biSizeImage = 0;
    lpbi->bmiHeader.biXPelsPerMeter = 0;
    lpbi->bmiHeader.biYPelsPerMeter = 0;
    lpbi->bmiHeader.biClrUsed = 0;
    lpbi->bmiHeader.biClrImportant = 0;

    HDC hScreenDC = GetWindowDC(NULL);

    screenBitmap = CreateDIBSection( hScreenDC, lpbi, DIB_RGB_COLORS, (void*)&screen_image, 0, 0);

    // Assume hPaintDC is a variable of type HDC, and the dc we're rendering to
    //hBitmapDC = CreateCompatibleDC(hScreenDC);
    //HBITMAP hOldBitmap = (HBITMAP)SelectObject(hBitmapDC, screenBitmap);


    ReleaseDC(NULL,hScreenDC);
    free(lpbi);


    int i;
    for( i = 0; i < VSCREEN_WIDTH * VSCREEN_HEIGHT * 3; i++)
    {
        screen_image[i] = 34;
    }

    drv_video_win32.screen = screen_image;
    drv_video_win32.xsize = VSCREEN_WIDTH;
    drv_video_win32.ysize = VSCREEN_HEIGHT;
    drv_video_win32.update = &drv_win_screen_update;
#if 1
    drv_video_win32.bitblt = &vid_bitblt_forw;
    drv_video_win32.winblt = &vid_win_winblt;
    drv_video_win32.readblt = &vid_readblt_forw;
    drv_video_win32.bitblt_part = &vid_bitblt_part_forw;
#else
    drv_video_win32.bitblt = &drv_video_bitblt_rev;
    drv_video_win32.winblt = &drv_video_win_winblt_rev;
    drv_video_win32.readblt = &drv_video_readblt_rev;
    drv_video_win32.bitblt_part = &drv_video_bitblt_part_rev;
#endif

    drv_video_win32.mouse_redraw_cursor = &vid_mouse_draw_deflt;
    drv_video_win32.mouse_set_cursor = &vid_mouse_set_cursor_deflt;
    drv_video_win32.mouse_disable = &vid_mouse_off_deflt;
    drv_video_win32.mouse_enable = &vid_mouse_on_deflt;

    init_ok = 1;

#if HOVER
    {
        eventTrack.cbSize = sizeof(eventTrack);
        eventTrack.dwFlags = TME_HOVER;
        eventTrack.hwndTrack = hWnd;
        eventTrack.dwHoverTime = 5;

        if(0 == TrackMouseEvent(&eventTrack))
            printf("Track error\n");
    }
#endif

    while(GetMessage(&Message, hWnd, 0, 0))
    {
        TranslateMessage(&Message);
        DispatchMessage(&Message);
    }
    //return Message.wParam;
    //printf("Message loop end\n");

}
开发者ID:animotron,项目名称:animos,代码行数:91,代码来源:win_screen.c


示例4: DX5_CheckInput

/* This function checks the windows message queue and DirectInput and returns
   1 if there was input, 0 if there was no input, or -1 if the application has
   posted a quit message.
*/
static int DX5_CheckInput(_THIS, int timeout, BOOL processInput)
{
	MSG msg;
	int      i;
	HRESULT  result;
	DWORD    event;

	/* Check the normal windows queue (highest preference) */
	posted = 0;
	while ( ! posted &&
	        PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE) ) {
		if ( GetMessage(&msg, NULL, 0, 0) > 0 ) {
			DispatchMessage(&msg);
		} else {
			return(-1);
		}
	}
	if ( posted ) {
		return(1);
	}

	/* Pump the DirectInput flow */
	if ( SDL_GetAppState() & SDL_APPINPUTFOCUS ) {
		for ( i=0; i<SDL_DIndev; ++i ) {
			result = IDirectInputDevice2_Poll(SDL_DIdev[i]);
			if ( (result == DIERR_INPUTLOST) ||
					(result == DIERR_NOTACQUIRED) ) {
				if ( strcmp(inputs[i].name, "mouse") == 0 ) {
					mouse_lost = 1;
				}
				IDirectInputDevice2_Acquire(SDL_DIdev[i]);
				IDirectInputDevice2_Poll(SDL_DIdev[i]);
			}
		}
	}

	/* Wait for messages and input events */
	event = MsgWaitForMultipleObjects(SDL_DIndev, SDL_DIevt, FALSE,
							timeout, QS_ALLEVENTS);
	if ((event >= WAIT_OBJECT_0) && (event < (WAIT_OBJECT_0+SDL_DIndev))) {
		DWORD numevents;
		DIDEVICEOBJECTDATA evtbuf[INPUT_QSIZE];

		event -= WAIT_OBJECT_0;
		numevents = INPUT_QSIZE;
		result = IDirectInputDevice2_GetDeviceData(
				SDL_DIdev[event], sizeof(DIDEVICEOBJECTDATA),
							evtbuf, &numevents, 0);
		if ( (result == DIERR_INPUTLOST) ||
					(result == DIERR_NOTACQUIRED) ) {
			if ( strcmp(inputs[event].name, "mouse") == 0 ) {
				mouse_lost = 1;
			}
			IDirectInputDevice2_Acquire(SDL_DIdev[event]);
			result = IDirectInputDevice2_GetDeviceData(
				SDL_DIdev[event], sizeof(DIDEVICEOBJECTDATA),
							evtbuf, &numevents, 0);
		}
		/* Handle the events */
		if ( result == DI_OK && processInput ) {
			/* Note: This can post multiple events to event queue
			 */
			(*SDL_DIfun[event])((int)numevents, evtbuf);
			return(1);
		}
	}
	if ( event != WAIT_TIMEOUT ) {
		/* Maybe there was a windows message? */
		if ( PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE) ) {
			if ( GetMessage(&msg, NULL, 0, 0) > 0 ) {
				DispatchMessage(&msg);
			} else {
				return(-1);
			}
			return(1);
		}
	}
	return(0);
}
开发者ID:Sgt-Nukem,项目名称:chocolate_duke3D,代码行数:83,代码来源:SDL_dx5events.c


示例5: wWinMain

int WINAPI
wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nShowCmd)
{
    WCHAR szWindowClass[] = L"ROSAPPMGR";
    HANDLE hMutex = NULL;
    HACCEL KeyBrd;
    MSG Msg;

    InitializeAtlModule(hInstance, TRUE);

    switch (GetUserDefaultUILanguage())
    {
        case MAKELANGID(LANG_HEBREW, SUBLANG_DEFAULT):
            SetProcessDefaultLayout(LAYOUT_RTL);
            break;

        default:
            break;
    }

    hInst = hInstance;

    hMutex = CreateMutexW(NULL, FALSE, szWindowClass);
    if ((!hMutex) || (GetLastError() == ERROR_ALREADY_EXISTS))
    {
        /* If already started, it is found its window */
        HWND hWindow = FindWindowW(szWindowClass, NULL);

        /* Activate window */
        ShowWindow(hWindow, SW_SHOWNORMAL);
        SetForegroundWindow(hWindow);
        return 1;
    }

    if (!LoadSettings())
    {
        FillDefaultSettings(&SettingsInfo);
    }

    InitLogs();

    InitCommonControls();

    hMainWnd = CreateMainWindow();
    if (!hMainWnd) goto Exit;

    /* Maximize it if we must */
    ShowWindow(hMainWnd, (SettingsInfo.bSaveWndPos && SettingsInfo.Maximized ? SW_MAXIMIZE : nShowCmd));
    UpdateWindow(hMainWnd);

    if (SettingsInfo.bUpdateAtStart)
        UpdateAppsDB();

    /* Load the menu hotkeys */
    KeyBrd = LoadAccelerators(NULL, MAKEINTRESOURCE(HOTKEYS));

    /* Message Loop */
    while (GetMessage(&Msg, NULL, 0, 0))
    {
        if (!TranslateAccelerator(hMainWnd, KeyBrd, &Msg))
        {
            TranslateMessage(&Msg);
            DispatchMessage(&Msg);
        }
    }

Exit:
    if (hMutex)
        CloseHandle(hMutex);

    InitializeAtlModule(hInstance, FALSE);

    return 0;
}
开发者ID:GYGit,项目名称:reactos,代码行数:74,代码来源:winmain.cpp


示例6: MainLoop

//----------------------------------------------------------------------------------
//
//----------------------------------------------------------------------------------
void MainLoop()
{
	for(;;)
	{ 
		MSG msg;
		if (PeekMessage (&msg,NULL,0,0,PM_NOREMOVE)) 
		{
			if( msg.message == WM_QUIT )
			{
				return ;
			}
			GetMessage (&msg,NULL,0,0);
			TranslateMessage(&msg);
			DispatchMessage(&msg);
		}
		else
		{
			// フリップを行う
			g_manager->Flip();

			// Updateと再生開始を並行で行う
			g_wait = false;

			if( g_timer % 30 == 0 )
			{
				// エフェクトの再生
				g_manager->Play( g_effect, rand() % 20 - 10, rand() % 20 - 10, rand() % 20 - 10 );
			}

			// Update完了待ち
			while( !g_wait )
			{
				Sleep(1);
			}

			g_d3d_device->Clear( 0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(0,0,0), 1.0f, 0 );
			g_d3d_device->BeginScene();

			// エフェクトの描画開始処理を行う。
			g_renderer->BeginRendering();

			// エフェクトの描画を行う。
			g_manager->Draw();

			// エフェクトの描画終了処理を行う。
			g_renderer->EndRendering();

			g_d3d_device->EndScene();

			g_timer++;

			{
				HRESULT hr;
				hr = g_d3d_device->Present( NULL, NULL, NULL, NULL );

				// デバイスロスト処理
				switch ( hr )
				{
					// デバイスロスト
					case D3DERR_DEVICELOST:
					while ( FAILED( hr = g_d3d_device->TestCooperativeLevel() ) )
					{
						switch ( hr )
						{
							// デバイスロスト
							case D3DERR_DEVICELOST:
								::SleepEx( 1000, true );
								break;

							// デバイスロスト:リセット可
							case D3DERR_DEVICENOTRESET:
								
								// デバイスロストの処理を行う前に実行する
								g_renderer->OnLostDevice();

								D3DPRESENT_PARAMETERS d3dp;
								ZeroMemory(&d3dp, sizeof(d3dp));
								d3dp.BackBufferWidth = g_window_width;
								d3dp.BackBufferHeight = g_window_height;
								d3dp.BackBufferFormat = D3DFMT_X8R8G8B8;
								d3dp.BackBufferCount = 1;      
								d3dp.SwapEffect = D3DSWAPEFFECT_DISCARD;
								d3dp.Windowed = TRUE;
								d3dp.hDeviceWindow = g_window_handle;
								d3dp.EnableAutoDepthStencil = TRUE;
								d3dp.AutoDepthStencilFormat = D3DFMT_D16;

								g_d3d_device->Reset( &d3dp );

								// デバイスロストの処理の後に実行する
								g_renderer->OnResetDevice();

								break;
						}
					}
					break;
				}
//.........这里部分代码省略.........
开发者ID:AndrewFM,项目名称:Effekseer,代码行数:101,代码来源:main.cpp


示例7: WinMain

int WINAPI WinMain(HINSTANCE _hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLine, int iCmdShow)
{
	Common::EnableCrashingOnCrashes();

	char *token = szCmdLine;
	char fileToLoad[256] = "";

	token = strtok(szCmdLine," ");

	g_Config.Load();
	VFSRegister("", new DirectoryAssetReader(""));

	while (token)
	{
		if (strcmp(token,"-run"))
		{
			//run immediately
		}

		token = strtok(NULL," ");
	}

	//Windows, API init stuff
	INITCOMMONCONTROLSEX comm;
	comm.dwSize = sizeof(comm);
	comm.dwICC = ICC_BAR_CLASSES | ICC_LISTVIEW_CLASSES | ICC_TAB_CLASSES;
	InitCommonControlsEx(&comm);
	timeBeginPeriod(1);
	MainWindow::Init(_hInstance);

	HACCEL hAccelTable = LoadAccelerators(_hInstance, (LPCTSTR)IDR_ACCELS);
	g_hPopupMenus = LoadMenu(_hInstance, (LPCSTR)IDR_POPUPMENUS);

	MainWindow::Show(_hInstance, iCmdShow);
	host = new WindowsHost(MainWindow::GetHWND(), MainWindow::GetDisplayHWND());

	HWND hwndMain = MainWindow::GetHWND();
	HMENU menu = GetMenu(hwndMain);

	//initialize custom controls
	CtrlDisAsmView::init();
	CtrlMemView::init();
	CtrlRegisterList::init();

	DialogManager::AddDlg(memoryWindow[0] = new CMemoryDlg(_hInstance, hwndMain, currentDebugMIPS));
	DialogManager::AddDlg(vfpudlg = new CVFPUDlg(_hInstance, hwndMain, currentDebugMIPS));

	MainWindow::Update();
	MainWindow::UpdateMenus();

	LogManager::Init();
	bool hidden = false;
#ifndef _DEBUG
	hidden = true;
#endif
	LogManager::GetInstance()->GetConsoleListener()->Open(hidden, 150, 120, "PPSSPP Debug Console");
	LogManager::GetInstance()->SetLogLevel(LogTypes::G3D, LogTypes::LERROR);
	if (strlen(fileToLoad))
	{
		// TODO: load the thing
	}

	//so.. we're at the message pump of the GUI thread
	MSG msg;
	while (GetMessage(&msg, NULL, 0, 0))	//while no quit
	{
		//DSound_UpdateSound();

		//hack to make it possible to get to main window from floating windows with Esc
		if (msg.hwnd != hwndMain && msg.message==WM_KEYDOWN && msg.wParam==VK_ESCAPE)
			BringWindowToTop(hwndMain);

		//Translate accelerators and dialog messages...
		if (!TranslateAccelerator(hwndMain, hAccelTable, &msg))
		{
			if (!DialogManager::IsDialogMessage(&msg))
			{
				//and finally translate and dispatch
				TranslateMessage(&msg);
				DispatchMessage(&msg);
			}
		}
	}

	LogManager::Shutdown();
	DialogManager::DestroyAll();
	timeEndPeriod(1);
	g_Config.Save();
	delete host;
	return 0;
}
开发者ID:Falaina,项目名称:ppsspp,代码行数:91,代码来源:main.cpp


示例8: WinMain

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, 
    LPSTR lpCmdLine, int nCmdShow)
{
	WNDCLASSEX wc;
	HWND hwnd;
	MSG msg;

	wc.cbSize			= sizeof(WNDCLASSEX);
	wc.style			= 0;
	wc.lpfnWndProc		= WndProc;
	wc.cbClsExtra		= 0;
	wc.cbWndExtra		= 0;
	wc.hInstance		= hInstance;
	//wc.hIcon			= LoadIcon(NULL,IDI_APPLICATION);
#if MENU_1
	wc.hIcon			= LoadIcon(GetModuleHandle(NULL),MAKEINTRESOURCE(IDI_MYICON));			//icon on taskbar	
	wc.hIconSm			= (HICON)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_MYICON), IMAGE_ICON, 16, 16, 0);	//icon on top left
	wc.lpszMenuName		= MAKEINTRESOURCE(IDR_MYMENU);	
#endif
#if MENU_2
	wc.hIcon			= NULL;
	wc.hIconSm			= NULL;
	wc.lpszMenuName		= NULL;
#endif
#if DIALOG_1
	wc.hIcon			= NULL;
	wc.hIconSm			= NULL;
	wc.lpszMenuName		= MAKEINTRESOURCE(IDR_MYMENU);	
#endif

	wc.hCursor			= LoadCursor(NULL, IDC_ARROW);
	wc.hbrBackground	= (HBRUSH)(COLOR_WINDOW+1);		
	wc.lpszClassName	= g_szClassName;
	

	//register class
	if(!RegisterClassEx(&wc))
	{
		MessageBox(NULL,"Window Registration failed!", "Error !",
			MB_ICONEXCLAMATION | MB_OK);
	}

	//create window
	hwnd = CreateWindowEx(
		WS_EX_CLIENTEDGE,
		g_szClassName,
		"The title on my window",
		WS_OVERLAPPEDWINDOW,
		CW_USEDEFAULT, CW_USEDEFAULT, 240,120,
		NULL,NULL,hInstance,NULL);

	//check if creating window fail
	if(hwnd == NULL)
	{
		MessageBox(hwnd,"WIndow creattion failed!","Error !",
			MB_ICONEXCLAMATION | MB_OK);
		return 0;
	}

	ShowWindow(hwnd,nCmdShow);
	UpdateWindow(hwnd);
	
	while(GetMessage(&msg,NULL,0,0) > 0 )
	{
		TranslateMessage(&msg);
		DispatchMessage(&msg);
	}
    
    return 0;
}
开发者ID:pkhruasu,项目名称:winform32,代码行数:70,代码来源:main_dialog1.cpp


示例9: WinMain

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR  szCmdLine, int iCmdShow)

{
	static TCHAR      szAppName[] = TEXT("Checker1");

	HWND         hwnd;

	MSG          msg;

	WNDCLASS     wndclass;



	wndclass.style = CS_HREDRAW | CS_VREDRAW;

	wndclass.lpfnWndProc = WndProc;

	wndclass.cbClsExtra = 0;

	wndclass.cbWndExtra = 0;

	wndclass.hInstance = hInstance;

	wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);

	wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);

	wndclass.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);

	wndclass.lpszMenuName = NULL;

	wndclass.lpszClassName = szAppName;



	if (!RegisterClass(&wndclass))

	{

		MessageBox(NULL, TEXT("Program requires Windows NT!"),

			szAppName, MB_ICONERROR);

		return 0;

	}

	hwnd = CreateWindow(szAppName, TEXT("Checker1 Mouse Hit-Test Demo"),

		WS_OVERLAPPEDWINDOW,

		CW_USEDEFAULT, CW_USEDEFAULT,

		CW_USEDEFAULT, CW_USEDEFAULT,

		NULL, NULL, hInstance, NULL);



	ShowWindow(hwnd, iCmdShow);

	UpdateWindow(hwnd);



	while (GetMessage(&msg, NULL, 0, 0))

	{

		TranslateMessage(&msg);

		DispatchMessage(&msg);

	}

	return msg.wParam;

}
开发者ID:wakqaz4,项目名称:MyGame,代码行数:78,代码来源:源.cpp


示例10: __declspec

void __declspec(dllexport) show(HWND hwndParent, int string_size, TCHAR *variables, stack_t **stacktop)
{
  TCHAR fn[MAX_PATH];
  TCHAR temp[64];
  TCHAR *sleep=temp;

 
  EXDLL_INIT();

  popstring(sleep);
  popstring(fn);

  sleep_val=0;
  while (*sleep >= _T('0') && *sleep <= _T('9'))
  {
    sleep_val*=10;
    sleep_val+=*sleep++-_T('0');
  }

  if (fn[0] && sleep_val>0)
  {
    MSG msg;
    TCHAR classname[4]=_T("_sp");
    static WNDCLASS wc;
    wc.lpfnWndProc = WndProc;
    wc.hInstance = g_hInstance;
    wc.hCursor = LoadCursor(NULL,IDC_ARROW);
    wc.lpszClassName = classname;
    if (RegisterClass(&wc)) 
    {
      TCHAR fn2[MAX_PATH];
      lstrcpy(fn2,fn);
      lstrcat(fn,_T(".bmp"));
      lstrcat(fn2,_T(".wav"));
      g_hbm=LoadImage(NULL,fn,IMAGE_BITMAP,0,0,LR_CREATEDIBSECTION|LR_LOADFROMFILE);
      if (g_hbm) 
      {
        HWND myWnd;

        PlaySound(fn2,NULL,SND_ASYNC|SND_FILENAME|SND_NODEFAULT);

        myWnd = CreateWindowEx(WS_EX_TOOLWINDOW,classname,classname,
          0,0,0,0,0,(HWND)hwndParent,NULL,g_hInstance,NULL);

        while (IsWindow(myWnd) && GetMessage(&msg,myWnd,0,0))
        {
          DispatchMessage(&msg);
        }

        // Stop currently playing wave, we want to exit
        PlaySound(0,0,0);

        DeleteObject(g_hbm);

        UnregisterClass(classname, g_hInstance);

      }
    }
  }
  wsprintf(temp,_T("%d"),g_rv);
  pushstring(temp);
}
开发者ID:GEO-IASS,项目名称:nsis,代码行数:62,代码来源:splash.c


示例11: MMGetLineCount

void MMsgBox::AdjustSize()
{
	int nLineCount = MMGetLineCount(m_pMessage->GetFont(),GetMessage(),MMSGBOX_W);

	SetBounds(MRECT(MMSGBOX_X, MMSGBOX_Y, MMSGBOX_W, MMSGBOX_H + nLineCount*m_pMessage->GetFont()->GetHeight()));
}
开发者ID:MagistrAVSH,项目名称:node3d,代码行数:6,代码来源:MMsgBox.cpp


示例12: GetMessage

const char* MMsgBox::GetText(void)
{
	return GetMessage();
}
开发者ID:MagistrAVSH,项目名称:node3d,代码行数:4,代码来源:MMsgBox.cpp


示例13: s_video_gdi_create_window

void * s_video_gdi_create_window (void *arg)
{
	MSG msg;
	RECT rect;
	HDC mainwindow;
	WNDCLASSEX wndclass;
	char *szMainWndClass = "XynthWindowingSystem";
	s_video_gdi_data_t *priv = (s_video_gdi_data_t *) xynth_server->driver->driver_data;

	memset(&wndclass, 0, sizeof(WNDCLASSEX));
	wndclass.lpszClassName = szMainWndClass;
	wndclass.cbSize = sizeof(WNDCLASSEX);
	wndclass.style = CS_HREDRAW | CS_VREDRAW;
	wndclass.lpfnWndProc = MainWndProc;
	wndclass.hInstance = priv->hinst;
	wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
	wndclass.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
	wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
	wndclass.hbrBackground = (HBRUSH) (COLOR_WINDOW + 1);
	RegisterClassEx(&wndclass);
	
	priv->hwndMain = CreateWindow(szMainWndClass,
	                              "Xynth Windowing system",
                                      WS_POPUP | WS_BORDER | WS_SYSMENU | WS_MINIMIZEBOX | WS_CAPTION,
	                              CW_USEDEFAULT,
	                              CW_USEDEFAULT,
	                              CW_USEDEFAULT,
	                              CW_USEDEFAULT,
	                              NULL,
	                              NULL,
	                              priv->hinst,
	                              NULL);

	rect.left = 0;
	rect.right = xynth_server->window->surface->width;
	rect.top = 0;
	rect.bottom = xynth_server->window->surface->height;
        AdjustWindowRect(&rect, GetWindowLong(priv->hwndMain, GWL_STYLE), FALSE);
        SetWindowPos(priv->hwndMain, HWND_TOP, 0, 0, rect.right - rect.left, rect.bottom - rect.top, SWP_NOMOVE);

	ShowWindow(priv->hwndMain, TRUE);
	UpdateWindow(priv->hwndMain);
	
	mainwindow = GetDC(priv->hwndMain);
	if (mainwindow == NULL) {
                debugf(DSER | DFAT, "What the fuck is this?");
		return NULL;
	}
	priv->bpp_windows = GetDeviceCaps(mainwindow, BITSPIXEL);
	if (priv->bpp_windows == 24) {
                debugf(DSER | DFAT, "24 bitsperpixel modes are not supported by Xynth Windowing System. "
                                    "Try changing display mode from "
                                    "Display Properties -> Settings -> Color quality.");
        }

	while (GetMessage(&msg, NULL, 0, 0)) {
		TranslateMessage(&msg);
		DispatchMessage(&msg);
	}

	return (void *) msg.wParam;
}
开发者ID:jetlive,项目名称:xynth,代码行数:62,代码来源:event.c


示例14: WinMain

int WINAPI WinMain (HINSTANCE hThisInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR lpszArgument,
                     int nCmdShow)
{
    HWND hwnd;               /* This is the handle for our window */
    MSG messages;            /* Here messages to the application are saved */
    WNDCLASSEX wincl;        /* Data structure for the windowclass */

    /* The Window structure */
    wincl.hInstance = hThisInstance;
    wincl.lpszClassName = szClassName;
    wincl.lpfnWndProc = WindowProcedure;      /* This function is called by windows */
    wincl.style = CS_DBLCLKS;                 /* Catch double-clicks */
    wincl.cbSize = sizeof (WNDCLASSEX);

    /* Use default icon and mouse-pointer */
    wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION);
    wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
    wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
    wincl.lpszMenuName = NULL;                 /* No menu */
    wincl.cbClsExtra = 0;                      /* No extra bytes after the window class */
    wincl.cbWndExtra = 0;                      /* structure or the window instance */
    /* Use Windows's default colour as the background of the window */
    wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND;

    /* Register the window class, and if it fails quit the program */
    if (!RegisterClassEx (&wincl))
        return 0;

    /* The class is registered, let's create the program*/
    hwnd = CreateWindowEx (
           0,                   /* Extended possibilites for variation */
           szClassName,         /* Classname */
           _T("Code::Blocks Template Windows App"),       /* Title Text */
           WS_OVERLAPPEDWINDOW, /* default window */
           CW_USEDEFAULT,       /* Windows decides the position */
           CW_USEDEFAULT,       /* where the window ends up on the screen */
           544,                 /* The programs width */
           375,                 /* and height in pixels */
           HWND_DESKTOP,        /* The window is a child-window to desktop */
           NULL,                /* No menu */
           hThisInstance,       /* Program Instance handler */
           NULL                 /* No Window Creation data */
           );

    /* Make the window visible on the screen */
    ShowWindow (hwnd, nCmdShow);

    /* Run the message loop. It will run until GetMessage() returns 0 */
    while (GetMessage (&messages, NULL, 0, 0))
    {
        /* Translate virtual-key messages into character messages */
        TranslateMessage(&messages);
        /* Send message to WindowProcedure */
        DispatchMessage(&messages);
    }

    /* The program return-value is 0 - The value that PostQuitMessage() gave */
    return messages.wParam;
}
开发者ID:simple-codeblocks,项目名称:Codeblocks,代码行数:61,代码来源:main.cpp


示例15: srand

DWORD CSocketThreadManager::SocketThread(LPVOID lpParameter)
{
	try
	{
		//Get the address of our data
		ThreadData* pData;
		pData=(ThreadData*)lpParameter;

		//Initialize the random seed
		srand(GetTickCount()+(unsigned long)pData->pEvent+(unsigned long)pData->hWindowHandle);
		
		//Create the window
		pData->hWindowHandle=CreateWindowEx(0,
											pData->sClassName.c_str(),
											SOCKET_WINDOW_NAME,
											WS_OVERLAPPED,
											0,
											0,
											0,
											0,
											0,
											NULL,
											pData->hInstance,
											NULL);

		//Alert we are done
		pData->pEvent->Set();

		//Check we have this window 
		if (pData->hWindowHandle)
		{
			//Run a message map
			MSG msg;

			while (GetMessage(&msg,
							  NULL,
							  0,
							  0))
			{
				//Translate and dispatch
				TranslateMessage(&msg);

				//Check if it's a timer
				if (msg.message==WM_TIMER)
				{
					//Lock the CS
					CCriticalAutoRelease aRelease(pData->pCSection);

					//Check is it our timer
					TOMap::iterator aTheIterator;
					aTheIterator=pData->pMap.find(msg.wParam);
			
					//Check if we have it
					if (aTheIterator!=pData->pMap.end())
					{
						//Found it
						TimeoutData aData;
						aData=aTheIterator->second;

						//Do we need to delete it
						if (aData.bClearTimeout)
						{
							//Delete it
							KillTimer(pData->hWindowHandle,
									  msg.wParam);

							//Do we have the data to reset ?
							if (aData.pTimer)
								memset(aData.pTimer,
									   0,
									   sizeof(TimerID));

							//Erase the timer
							pData->pMap.erase(aTheIterator);

							//Decrease the count
							--pData->iTimeoutCount;
						}

						//Exit the CS
						aRelease.Exit();

						//Protect it
						try
						{
							//Dispatch the data
							(*(aData.pTimeoutProc))(aData.pData);
						}
						ERROR_HANDLER_STATIC(CSocketThreadManager_Class,"SocketThread - Proc")
					}
					else
					{
						//Release the data
						aRelease.Exit();

						//Dispatch the message
						pData->pClass->ParseDispatchMessage(msg,
															pData);
					}
				}
开发者ID:vit2000005,项目名称:happy_trader,代码行数:100,代码来源:SocketThreadManager.cpp


示例16: MMDevApiMsgProc

static DWORD CALLBACK MMDevApiMsgProc(void *ptr)
{
    ThreadRequest *req = ptr;
    IMMDeviceEnumerator *Enumerator;
    ALuint deviceCount = 0;
    MMDevApiData *data;
    ALCdevice *device;
    HRESULT hr, cohr;
    MSG msg;

    TRACE("Starting message thread\n");

    cohr = CoInitialize(NULL);
    if(FAILED(cohr))
    {
        WARN("Failed to initialize COM: 0x%08lx\n", cohr);
        req->result = cohr;
        SetEvent(req->FinishedEvt);
        return 0;
    }

    hr = CoCreateInstance(&CLSID_MMDeviceEnumerator, NULL, CLSCTX_INPROC_SERVER, &IID_IMMDeviceEnumerator, &ptr);
    if(FAILED(hr))
    {
        WARN("Failed to create IMMDeviceEnumerator instance: 0x%08lx\n", hr);
        CoUninitialize();
        req->result = hr;
        SetEvent(req->FinishedEvt);
        return 0;
    }
    Enumerator = ptr;
    IMMDeviceEnumerator_Release(Enumerator);
    Enumerator = NULL;

    CoUninitialize();

    req->result = S_OK;
    SetEvent(req->FinishedEvt);

    TRACE("Starting message loop\n");
    while(GetMessage(&msg, NULL, 0, 0))
    {
        TRACE("Got message %u\n", msg.message);
        switch(msg.message)
        {
        case WM_USER_OpenDevice:
            req = (ThreadRequest*)msg.wParam;
            device = (ALCdevice*)msg.lParam;
            data = device->ExtraData;

            hr = cohr = S_OK;
            if(++deviceCount == 1)
                hr = cohr = CoInitialize(NULL);
            if(SUCCEEDED(hr))
                hr = CoCreateInstance(&CLSID_MMDeviceEnumerator, NULL, CLSCTX_INPROC_SERVER, &IID_IMMDeviceEnumerator, &ptr);
            if(SUCCEEDED(hr))
            {
                Enumerator = ptr;
                if(!data->devid)
                    hr = IMMDeviceEnumerator_GetDefaultAudioEndpoint(Enumerator, eRender, eMultimedia, &data->mmdev);
                else
                    hr = IMMDeviceEnumerator_GetDevice(Enumerator, data->devid, &data->mmdev);
                IMMDeviceEnumerator_Release(Enumerator);
                Enumerator = NULL;
            }
            if(SUCCEEDED(hr))
                hr = IMMDevice_Activate(data->mmdev, &IID_IAudioClient, CLSCTX_INPROC_SERVER, NULL, &ptr);
            if(SUCCEEDED(hr))
            {
                data->client = ptr;
                device->DeviceName = get_device_name(data->mmdev);
            }

            if(FAILED(hr))
            {
                if(data->mmdev)
                    IMMDevice_Release(data->mmdev);
                data->mmdev = NULL;
                if(--deviceCount == 0 && SUCCEEDED(cohr))
                    CoUninitialize();
            }

            req->result = hr;
            SetEvent(req->FinishedEvt);
            continue;

        case WM_USER_ResetDevice:
            req = (ThreadRequest*)msg.wParam;
            device = (ALCdevice*)msg.lParam;

            req->result = DoReset(device);
            SetEvent(req->FinishedEvt);
            continue;

        case WM_USER_StartDevice:
            req = (ThreadRequest*)msg.wParam;
            device = (ALCdevice*)msg.lParam;
            data = device->ExtraData;

            ResetEvent(data->NotifyEvent);
//.........这里部分代码省略.........
开发者ID:jims,项目名称:openal-soft,代码行数:101,代码来源:mmdevapi.c


示例17: TrackPopup

void TrackPopup(duComboBox *pComboBox, HWND hwndOwner, HWND hwndListBox)
{
	POINT pt;
	MSG  msg;
	HWND hwndActive = NULL;

	while (GetMessage(&msg, NULL, 0, 0))
	{
		if (pComboBox->IsEnd())
			break;

		hwndActive = GetActiveWindow();
		if (hwndActive != hwndOwner)
			break;

		switch (msg.message) {

		case WM_MOUSEMOVE:
		case WM_LBUTTONDOWN:
		case WM_LBUTTONUP:
		case WM_LBUTTONDBLCLK:
		case WM_RBUTTONDOWN:
		case WM_RBUTTONUP:
		case WM_RBUTTONDBLCLK:
		case WM_MBUTTONDOWN:
		case WM_MBUTTONUP:
		case WM_MBUTTONDBLCLK:
			pt.x = (short)LOWORD(msg.lParam);
			pt.y = (short)HIWORD(msg.lParam);
			MapWindowPoints(msg.hwnd, hwndListBox, &pt, 1);
			msg.lParam = MAKELPARAM(pt.x, pt.y);
			msg.hwnd = hwndListBox;
			break;

		case WM_MOUSEWHEEL:
			msg.hwnd = hwndListBox;
			break;

		case WM_NCMOUSEMOVE:
			msg.hwnd = hwndListBox;
			break;

		case WM_NCLBUTTONDOWN:
		case WM_NCLBUTTONUP:
		case WM_NCLBUTTONDBLCLK:
		case WM_NCRBUTTONDOWN:
		case WM_NCRBUTTONUP:
		case WM_NCRBUTTONDBLCLK:
		case WM_NCMBUTTONDOWN:
		case WM_NCMBUTTONUP:
		case WM_NCMBUTTONDBLCLK:
			::DestroyWindow(hwndListBox);
			return;

		case WM_KEYDOWN:
		case WM_KEYUP:
		case WM_CHAR:
		case WM_DEADCHAR:
		case WM_SYSKEYDOWN:
		case WM_SYSKEYUP:
		case WM_SYSCHAR:
		case WM_SYSDEADCHAR:
			msg.hwnd = hwndListBox;
			break;
		}

		TranslateMessage(&msg);
		DispatchMessage(&msg);

		if (pComboBox->IsEnd())
			break;

		hwndActive = GetActiveWindow();
		if (hwndActive != hwndOwner) 
			break;
	}

	::DestroyWindow(hwndListBox);

	if (msg.message == WM_QUIT) {
		PostQuitMessage((int)msg.wParam);
	}
}
开发者ID:tantaishan,项目名称:MyEcho,代码行数:83,代码来源:duComboBox.cpp


示例18: _tWinMain

int APIENTRY _tWinMain(HINSTANCE hInstance,
                       HINSTANCE hPrevInstance,
                       LPTSTR    lpCmdLine,
                       int       nCmdShow)
{
    UNREFERENCED_PARAMETER(hPrevInstance);
    UNREFERENCED_PARAMETER(lpCmdLine);
    UNREFERENCED_PARAMETER(nCmdShow);

    SetDllDirectory(L"");
    ::OleInitialize(NULL);

    // we need some of the common controls
    INITCOMMONCONTROLSEX icex;
    icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
    icex.dwICC = ICC_LINK_CLASS|ICC_LISTVIEW_CLASSES|ICC_PAGESCROLLER_CLASS
        |ICC_PROGRESS_CLASS|ICC_STANDARD_CLASSES|ICC_TAB_CLASSES|ICC_TREEVIEW_CLASSES
        |ICC_UPDOWN_CLASS|ICC_USEREX_CLASSES|ICC_WIN95_CLASSES;
    InitCommonControlsEx(&icex);

    apr_initialize();
    setlocale(LC_ALL, "");
    // to avoid that SASL will look for and load its plugin dlls all around the
    // system, we set the path here.
    // Note that SASL doesn't have to be initialized yet for this to work
    sasl_set_path(SASL_PATH_TYPE_PLUGIN, (LPSTR)(LPCSTR)CUnicodeUtils::StdGetUTF8(CAppUtils::GetAppDirectory()).c_str());

    // first create a hidden window which serves as our main window for receiving
    // the window messages, starts the monitoring thread and handles the icon
    // in the tray area.

    MSG msg;
    msg.wParam = FALSE;
    HACCEL hAccelTable;

    hInst = hInstance;

    INITCOMMONCONTROLSEX used = {
        sizeof(INITCOMMONCONTROLSEX),
        ICC_BAR_CLASSES
    };
    InitCommonControlsEx(&used);

    Snarl::SnarlInterface snarlIface;
    CCmdLineParser parser(lpCmdLine);
    if (parser.HasKey(_T("patchfile")))
    {
        hAccelTable = LoadAccelerators(hInst, MAKEINTRESOURCE(IDC_CMVIEWER));
        // in this case, we start another part of our application, not
        // the monitoring part.
        CDiffViewer viewer(hInst);
        if (parser.HasVal(_T("title")))
            viewer.SetTitle(parser.GetVal(_T("title")));
        if (viewer.RegisterAndCreateWindow())
        {
            if (viewer.LoadFile(parser.GetVal(_T("patchfile"))))
            {
                ::ShowWindow(viewer.GetHWNDEdit(), SW_SHOW);
                ::SetFocus(viewer.GetHWNDEdit());

                // Main message loop:
                while (GetMessage(&msg, NULL, 0, 0))
                {
                    if (!TranslateAccelerator(viewer, hAccelTable, &msg))
                    {
                        TranslateMessage(&msg);
                        DispatchMessage(&msg);
                    }
                }
            }
        }
    }
    else
    {
        //only one instance of this application part allowed
        g_mutex = ::CreateMutex(NULL, FALSE, APPNAME_MUTEX);

        if (g_mutex != NULL)
        {
            if ((::GetLastError()==ERROR_ALREADY_EXISTS)&&(!parser.HasKey(_T("task"))))
            {
                //an instance of this app is already running
                HWND hWnd = FindWindow(ResString(hInst, IDS_APP_TITLE), NULL);      //try finding the running instance of this app
                if (hWnd)
                {
                    UINT COMMITMONITOR_SHOWDLGMSG = RegisterWindowMessage(_T("CommitMonitor_ShowDlgMsg"));
                    PostMessage(hWnd, COMMITMONITOR_SHOWDLGMSG ,0 ,0);              //open the window of the already running app
                    SetForegroundWindow(hWnd);                                      //set the window to front
                }
                apr_terminate();
                return FALSE;
            }
        }

        CHiddenWindow hiddenWindow(hInst);

        hAccelTable = LoadAccelerators(hInst, MAKEINTRESOURCE(IDC_COMMITMONITOR));

        if (hiddenWindow.RegisterAndCreateWindow())
        {
//.........这里部分代码省略.........
开发者ID:CalciferLorain,项目名称:CommitMonitor,代码行数:101,代码来源:CommitMonitor.cpp



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GetMessagePos函数代码示例发布时间:2022-05-30
下一篇:
C++ GetMesh函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap