Example #1
0
void CAccelerator::Shutdown()
{
	if (m_hAccel) {
		DestroyAcceleratorTable(m_hAccel);
		m_hAccel = NULL;
	}
}
Example #2
0
CMainWindow::~CMainWindow()
{
	m_virtualMachine.Pause();

	m_virtualMachine.DestroyPadHandler();
	m_virtualMachine.DestroyGSHandler();

#ifdef DEBUGGER_INCLUDED
	m_frameDebugger.reset();
	m_debugger.reset();
#endif

	DELETEPTR(m_outputWnd);
	DELETEPTR(m_statusBar);

	DestroyAcceleratorTable(m_accTable);

	if(m_recordingAvi)
	{
		m_aviStream.Close();
		m_recordingAvi = false;
	}

	CloseHandle(m_recordAviMutex);
	m_recordAviMutex = NULL;

	m_virtualMachine.Destroy();
}
Example #3
0
void SingleFace::UninitInstance()
{
    // Clean up the memory allocated for Face Tracking and rendering.
    m_FTHelper.Stop();

    if (m_hAccelTable)
    {
        DestroyAcceleratorTable(m_hAccelTable);
        m_hAccelTable = NULL;
    }

    DestroyWindow(m_hWnd);
    m_hWnd = NULL;

    if (m_pImageBuffer)
    {
        m_pImageBuffer->Release();
        m_pImageBuffer = NULL;
    }

    if (m_pVideoBuffer)
    {
        m_pVideoBuffer->Release();
        m_pVideoBuffer = NULL;
    }
}
Example #4
0
/*
================
rvDebuggerApp::~rvDebuggerApp
================
*/
rvDebuggerApp::~rvDebuggerApp ( )
{
	if ( mAccelerators )
	{
		DestroyAcceleratorTable ( mAccelerators );
	}
}
Example #5
0
void WinKillOsThread ()
{
	if (ghOSThreadHandle != NULL)
	{
		TerminateThread (ghOSThreadHandle, 0);
		ghOSThreadHandle = NULL;

		/* CleanUp */
		if (gAcceleratorTable)
			DestroyAcceleratorTable (gAcceleratorTable);
		DeleteCursors ();
		CloseHandle (gOS_DONE);
		gOS_DONE = NULL;
		CloseHandle (gCLEAN_DONE);
		gCLEAN_DONE = NULL;
		if (gDlogFont != NULL)
			DeleteObject (gDlogFont);

		DeleteObject (gControlFont);	// The global logical font must be deleted.
		if (gCrossCallProcedureTable)
			FreeCrossCallProcedureTable (gCrossCallProcedureTable);
	};
// MW...
	ghMainWindow = NULL;
// ... MW
}	/* WinKillOsThread*/
Example #6
0
INT APIENTRY wWinMain (HINSTANCE, HINSTANCE, LPWSTR, INT)
{
	MSG msg = {0};

	if (app.CreateMainWindow (IDD_MAIN, IDI_MAIN, &DlgProc))
	{
		const HACCEL haccel = LoadAccelerators (app.GetHINSTANCE (), MAKEINTRESOURCE (IDA_MAIN));

		if (haccel)
		{
			while (GetMessage (&msg, nullptr, 0, 0) > 0)
			{
				TranslateAccelerator (app.GetHWND (), haccel, &msg);

				if (!IsDialogMessage (app.GetHWND (), &msg))
				{
					TranslateMessage (&msg);
					DispatchMessage (&msg);
				}
			}

			DestroyAcceleratorTable (haccel);
		}
	}

	return (INT)msg.wParam;
}
CHtmlPanelUIHandlerBase::~CHtmlPanelUIHandlerBase()
{
  if (m_blockedAcceleratorsTable)
  {
    DestroyAcceleratorTable(m_blockedAcceleratorsTable);
  }
}
Example #8
0
static int AppExit()
{
	SetNumLock(bNumlockStatus);

	DrvExit();						// Make sure any game driver is exitted
	FreeROMInfo();
	MediaExit();
	BurnLibExit();					// Exit the Burn library

#ifdef USE_SDL
	SDL_Quit();
#endif

	kailleraShutdown();

	FBALocaliseExit();

	if (hAccel) {
		DestroyAcceleratorTable(hAccel);
		hAccel = NULL;
	}

	SplashDestroy(1);

	CloseHandle(hMainThread);

	CloseDebugLog();

	return 0;
}
Example #9
0
static int AppExit()
{
	if(bIconsLoaded) {
		// unload driver icons
		UnloadDrvIcons();
		bIconsLoaded = 0;
	}

	SetNumLock(bNumlockStatus);

	DrvExit();						// Make sure any game driver is exitted
	FreeROMInfo();
	MediaExit();
	BurnLibExit();					// Exit the Burn library

#ifdef USE_SDL
	SDL_Quit();
#endif

	FBALocaliseExit();

	if (hAccel) {
		DestroyAcceleratorTable(hAccel);
		hAccel = NULL;
	}

	SplashDestroy(1);

	CloseHandle(hMainThread);

	CloseDebugLog();

	return 0;
}
Example #10
0
void fungshuei() {
	HBITMAP bmp;
	// Allocating 5000 Bitmaps of size 0xf80 leaving 0x80 space at end of page.
	for (int k = 0; k < 5000; k++) {
		//bmp = CreateBitmap(1685, 2, 1, 8, NULL); //800 = 0x8b0 820 = 0x8e0 1730 = 0x1000 1700 = 0xfc0 1670 = 0xf70
		bmp = CreateBitmap(1670, 2, 1, 8, NULL);										 // 1680  = 0xf80 1685 = 0xf90 allocation size 0xfa0
		bitmaps[k] = bmp;
	}

	HACCEL hAccel, hAccel2;
	LPACCEL lpAccel;
	// Initial setup for pool fengshui.  
	lpAccel = (LPACCEL)malloc(sizeof(ACCEL));
	SecureZeroMemory(lpAccel, sizeof(ACCEL));
 	// Allocating  7000 accelerator tables of size 0x40 0x40 *2 = 0x80 filling in the space at end of page.
	HACCEL *pAccels = (HACCEL *)malloc(sizeof(HACCEL) * 7000);
	HACCEL *pAccels2 = (HACCEL *)malloc(sizeof(HACCEL) * 7000);
	for (INT i = 0; i < 7000; i++) {
		hAccel = CreateAcceleratorTableA(lpAccel, 1);
		hAccel2 = CreateAcceleratorTableW(lpAccel, 1);
		pAccels[i] = hAccel;
		pAccels2[i] = hAccel2;
	}
	// Delete the allocated bitmaps to free space at beiginig of pages
	for (int k = 0; k < 5000; k++) {
		DeleteObject(bitmaps[k]);
	}
	//allocate Gh04 5000 region objects of size 0xbc0 which will reuse the free-ed bitmaps memory.
	for (int k = 0; k < 5000; k++) {
		CreateEllipticRgn(0x79, 0x79, 1, 1); //size = 0xbc0
	}
	// Allocate Gh05 5000 bitmaps which would be adjacent to the Gh04 objects previously allocated
	for (int k = 0; k < 5000; k++) {
		bmp = CreateBitmap(0x52, 1, 1, 32, NULL); //size  = 3c0
		bitmaps[k] = bmp;
	}
	// Allocate 17500 clipboard objects of size 0x60 to fill any free memory locations of size 0x60
	for (int k = 0; k < 1700; k++) { //1500
		AllocateClipBoard2(0x30);
	}
	// delete 2000 of the allocated accelerator tables to make holes at the end of the page in our spray.
	for (int k = 2000; k < 4000; k++) {
		DestroyAcceleratorTable(pAccels[k]);
		DestroyAcceleratorTable(pAccels2[k]);
	}
	
}
Example #11
0
CPopupFrame::~CPopupFrame()
{
	if (m_hAccelTable != NULL)
	{
		DestroyAcceleratorTable(m_hAccelTable);
		m_hAccelTable = NULL;
	}
}
Example #12
0
void CRunView::PictureClose(LPCTSTR lpszPicture)
{
	m_bLockMenu = TRUE;

	if (m_hAccelTable != NULL)
	{
		DestroyAcceleratorTable(m_hAccelTable);
		m_hAccelTable = NULL;
	}
}
void
CNdasDevicePropGeneralPage::OnReset()
{
	ATLTRACE(__FUNCTION__ "\n");

	ATLVERIFY(AtlWaitWithMessageLoop(m_ThreadCompleted));

	ATLVERIFY(m_imageList.Destroy());
	ATLVERIFY(DestroyAcceleratorTable(m_hAccel));
}
Example #14
0
CRunView::~CRunView()
{
	if (m_hAccelTable != NULL)
	{
		DestroyAcceleratorTable(m_hAccelTable);
		m_hAccelTable = NULL;
	}
	
//	if (m_pBrowserApp != NULL)
//		m_pBrowserApp->Release();
}
Example #15
0
void CMainMenu::RebuildAccelerators(void)
{
	CGuard Guard(m_CS);

	//Delete the old accel list
	WriteTrace(TraceDebug,__FUNCTION__ ": Start");

	HACCEL m_OldAccelTable = (HACCEL)m_AccelTable;
	m_AccelTable = m_ShortCuts.GetAcceleratorTable();
	if (m_OldAccelTable) { 
		DestroyAcceleratorTable(m_OldAccelTable);
	}
	WriteTrace(TraceDebug,__FUNCTION__ ": Done");
}
Example #16
0
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPreInst, LPSTR pCmdLine, int nCmdShow)
{
	MSG msg;
	WNDCLASS wndclass = {
		0,
		WndProc,
		0,
		0,
		hInstance,
		LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON1)),
		LoadCursor(0, IDC_ARROW),
		0,
		0,
		szClassName
	};
	RegisterClass(&wndclass);
	hWnd = CreateWindow(
		szClassName,
		TEXT("二角取り"),
		WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU, CW_USEDEFAULT,
		0,
		WINDOW_WIDTH + GetSystemMetrics(SM_CXEDGE) +
		GetSystemMetrics(SM_CXBORDER) +
		GetSystemMetrics(SM_CXDLGFRAME),
		WINDOW_HEIGHT + GetSystemMetrics(SM_CYEDGE) +
		GetSystemMetrics(SM_CYBORDER) +
		GetSystemMetrics(SM_CYDLGFRAME) +
		GetSystemMetrics(SM_CYCAPTION),
		0,
		0,
		hInstance,
		0);
	ShowWindow(hWnd, SW_SHOWDEFAULT);
	UpdateWindow(hWnd);
	ACCEL Accel[] = {
		{ FVIRTKEY, VK_F2, ID_NEWGAME },
		{ FVIRTKEY, VK_F1, ID_HINT }
	};
	HACCEL hAccel = CreateAcceleratorTable(Accel, 2);
	while (GetMessage(&msg, 0, 0, 0))
	{
		if (!TranslateAccelerator(hWnd, hAccel, &msg))
		{
			TranslateMessage(&msg);
			DispatchMessage(&msg);
		}
	}
	DestroyAcceleratorTable(hAccel);
	return msg.wParam;
}
Example #17
0
void __cdecl InterfaceThread(void *unused)
{
	WNDCLASS main_class;
	MSG msg;
	HACCEL hAccel;
	
	main_class.style = CS_HREDRAW | CS_VREDRAW;
	main_class.lpfnWndProc = InterfaceWindowProc;
	main_class.cbClsExtra = 0;
	main_class.cbWndExtra = DLGWINDOWEXTRA;
	main_class.hInstance = hInst;
	main_class.hIcon = LoadIcon(hInst,MAKEINTRESOURCE(IDI_MAIN));
	main_class.hCursor = NULL;
	main_class.hbrBackground = (HBRUSH) GetStockObject(LTGRAY_BRUSH);
	main_class.lpszMenuName = NULL;
	main_class.lpszClassName = "blakserv";
	
	RegisterClass(&main_class);
	
	InitCommonControls();

   LoadLibrary("riched20.dll");

	hwndMain = CreateDialog(hInst,MAKEINTRESOURCE(IDD_MAIN_DLG),0,NULL);
	
	InterfaceSetup();
	InterfaceCreateTabControl(hwndMain);
	InterfaceCreateListControl();
	
	ShowWindow(hwndMain,window_display);
	
	/* the main thread is waiting for our window to be created--tell it we're ready */
	SetEvent(hEvent);
	
	hAccel = LoadAccelerators(hInst,MAKEINTRESOURCE(IDR_ACCELERATOR));
	
	
	while (GetMessage(&msg,NULL,0,0))
	{
		if (!TranslateAccelerator(hwndMain,hAccel,&msg))
		{
			TranslateMessage(&msg);
			DispatchMessage(&msg);
		}
	}
	
	DestroyAcceleratorTable(hAccel);
	
	_endthread();
}
BOOL CPPageAccelTbl::OnApply()
{
	AfxGetMyApp()->UnregisterHotkeys();
	UpdateData();

	AppSettings& s = AfxGetAppSettings();

	s.wmcmds.RemoveAll();
	s.wmcmds.AddTail(&m_wmcmds);

	CAtlArray<ACCEL> pAccel;
	pAccel.SetCount(m_wmcmds.GetCount());
	POSITION pos = m_wmcmds.GetHeadPosition();
	for (int i = 0; pos; i++) {
		pAccel[i] = m_wmcmds.GetNext(pos);
	}
	if (s.hAccel) {
		DestroyAcceleratorTable(s.hAccel);
	}
	s.hAccel = CreateAcceleratorTable(pAccel.GetData(), pAccel.GetCount());

	GetParentFrame()->m_hAccelTable = s.hAccel;

	s.fWinLirc = !!m_fWinLirc;
	s.strWinLircAddr = m_WinLircAddr;
	if (s.fWinLirc) {
		s.WinLircClient.Connect(m_WinLircAddr);
	}
	s.fUIce = !!m_fUIce;
	s.strUIceAddr = m_UIceAddr;
	if (s.fUIce) {
		s.UIceClient.Connect(m_UIceAddr);
	}
	s.fGlobalMedia = !!m_fGlobalMedia;

	AfxGetMyApp()->RegisterHotkeys();

	s.AccelTblColWidth.bEnable = true;
	s.AccelTblColWidth.cmd		= m_list.GetColumnWidth(COL_CMD);
	s.AccelTblColWidth.key		= m_list.GetColumnWidth(COL_KEY);
	s.AccelTblColWidth.id		= m_list.GetColumnWidth(COL_ID);
	s.AccelTblColWidth.mwnd		= m_list.GetColumnWidth(COL_MOUSE);
	s.AccelTblColWidth.mfs		= m_list.GetColumnWidth(COL_MOUSE_FS);
	s.AccelTblColWidth.appcmd	= m_list.GetColumnWidth(COL_APPCMD);
	s.AccelTblColWidth.remcmd	= m_list.GetColumnWidth(COL_RMCMD);
	s.AccelTblColWidth.repcnt	= m_list.GetColumnWidth(COL_RMREPCNT);

	return __super::OnApply();
}
INT_PTR FileTestDialog(HWND hParent, TFileTestData * pData)
{
    HACCEL hAccelTable = LoadAccelerators(g_hInst, MAKEINTRESOURCE(IDR_ACCELERATORS));
    HWND hDlg;
    MSG msg;

    // Create the property sheet
    pData->bEnableResizing = TRUE;
    hDlg = CreateDialogParam(g_hInst,
                             MAKEINTRESOURCE(IDD_FILE_TEST),
                             hParent,
                             DialogProc,
                             (LPARAM)pData);
    
    // Perform the modal loop
    if(hDlg != NULL)
    {
        // Show the dialog
        ShowWindow(hDlg, SW_SHOW);

        // Get the message. Stop processing if WM_QUIT has arrived
        while(IsWindow(hDlg) && GetMessage(&msg, NULL, 0, 0))
        {
            // We need an alertable sleep to make APCs to work.
            // Uncomment this if you want to use the asynchronous "ApcRoutine"
            // parameter(s) in some native API
//          MsgWaitForMultipleObjectsEx(0,
//                                      NULL,
//                                      INFINITE,
//                                      QS_ALLEVENTS | QS_ALLINPUT | QS_ALLPOSTMESSAGE,
//                                      MWMO_WAITALL | MWMO_ALERTABLE | MWMO_INPUTAVAILABLE);

            if(!IsMyDialogMessage(hDlg, &msg))
            {
                // Process the accelerator table
                if(!TranslateAccelerator(hDlg, hAccelTable, &msg))
                {
                    TranslateMessage(&msg);
                    DispatchMessage(&msg);
                }
            }
        }
    }

    if(hAccelTable != NULL)
        DestroyAcceleratorTable(hAccelTable);
    return IDOK;
}
Example #20
0
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPreInst, LPSTR pCmdLine, int nCmdShow)
{
	MSG msg;
	WNDCLASS wndclass = {
		CS_HREDRAW | CS_VREDRAW,
		WndProc,
		0,
		DLGWINDOWEXTRA,
		hInstance,
		0,
		LoadCursor(0, IDC_ARROW),
		(HBRUSH)(COLOR_WINDOW + 1),
		0,
		szClassName
	};
	RegisterClass(&wndclass);
	HWND hWnd = CreateWindow(
		szClassName,
		TEXT("Calc SHA-1"),
		WS_OVERLAPPEDWINDOW,
		CW_USEDEFAULT,
		0,
		CW_USEDEFAULT,
		0,
		0,
		0,
		hInstance,
		0
		);
	ShowWindow(hWnd, SW_SHOWDEFAULT);
	UpdateWindow(hWnd);
	ACCEL Accel[] = { { FVIRTKEY, VK_DELETE, ID_DELETE },
	{ FVIRTKEY | FCONTROL, 'A', ID_SELECTALL },
	{ FVIRTKEY | FCONTROL, 'C', ID_COPYTOCLIPBOARD },
	};
	HACCEL hAccel = CreateAcceleratorTable(Accel, sizeof(Accel) / sizeof(ACCEL));
	while (GetMessage(&msg, 0, 0, 0))
	{
		if (!TranslateAccelerator(hWnd, hAccel, &msg) && !IsDialogMessage(hWnd, &msg))
		{
			TranslateMessage(&msg);
			DispatchMessage(&msg);
		}
	}
	DestroyAcceleratorTable(hAccel);
	return msg.wParam;
}
Example #21
0
void CAccelerator::Setup()
{
	// Translate key table -> windows accelerator table

	if (m_hAccel) {
		DestroyAcceleratorTable(m_hAccel);
		m_hAccel = NULL;
	}

	memset(AccelTable, 0, sizeof(ACCEL) * ACCEL_COUNT);

	for (int i = 0; i < ACCEL_COUNT; ++i) {
		AccelTable[i].cmd = EntriesTable[i].id;
		AccelTable[i].fVirt = FVIRTKEY | GetMod(EntriesTable[i].mod);
		AccelTable[i].key = EntriesTable[i].key;
	}

	m_hAccel = CreateAcceleratorTable(AccelTable, ACCEL_COUNT);
}
Example #22
0
int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow)
{
	InitCommonControlsEx(&ICC);
	LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_PATH);

	HACCEL hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDC_APILOG2);
