application.cpp

来自「SimpleGraphicOperatingSystem 32位图形化操作系统 」· C++ 代码 · 共 58 行

CPP
58
字号
#include <osdef.h>
#include <System.h>
#include <Api.h>	//Sgos api


namespace System{
    static BaseWindow* frmMain;
    static int status;

    Application::Application()
    {
        status = Uninitialized;
    }

	int Application::Run( BaseWindow* form ){
	    frmMain = form;
	    if( !form ) return false;
		form->OnLoad();
		form->Show();
		status = Running;
		while( status == Running ){
			Message msg;
			while( GetMessage(&msg, 1) )
			{
				DispatchMessage( &msg );
			}
		};
	}

    BaseWindow* Application::GetMainForm(){
        return frmMain;
    }

	int Application::DoEvents(){
		Message msg;
		while( GetMessage(&msg, 0) )
		{
			DispatchMessage( &msg );
		}
	}

	int Application::DoEvent(int message){
		Message msg;
		while( GetMessage(&msg, message, 0) )
		{
			DispatchMessage( &msg );
		}
	}

	int Application::Exit(){
	    status = End;
		KExitProcess(0);
	}

}


⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?