GLOBALPROC ProgramMain(void) { if (InitEmulation()) { MainEventLoop(); } }
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, PSTR szCmdLine, int iCmdShow) { (void)hInst; (void)hPrev; (void)szCmdLine; (void)iCmdShow; /* Setup a child process to delete this executable when it exits. */ SelfDelete(); /* Create a simple GUI. */ RegisterWindowClass(); MainWindow = CreateWindow(MainWindowClass, MainWindowClass, MainWindowStyle, 0,0,512,512, 0, 0, GetModuleHandle(0), 0); EditWindow = CreateWindow(EditWindowClass, "", EditWindowStyle, 0,0,512,512, MainWindow, 0, GetModuleHandle(0), 0); ShowWindow(MainWindow, SW_SHOW); UpdateWindow(MainWindow); /* Create a thread to read from standard input and write to the window. */ {DWORD threadId; CreateThread(0, 1024, ReadThreadProc, 0, 0, &threadId);} /* Run the event loop until the window is closed. */ MainEventLoop(); return 0; }
void main(void) { OSErr err = noErr; Init(); if (VerifyEnv() && !gDone) { err = NavLoad(); if (err!=noErr) SysBeep(10); // XXX better error handling ShowWindow(gWPtr); MainEventLoop(); } }
main() { Init(); MainEventLoop(); }
/****************************************************************************** Main - Setup the XConnection,request the window list and loop forever Based on main() from FvwmIdent: Copyright 1994, Robert Nation and Nobutaka Suzuki. ******************************************************************************/ int main(int argc, char **argv) { char *temp, *s; #ifdef HAVE_SIGACTION struct sigaction sigact; #endif /* Save the program name for error messages and config parsing */ temp = argv[0]; s=strrchr(argv[0], '/'); if (s != NULL) temp = s + 1; /* Setup my name */ Module = safemalloc(strlen(temp)+2); strcpy(Module,"*"); strcat(Module, temp); Clength = strlen(Module); /* Open the console for messages */ OpenConsole(); if((argc != 6)&&(argc != 7)) { fprintf(stderr,"%s Version %s should only be executed by fvwm!\n",Module, VERSION); ConsoleMessage("%s Version %s should only be executed by fvwm!\n",Module, VERSION); exit(1); } if ((argc==7)&&(!strcasecmp(argv[6],"Transient"))) Transient=1; Fvwm_fd[0] = atoi(argv[1]); Fvwm_fd[1] = atoi(argv[2]); #ifdef HAVE_SIGACTION #ifdef SA_INTERRUPT sigact.sa_flags = SA_INTERRUPT; #else sigact.sa_flags = 0; #endif sigemptyset(&sigact.sa_mask); sigact.sa_handler = TerminateHandler; sigaction(SIGPIPE, &sigact, NULL); sigaction(SIGTERM, &sigact, NULL); #else signal(SIGPIPE, TerminateHandler); signal(SIGTERM, TerminateHandler); #ifdef HAVE_SIGINTERRUPT siginterrupt(SIGPIPE, True); siginterrupt(SIGTERM, True); #endif #endif /* Parse the config file */ ParseConfig(); /* Setup the XConnection */ StartMeUp(); XSetErrorHandler(ErrorHandler); InitPictureCMap(dpy, Root); InitArray(&buttons,0,0,win_width, fontheight+6); InitList(&windows); fd_width = GetFdWidth(); /* Request a list of all windows, * wait for ConfigureWindow packets */ SetMessageMask(Fvwm_fd,M_CONFIGURE_WINDOW | M_RES_CLASS | M_RES_NAME | M_ADD_WINDOW | M_DESTROY_WINDOW | M_ICON_NAME | M_DEICONIFY | M_ICONIFY | M_END_WINDOWLIST | M_NEW_DESK | M_NEW_PAGE | M_FOCUS_CHANGE | M_WINDOW_NAME | #ifdef MINI_ICONS M_MINI_ICON | #endif M_STRING); SendFvwmPipe("Send_WindowList",0); /* Recieve all messages from Fvwm */ atexit(ShutMeDown); MainEventLoop(); return 0; }