#define MATRIX
#ifdef MATRIX
	TControl::FDefaultBackBrush = CreateSolidBrush(0);
	TControl::FDefaultPen = CreatePen(PS_SOLID, 1, hCol);
	TAppWindow::FWindowClass.hIconSm = LoadIcon(hInstance, (LPCTSTR)IDI_SMALL);
	TAppWindow::FWindowClass.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_APILOG2);
	TControl::FDefaultTextColor = 0x00FF79;
	TGroupBox::FDefaultStyle = 0;

	TCustomGrid::FDefaultTxtColor = mCol;
	TCustomGrid::FDefaultSelTxtColor = 0x00FF79;//0x0FF079;

	TCustomGrid::FDefaultCellsBrush = TControl::FDefaultBackBrush;
	TCustomGrid::FDefaultSelBrush = CreateSolidBrush(hCol);
	TCustomGrid::FDefaultBlurBrush = CreateSolidBrush(0x032C17);
#endif
	HFONT hFont = CreateFontIndirect(&LogFont);
	TProcess * Process = new TProcess(hInstance, 0, nCmdShow, hFont);

    int Result = DefMessageLoop(hAccelTable);
	//DestroyIcon(TAppWindow::FWindowClass.hIconSm);
	//DestroyIcon(TAppWindow::FWindowClass.hIcon);
	DeleteObject(hFont);
