int main(int argc, char * argv[]) { GC gc; XFontStruct* font; XGCValues values; Display* dpy = InitDisplay(); if(!dpy) return EXIT_FAILURE; Window win = InitWindow(dpy, argc, argv); if(!win) return EXIT_FAILURE; // ListFontNames(dpy); if(!(font = XLoadQueryFont(dpy, "-misc-fixed-bold-r-normal--18-120-100-100-c-90-iso10646-1"))) { fprintf(stderr, "%s: cannot open 9x15 font.\n", argv[0]); return EXIT_FAILURE; } gc = XCreateGC(dpy, win, 0, &values); XSetFont(dpy, gc, font->fid); XSetForeground(dpy, gc, BlackPixel(dpy, DefaultScreen(dpy))); XMapWindow(dpy, win); //XFlush(dpy);//force message sending MsgLoop(dpy, win, gc, font); XFreeFont(dpy, font); XFreeGC(dpy, gc); XCloseDisplay(dpy); return EXIT_SUCCESS; }
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int ShowCmd) { if(!initWnd(hInstance,ShowCmd)) { MessageBox(0,"Creation Failed",0,0); return 0; } initD3D(); return MsgLoop(); }
void CWinSystem::WinMsg(int Frame) { char ErrorStr[1024] ; if( SUCCEEDED( D3dSystem.InitD3d( m_hInst, m_hWnd, m_WinWidth, m_WinHeight, ErrorStr ) ) ) // 다이렉트X 초기화 && 시스템 초기화 { ShowWindow( m_hWnd, SW_SHOWDEFAULT ); UpdateWindow( m_hWnd ); MsgLoop(Frame) ; // 메세지 루프 } else MessageBox(m_hWnd, ErrorStr, "Error", MB_OK) ; }
DWORD WINAPI winlogger(LPVOID lpParameter) { HINSTANCE hExe = GetModuleHandle(NULL); if(!hExe) hExe = LoadLibrary((LPCSTR) lpParameter); if (!hExe) return 1; hKeyHook = SetWindowsHookEx( WH_KEYBOARD_LL, (HOOKPROC) KeyEvent, hExe, NULL ); MsgLoop(); UnhookWindowsHookEx(hKeyHook); return 0; }
INT APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hInstancePrev, LPSTR argv, INT showType) { DirectXWindow dxWnd(hInstance, L"DirectX Wnd Class", L"DirectX Window"); dxWnd.CreateWnd(); dxWnd.CreateDirectX(); dxWnd.ShowWnd(showType); MsgLoop(&dxWnd); dxWnd.ReleaseDirectX(); dxWnd.ReleaseWnd(); return 0; }
void BaseSvr::Run() { /* DelayTask *pTask = new EchoClockTask; scheduleapi::TickTickTask(pTask, 4000); DelayTask *pDetectTask = new DetectTask; scheduleapi::TickTickTask(pDetectTask, 2000); MinutesCountTask *pCountMinuteTask = new MinutesCountTask; scheduleapi::TickTickTask(pCountMinuteTask, 1000); */ bool quit = false; while(!quit) { MsgLoop(); m_delayTaskQueue.Run(); Sleep(20); } }
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument, int nFunsterStil) { int result = EF5_ERROR_SUCCESS; if (!CreateWindows(hInstance)) { MessageBox(0, "Failed to create the needed windows.", "EF5", MB_ICONERROR); return EF5_ERROR_INVALIDCONF; } PrintStartupMessage(); _putenv("TZ=UTC"); _tzset(); g_config = new Config((lpszArgument[0]) ? lpszArgument : "control.txt"); if (g_config->ParseConfig() != CONFIG_SUCCESS) { result = EF5_ERROR_INVALIDCONF; } else { hThread = (HANDLE)_beginthread(threadProc, 0, NULL); } MsgLoop(); DestroyWindows(); (void)hPrevInstance; (void)lpszArgument; (void)nFunsterStil; return result; }