コード例 #1
0
ファイル: graphics_impl.cpp プロジェクト: AltroCoin/altrocoin
int boinc_init_options_graphics_impl(
    BOINC_OPTIONS& opt,
    WORKER_FUNC_PTR _worker_main,
    BOINC_MAIN_STATE* bmsp
) {
    int retval;

    g_bmsp = bmsp;
    retval = g_bmsp->boinc_init_options_general_hook(opt);
    if (retval) return retval;
    if (_worker_main) {
        retval = start_worker_thread(_worker_main, opt);
        if (retval) return retval;
    }
#ifdef _WIN32
    win_graphics_event_loop();
	fprintf(stderr, "Graphics event loop returned\n");
#else
    xwin_graphics_event_loop();
	fprintf(stderr, "Graphics event loop returned\n");
    pthread_exit(0);
#endif

    // normally we never get here
    return 0;
}
コード例 #2
0
ファイル: worker_thread.c プロジェクト: pinchyCZN/DB_UTIL
int terminate_worker_thread()
{
	int result=FALSE;
	if(hworker!=0){
		if(TerminateThread(hworker,0)!=0){
			erase_sql_handles();
			printf("terminated thread %08X\n",hworker);
			start_worker_thread();
			result=TRUE;
		}
	}
	return result;
}
コード例 #3
0
int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow)
{
	MSG msg;
    INITCOMMONCONTROLSEX ctrls;
	HACCEL haccel;
	static char *class_name="DB_UTIL_CLASS";
	int first_instance=TRUE;
	int debug=0;

	first_instance=set_single_instance(TRUE);

	ghinstance=hInstance;
	init_ini_file();

#ifdef _DEBUG
	debug=1;
#else
	get_ini_value("SETTINGS","DEBUG",&debug);
#endif
	if(debug!=0){
		open_console();
	}

	{
		int val=0;
		get_ini_value("SETTINGS","SINGLE_INSTANCE",&val);
		if(val && (!first_instance)){
			COPYDATASTRUCT cd={0};
			HWND hdbutil;
			cd.cbData=nCmdShow;
			cd.cbData=strlen(lpCmdLine)+1;
			cd.lpData=lpCmdLine;
			hdbutil=FindWindow("DB_UTIL_CLASS",NULL);
			if(hdbutil!=0){
				int sw;
				SendMessage(hdbutil,WM_COPYDATA,hInstance,&cd);
				if (IsZoomed(hdbutil))
					sw=SW_MAXIMIZE;
				else if(IsIconic(hdbutil))
					sw=SW_RESTORE;
				else
					sw=SW_SHOW;
				ShowWindow(hdbutil,sw);
				SetForegroundWindow(hdbutil);
			}
			return TRUE;
		}
		set_single_instance(val);
	}
	init_mdi_stuff();

	LoadLibrary("RICHED20.DLL");
	LoadLibrary("Msftedit.dll");

	ctrls.dwSize=sizeof(ctrls);
    ctrls.dwICC = ICC_LISTVIEW_CLASSES|ICC_TREEVIEW_CLASSES|ICC_BAR_CLASSES;
	InitCommonControlsEx(&ctrls);
	
	InitializeCriticalSection(&mutex);

	start_worker_thread();
	start_intellisense_thread();

	setup_mdi_classes(ghinstance);
	
	ghmenu=LoadMenu(hInstance, MAKEINTRESOURCE(IDR_MENU1));
	ghmainframe=create_mainwindow(&WndProc,ghmenu,hInstance,class_name,"DB_UTIL");

	ShowWindow(ghmainframe,nCmdShow);
	UpdateWindow(ghmainframe);

	haccel=LoadAccelerators(ghinstance,MAKEINTRESOURCE(IDR_ACCELERATOR1));

	process_cmd_line(lpCmdLine);

    while(GetMessage(&msg,NULL,0,0)){
		if(!custom_dispatch(&msg))
		if(!TranslateMDISysAccel(ghmdiclient, &msg) && !TranslateAccelerator(ghmainframe,haccel,&msg)){
			TranslateMessage(&msg);
			//if(msg!=WM_MOUSEFIRST&&msg!=WM_NCHITTEST&&msg!=WM_SETCURSOR&&msg!=WM_ENTERIDLE&&msg!=WM_NOTIFY)
			if(FALSE)
			if(msg.message!=0x118&&msg.message!=WM_NCHITTEST&&msg.message!=WM_SETCURSOR&&msg.message!=WM_ENTERIDLE&&msg.message!=WM_NCMOUSEMOVE&&msg.message!=WM_MOUSEFIRST)
			{
				static DWORD tick=0;
				if((GetTickCount()-tick)>500)
					printf("--\n");
				printf("x");
				print_msg(msg.message,msg.lParam,msg.wParam,msg.hwnd);
				tick=GetTickCount();
			}
			DispatchMessage(&msg);
		}
    }
	DeleteCriticalSection(&mutex);
    return msg.wParam;
	
}