Casio PA-2400W Instrukcja Obsługi Strona 23

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 83
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 22
23
Sample program to acquire power-on event notification
#include <windows.h>
static HANDLE hEventOn = NULL;
static HANDLE hThreadOn = NULL ;
DWORD WINAPI OnThread()
{
LONG WaitReturn;
While(1) {
WaitReturn = WaitForSingleObject(hEventon, INFINITE);
If (WaitReturn == WAIT_OBJECT_0) {
MessageBox(NULL, TEXT(“PowerONEvent”), TEXT(“Event”), MB_OK);
}
ResetEvent(hEventOn);
}
return 0;
}
BOOL Initialize()
{
DWORD ThreadIDOn;
hEventOn = CreateEvent(NULL, TRUE, FALSE, TEXT(“PA_OnEvent”));
if( !hEventOn )
{
return(FALSE);
}
hThreadOn = CreateThread(NULL, 0, OnThread, 0, 0, &ThreadIDOn);
if(!hThreadOn)
{
return(FALSE);
}
return(TRUE);
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
if(Initialize() ) {
MessageBox(NULL, TEXT(“Initialize Success”), TEXT(“Initialize”), MB_OK);
While(1) {
Sleep(1000);
}
return(TRUE);
}
else {
MessageBox(NULL, TEXT(“Initialize Error”), TEXT(“Initialize”), MB_OK);
return(FALSE);
}
}
Przeglądanie stron 22
1 2 ... 18 19 20 21 22 23 24 25 26 27 28 ... 82 83

Komentarze do niniejszej Instrukcji

Brak uwag