【正文】
include void SetClientRect(HWND hwnd, HWND hwndMCI){RECT rect。GetWindowRect(hwndMCI, amp。rect)。AdjustWindowRectEx(amp。rect, GetWindowLong(hwnd, GWL_STYLE), FALSE,GetWindowLong(hwnd, GWL_EXSTYLE))。MoveWindow(hwnd, , , , , TRUE)。}LRESULT CALLBACK WndProc(HWND hwnd, UINT uMsg,WPARAM wParam, LPARAM lParam){ switch(uMsg) { case MCIWNDM_NOTIFYPOS: case MCIWNDM_NOTIFYSIZE: SetClientRect(hwnd, (HWND)wParam)。 break。 case WM_DESTROY: PostQuitMessage(0)。 break。 default: return DefWindowProc(hwnd, uMsg, wParam, lParam)。 } return 0。}int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow){ MSG msg。 HWND hwnd。 WNDCLASS wndClass。 if (hPrevInstance == NULL) { memset(amp。wndClass, 0, sizeof(wndClass))。 = CS_HREDRAW | CS_VREDRAW。 = WndProc。 = hInstance。 = LoadCursor(NULL, IDC_ARROW)。 = (HBRUSH)(COLOR_WINDOW + 1)。 = HELLO。 if (!RegisterClass(amp。wndClass)) return FALSE。 } hwnd = CreateWindow(HELLO, HELLO, WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL)。SetClientRect(hwnd, MCIWndCreate(hwnd, hInstance,WS_VISIBLE|WS_CHILD|MCIWNDF_SHOWALL|MCIWNDF_NOTIFYSIZE|MCIWNDF_NOTIFYPOS, “c:\\”))。ShowWindow(hwnd, nCmdShow)。UpdateWindow(hwnd)。 while (GetMessage(amp。msg, NULL, 0, 0)) DispatchMessage(amp。msg)。 return 。}運(yùn)行時(shí)文件C:\,當(dāng)然,你可以改成其它的文件名。 TestMCI的運(yùn)行結(jié)果該程序非常簡(jiǎn)單,所有的代碼加在一起不超過(guò)60行,其關(guān)鍵部分只有一個(gè)MCIWndCreate函數(shù),細(xì)節(jié)就不介紹了,有興趣的讀者可以參看VC的幫助。 The University of Southern California does not screen or control the content on this website and thus does not guarantee the accuracy, integrity, or quality of such content. All content on this website is provided by and is the sole responsibility of the person from which such content originated, and such content does not necessarily reflect the opinions of the University administration or the Board of Trust