示例#1
0
// Main Function
int WINAPI _tWinMain(HINSTANCE inst, HINSTANCE prev_inst, LPTSTR cmd_line, int cmd_show)
{
#ifdef _DEBUG
	::_CrtSetDbgFlag( _CRTDBG_LEAK_CHECK_DF | _CRTDBG_ALLOC_MEM_DF );
#endif

	CWinMain main;
	return main.WinMain(inst, prev_inst, cmd_line, cmd_show);
}
示例#2
0
// Main Function
int WINAPI _tWinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPTSTR lpsCmdLine, int nCmdShow)
{
#ifdef _DEBUG
	::_CrtSetDbgFlag( _CRTDBG_LEAK_CHECK_DF | _CRTDBG_ALLOC_MEM_DF );
#endif

	CWinMain main;
	return main.WinMain(hInst, hPrevInst, lpsCmdLine, nCmdShow);
}
/*
обработчик диалогового окна ввода параметров
*/
BOOL __stdcall CWinMain::formulaDialogProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
	CWinMain* wnd = reinterpret_cast<CWinMain*>( GetWindowLong( ::GetParent( hWnd ), GWL_USERDATA ) );

	switch( uMsg ) {
		case WM_INITDIALOG:
			wnd->OnDialogCreate( hWnd );
			return TRUE;
		case WM_COMMAND:
			return wnd->OnFormCommand( wParam, lParam );
		case WM_CLOSE:
			EndDialog( hWnd, 0 );
			DestroyWindow( hWnd );
			wnd->hFormulaForm = 0;
			return TRUE;
		default:
			return FALSE;
	}
}
示例#4
0
文件: main.cpp 项目: wnj-cpp/CWinBase
int WINAPI WinMain (HINSTANCE hThisInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR lpszArgument,
                     int nCmdShow)
{
    //全局变量赋值
    Global::G_Instance = hThisInstance;

    //创建顶级窗口
    CWinMain* mainWind = new CWinMain();
    mainWind->Show(hThisInstance, HWND_DESKTOP);

    //开始消息循环
    MSG messages;
    while (GetMessage (&messages, NULL, 0, 0))
    {
        TranslateMessage(&messages);
        DispatchMessage(&messages);
    }
    return messages.wParam;
}
/*
обработчик главного окна
*/
LRESULT __stdcall CWinMain::windowProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
	if( uMsg == WM_NCCREATE ) {
		SetWindowLong( hWnd, GWL_USERDATA, reinterpret_cast<LONG>( ( reinterpret_cast<CREATESTRUCT*>( lParam ) )->lpCreateParams ) );
	}
	CWinMain* wnd = reinterpret_cast<CWinMain*>( GetWindowLong( hWnd, GWL_USERDATA ) );

	switch( uMsg ) {
		case WM_REDACTOR_OK:
			wnd->TakeFormula();
			return 0;
		case WM_NCCREATE:
			wnd->timer = SetTimer( hWnd, 0, 10, 0 );
			break;
		case WM_CREATE:
			wnd->OnCreate( hWnd );
			return 0;
		case WM_SIZE:
			wnd->ResizeChildrens();
			return 0;
		case WM_DESTROY:
			wnd->OnDestroy();
			return 0;
		case WM_TIMER:
			wnd->Move();
			return 0;
		case WM_COMMAND:
			return wnd->OnCommand( wParam, lParam );
		case WM_KEYDOWN:
			return wnd->OnKeyDown( wParam, lParam );
		case WM_KEYUP:
			return wnd->OnKeyUp( wParam, lParam );
		case WM_MOUSEWHEEL:
			wnd->winPlotter.zoom( static_cast<LONG>( GET_WHEEL_DELTA_WPARAM( wParam ) ) );
			return 0;
	}

	return DefWindowProc( hWnd, uMsg, wParam, lParam );
}