#ifdef MATRIX
	DeleteObject(TControl::FDefaultBackBrush);
	DeleteObject(TCustomGrid::FDefaultSelBrush);
	DeleteObject(TControl::FDefaultPen);
#endif

	DestroyAcceleratorTable(hAccelTable);

	_CrtMemDumpAllObjectsSince(0);
    return Result;	
}
Example #23
0
void CAccelerator::Setup()
{
	// Translate key table -> windows accelerator table

	if (m_hAccel) {
		DestroyAcceleratorTable(m_hAccel);
		m_hAccel = NULL;
	}

	m_pAccelTable.clear();		// // //
	for (const auto &x : m_pEntriesTable) {
		ACCEL a;
		a.fVirt = FVIRTKEY | GetMod(x.mod);
		a.key = x.key;
		a.cmd = x.id;
		m_pAccelTable.push_back(a);
	}
	m_hAccel = CreateAcceleratorTable(m_pAccelTable.data(), ACCEL_COUNT);
}
Example #24
0
void configwnd_create()
{
	WNDCLASS wc;
	HWND wnd;
	MSG msg;
	HACCEL acctable = CreateAcceleratorTable((LPACCEL)&c_AccelTable, sizeof(c_AccelTable) / sizeof(ACCEL));
	InitCommonControls();
	wc.cbClsExtra = 0;
	wc.cbWndExtra = 0;
	wc.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1);
	wc.hCursor = LoadCursor(NULL, IDC_ARROW);
	wc.hIcon = LoadIcon(g_hInstance, OPTWND_ICON_NAME);
	wc.hInstance = g_hInstance;
	wc.lpszMenuName = NULL;
	wc.style = CS_PARENTDC | CS_DBLCLKS;
	wc.lpfnWndProc = configwnd_msgproc;
	wc.lpszClassName = OPTWND_CLASS_NAME;
	RegisterClass(&wc);
	g_hFont = CreateFont(-10, 0, 0, 0, FW_NORMAL, 0,
				0, 0, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,
				DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, OPTWND_FONT_NAME);
	wnd = CreateWindowEx(0, OPTWND_CLASS_NAME, OPTWND_WINDOW_NAME, WS_VISIBLE | WS_SYSMENU | WS_OVERLAPPED | DS_SYSMODAL,
			(GetSystemMetrics(SM_CXSCREEN) - OPTWND_WINDOW_WIDTH) / 2,
			(GetSystemMetrics(SM_CYSCREEN) - OPTWND_WINDOW_HEIGHT) / 2,
			OPTWND_WINDOW_WIDTH, OPTWND_WINDOW_HEIGHT, g_hwndOlly, NULL, g_hInstance, NULL);
	ShowWindow(wnd, SW_SHOWNORMAL);
	UpdateWindow(wnd);
	while (GetMessage(&msg, NULL, 0, 0))
	{
		if (!TranslateAccelerator(wnd, acctable, &msg))
		{
			TranslateMessage(&msg);
			DispatchMessage(&msg);
		}
	}
	DeleteObject(g_hFont);
	UnregisterClass(OPTWND_CLASS_NAME, g_hInstance);
	DestroyAcceleratorTable(acctable);
}
Example #25
0
int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
                     _In_opt_ HINSTANCE hPrevInstance,
                     _In_ LPTSTR    lpCmdLine,
                     _In_ int       nCmdShow)
{
	UNREFERENCED_PARAMETER(hPrevInstance);
	UNREFERENCED_PARAMETER(lpCmdLine);

 	// TODO: Place code here.
	MSG msg;
	HACCEL hAccelTable;

	// Initialize global strings
	LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
	LoadString(hInstance, IDC_OSISP1, szWindowClass, MAX_LOADSTRING);
	MyRegisterClass(hInstance);
	MyChildRegisterClass(hInstance);

	// Perform application initialization:
	if (!InitInstance (hInstance, nCmdShow))
	{
		return FALSE;
	}

	hAccelTable = CreateAcceleratorTable(TableAccel(),4);

	// Main message loop:
	while (GetMessage(&msg, NULL, 0, 0))
	{
		if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
		{
			TranslateMessage(&msg);
			DispatchMessage(&msg);
		}
	}
	DestroyAcceleratorTable(hAccelTable);
	return (int) msg.wParam;
}
void MultiFace::UninitInstance()
{
    // Clean up the memory allocated for Face Tracking and rendering.
    m_FTHelper.Stop();

    if (m_hAccelTable)
    {
        DestroyAcceleratorTable(m_hAccelTable);
        m_hAccelTable = NULL;
    }

    DestroyWindow(m_hWnd);
    m_hWnd = NULL;

    if (m_pImageBuffer)
    {
        for (UINT i=0; i<m_nbUsers; i++)
        {
            if (m_pImageBuffer[i])
            {
                m_pImageBuffer[i]->Release();
                m_pImageBuffer[i] = NULL;
            }
        }
        delete[] m_pImageBuffer;
    }

    if (m_pVideoBuffer)
    {
        m_pVideoBuffer->Release();
        m_pVideoBuffer = NULL;
    }

    if (m_eggavatar)
    {
        delete[] m_eggavatar;
    }
}
Example #27
0
static int AppExit()
{

	DrvExit(); // Make sure any game driver is exitted
	MediaExit();
	BurnLibExit(); // Exit the Burn library

	ConfigAppSave(); // Save config for the application

	//ayeye
	if(hAccel!=NULL)
	{
		DestroyAcceleratorTable(hAccel);
		hAccel=NULL;
	}
	if(hImm32!=NULL)
	{
		FreeLibrary(hImm32);
		hImm32=NULL;
	}

	return 0;
}
Example #28
0
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPreInst, LPSTR pCmdLine, int nCmdShow)
{
	MSG msg;
	const WNDCLASS wndclass = { 0, WndProc, 0, 0, hInstance, 0, LoadCursor(0, IDC_ARROW), 0, 0, szClassName };
	RegisterClass(&wndclass);
	RECT rect = { 0, 0, WINDOW_WIDTH, WINDOW_HEIGHT };
	const DWORD dwStyle = WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX;
	AdjustWindowRect(&rect, dwStyle, 0);
	const HWND hWnd = CreateWindow(szClassName, 0, dwStyle, CW_USEDEFAULT, 0, rect.right - rect.left, rect.bottom - rect.top, 0, 0, hInstance, 0);
	ShowWindow(hWnd, SW_SHOWDEFAULT);
	UpdateWindow(hWnd);
	ACCEL Accel[] = { { FVIRTKEY, VK_ESCAPE, ID_EDITSHOW }, { FVIRTKEY | FCONTROL, 'A', ID_SELECTALL } };
	const HACCEL hAccel = CreateAcceleratorTable(Accel, sizeof(Accel) / sizeof(ACCEL));
	BOOL done = 0;
	while (!done)
	{
		if (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
		{
			if (msg.message == WM_QUIT)
			{
				done = TRUE;
			}
			else if (!TranslateAccelerator(hWnd, hAccel, &msg))
			{
				TranslateMessage(&msg);
				DispatchMessage(&msg);
			}
		}
		else if (active)
		{
			DrawGLScene();
			SwapBuffers(hDC);
		}
	}
	DestroyAcceleratorTable(hAccel);
	return msg.wParam;
}
Example #29
0
CProgressDlg::~CProgressDlg()
{
	if (m_hAccel)
		DestroyAcceleratorTable(m_hAccel);
	delete m_pThread;
}
Example #30
0
WPARAM CFidgetApp::Run(void)
{
    HACCEL hAccelTable = LoadAccelerators(m_hInstance, (LPCTSTR)IDC_FIDGET);

    // Main message loop:
    //
    WPARAM iReturn = 0;
    bool bFinished = false;
    while (!bFinished)
    {
        CLinearTimeAbsolute ltaCurrent;
        ltaCurrent.GetUTC();

        // Execute background tasks at specifically scheduled times.
        //
        scheduler.RunTasks(ltaCurrent);
        CLinearTimeAbsolute ltaWakeUp;
        if (!scheduler.WhenNext(&ltaWakeUp))
        {
            ltaWakeUp = ltaCurrent + time_30m;
        }
        else if (ltaWakeUp < ltaCurrent)
        {
            // This is necessary to deal with computer time jumping backwards
            // which can happen when someone sets or resets the computer clock.
            //
            ltaWakeUp = ltaCurrent;
        }

        CLinearTimeDelta ltdTimeOut = ltaWakeUp - ltaCurrent;
        DWORD dwTimeout = ltdTimeOut.ReturnMilliseconds();

        DWORD nHandles = 0;
        DWORD dwObject = MsgWaitForMultipleObjectsEx(nHandles, NULL, dwTimeout, QS_ALLINPUT, 0);
        if (WAIT_OBJECT_0 + nHandles == dwObject)
        {
            for (; !bFinished;)
            {
                // There is at least one new message waiting to be processed.
                //
                MSG msg;
                BOOL bGM = GetMessage(&msg, NULL, 0, 0);
                if (0 == bGM)
                {
                    // WM_QUIT message was received. It is time to terminate
                    // ourselves.
                    //
                    iReturn = msg.wParam;
                    bFinished = true;
                }
                else if (-1 == bGM)
                {
                    // An unexpected problem occured.
                    //
                    bFinished = true;
                }
                else
                {
                    // Translate and dispatch message to Windows Procedure.
                    //
                    if (  (  NULL == m_hwndNewSession
                          || !IsDialogMessage(m_hwndNewSession, &msg))
                       && (  NULL == m_hwndAbout
                          || !IsDialogMessage(m_hwndAbout, &msg))
                       && !TranslateMDISysAccel(g_theApp.m_pMainFrame->m_pMDIControl->m_hwnd, &msg)
                       && !TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
                    {
                        TranslateMessage(&msg);
                        DispatchMessage(&msg);
                    }
                }

                // We must process all messages in the queue before making
                // another MsgWaitForMultipleObjectsEx() call.
                //
                if (!PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE|PM_NOYIELD))
                {
                    break;
                }
            }
        }
        else if (WAIT_TIMEOUT != dwObject)
        {
            // An unexpected event occured.
            //
            bFinished = true;
        }

        // It's time to perform some background task.
        //
    }
    DestroyAcceleratorTable(hAccelTable);
    return iReturn;
}