/*resource.h*/ #define IDM_OPEN 100 #define IDM_PLAY 200 #define IDM_REVERSE 201 #define IDM_STOP 202 #define IDM_END 203 #define IDM_PAUSE 204 #define IDM_RESUME 205
/*リソーススクリプト*/ #include "resource.h" KITTY MENU { POPUP "File(&F)" { MENUITEM "Open(&O)" , IDM_OPEN } POPUP "Play(&P)" { MENUITEM "Play(&P)" , IDM_PLAY MENUITEM "Reverse(&B)" , IDM_REVERSE MENUITEM "Stop(&S)" , IDM_STOP MENUITEM "To End(&E)" , IDM_END MENUITEM "Pause(&A)" , IDM_PAUSE MENUITEM "Resume(&R)" , IDM_RESUME } }
#include <windows.h> #include <vfw.h> #include "resource.h" #define TITLE TEXT("Kitty on your lap") LRESULT CALLBACK WndProc(HWND hWnd , UINT msg , WPARAM wp , LPARAM lp) { static HWND hMCI; static OPENFILENAME ofn; static TCHAR strFile[MAX_PATH]; switch (msg) { case WM_DESTROY: MCIWndDestroy(hMCI); PostQuitMessage(0); return 0; case WM_CREATE: ofn.lStructSize = sizeof (OPENFILENAME); ofn.hwndOwner = hWnd; ofn.lpstrFilter = TEXT("Mdia File \0*.avi;*.mpg;*.wav\0"); ofn.nMaxCustFilter = 256; ofn.nFilterIndex = 0; ofn.lpstrFile = strFile; ofn.nMaxFile = MAX_PATH; ofn.Flags = OFN_FILEMUSTEXIST; hMCI = MCIWndCreate(hWnd , ((LPCREATESTRUCT)lp)->hInstance , WS_CHILD | WS_VISIBLE | MCIWNDF_NOPLAYBAR , NULL); return 0; case WM_COMMAND: switch (LOWORD(wp)) { case IDM_OPEN: if (GetOpenFileName(&ofn)) { MCIWndClose(hMCI); MCIWndOpen(hMCI , strFile , 0); } break; case IDM_PLAY: MCIWndPlay(hMCI); break; case IDM_REVERSE: MCIWndPlayReverse(hMCI); break; case IDM_STOP: MCIWndStop(hMCI); MCIWndHome(hMCI); break; case IDM_END: MCIWndEnd(hMCI); break; case IDM_PAUSE: MCIWndPause(hMCI); break; case IDM_RESUME: MCIWndResume(hMCI); break; } return 0; } return DefWindowProc(hWnd , msg , wp , lp); } int WINAPI WinMain(HINSTANCE hInstance , HINSTANCE hPrevInstance , PSTR lpCmdLine , int nCmdShow ) { HWND hWnd; MSG msg; WNDCLASS winc; winc.style = CS_HREDRAW | CS_VREDRAW; winc.lpfnWndProc = WndProc; winc.cbClsExtra = winc.cbWndExtra = 0; winc.hInstance = hInstance; winc.hIcon = LoadIcon(NULL , IDI_APPLICATION); winc.hCursor = LoadCursor(NULL , IDC_ARROW); winc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH); winc.lpszMenuName = TEXT("KITTY"); winc.lpszClassName = TEXT("KITTY"); if (!RegisterClass(&winc)) return -1; hWnd = CreateWindow( TEXT("KITTY") , TITLE , WS_OVERLAPPEDWINDOW | WS_VISIBLE , CW_USEDEFAULT , CW_USEDEFAULT , CW_USEDEFAULT , CW_USEDEFAULT , NULL , NULL , hInstance , NULL ); if (hWnd == NULL) return -1; while(GetMessage(&msg , NULL , 0 , 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } return msg.wParam; }
PSゲーム「ひざの上の同居人〜Kitty on your lap〜」より ©KANEKO, アストロビジョン, CULTURE PUBLISHERS ジーク猫耳! |