File:  [RetroPC.NET] / np2 / wince / taskmng.cpp
Revision 1.2: download - view: text, annotated - select for diffs
Fri Nov 21 15:51:15 2003 JST (21 years, 11 months ago) by yui
Branches: MAIN
CVS tags: VER_0_82_x64, VER_0_82, VER_0_81A, VER_0_81, VER_0_80, VER_0_79, VER_0_78, VER_0_77, VER_0_76, VER_0_75, VER_0_74, VER_0_73, VER_0_72, HEAD
debuneko- (T.Yui)

#include	"compiler.h"
#include	"taskmng.h"


	BOOL	task_avail = FALSE;


void taskmng_initialize(void) {

	task_avail = TRUE;
}

void taskmng_exit(void) {

	task_avail = FALSE;
}

void taskmng_rol(void) {

	MSG		msg;

	if (task_avail) {
		while(PeekMessage(&msg, 0, 0, 0, PM_NOREMOVE)) {
			if (!GetMessage(&msg, NULL, 0, 0)) {
				task_avail = FALSE;
				break;
			}
			TranslateMessage(&msg);
			DispatchMessage(&msg);
		}
	}
}

#if 0	// → const macro
BOOL taskmng_isavail(void) {

	return(task_avail);
}
#endif

BOOL taskmng_sleep(UINT32 tick) {

	DWORD	base;

	base = GETTICK();
	while((task_avail) && ((GETTICK() - base) < tick)) {
		taskmng_rol();
		Sleep(1);
	}
	return(task_avail);
}

#if defined(WIN32_PLATFORM_PSPC)
void taskmng_minimize(void) {

extern	HWND	hWndMain;
		MSG		msg;

	ShowWindow(hWndMain, SW_MINIMIZE);
	Sleep(500);

	// で 復帰されるまで待つ。
	while(1) {
		if (GetActiveWindow() == hWndMain) {
			break;
		}
		if (!GetMessage(&msg, NULL, 0, 0)) {
			task_avail = FALSE;
			break;
		}
		TranslateMessage(&msg);
		DispatchMessage(&msg);
	}
}
#endif


RetroPC.NET-CVS <cvs@retropc.net>