Register window class on mciavi driver loading, and unregister it on

driver unloading.
This commit is contained in:
Dmitry Timoshkov 2004-01-06 20:39:48 +00:00 committed by Alexandre Julliard
parent d81e04a8c0
commit 87af75269d
3 changed files with 28 additions and 14 deletions

View File

@ -140,6 +140,8 @@ static DWORD MCIAVI_drvOpen(LPSTR str, LPMCI_OPEN_DRIVER_PARMSA modp)
/* session instance */
if (!modp) return 0xFFFFFFFF;
if (!MCIAVI_RegisterClass()) return 0;
wma = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WINE_MCIAVI));
if (!wma)
return 0;
@ -169,6 +171,8 @@ static DWORD MCIAVI_drvClose(DWORD dwDevID)
wma = (WINE_MCIAVI*)mciGetDriverData(dwDevID);
if (wma) {
MCIAVI_UnregisterClass();
EnterCriticalSection(&wma->cs);
mciSetDriverData(dwDevID, 0);

View File

@ -103,7 +103,9 @@ LRESULT MCIAVI_PaintFrame(WINE_MCIAVI* wma, HDC hDC);
WINE_MCIAVI* MCIAVI_mciGetOpenDev(UINT wDevID);
DWORD MCIAVI_mciClose(UINT, DWORD, LPMCI_GENERIC_PARMS);
/* window.c */
/* wnd.c */
BOOL MCIAVI_RegisterClass(void);
BOOL MCIAVI_UnregisterClass(void);
BOOL MCIAVI_CreateWindow(WINE_MCIAVI* wma, DWORD dwFlags, LPMCI_DGV_OPEN_PARMSA lpOpenParms);
DWORD MCIAVI_mciPut(UINT wDevID, DWORD dwFlags, LPMCI_DGV_PUT_PARMS lpParms);
DWORD MCIAVI_mciWhere(UINT wDevID, DWORD dwFlags, LPMCI_DGV_RECT_PARMS lpParms);

View File

@ -86,9 +86,29 @@ static LRESULT WINAPI MCIAVI_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPA
return 0;
}
BOOL MCIAVI_CreateWindow(WINE_MCIAVI* wma, DWORD dwFlags, LPMCI_DGV_OPEN_PARMSA lpOpenParms)
BOOL MCIAVI_UnregisterClass(void)
{
return UnregisterClassA("MCIAVI", MCIAVI_hInstance);
}
BOOL MCIAVI_RegisterClass(void)
{
WNDCLASSA wndClass;
ZeroMemory(&wndClass, sizeof(WNDCLASSA));
wndClass.style = CS_DBLCLKS;
wndClass.lpfnWndProc = (WNDPROC)MCIAVI_WindowProc;
wndClass.cbWndExtra = sizeof(MCIDEVICEID);
wndClass.hInstance = MCIAVI_hInstance;
wndClass.hCursor = LoadCursorA(0, (LPSTR)IDC_ARROW);
wndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
wndClass.lpszClassName = "MCIAVI";
return RegisterClassA(&wndClass);
}
BOOL MCIAVI_CreateWindow(WINE_MCIAVI* wma, DWORD dwFlags, LPMCI_DGV_OPEN_PARMSA lpOpenParms)
{
HWND hParent = 0;
DWORD dwStyle = WS_OVERLAPPEDWINDOW;
int p = CW_USEDEFAULT;
@ -97,18 +117,6 @@ BOOL MCIAVI_CreateWindow(WINE_MCIAVI* wma, DWORD dwFlags, LPMCI_DGV_OPEN_PARM
/* what should be done ? */
if (wma->hWnd) return TRUE;
ZeroMemory(&wndClass, sizeof(WNDCLASSA));
wndClass.style = CS_DBLCLKS;
wndClass.lpfnWndProc = (WNDPROC)MCIAVI_WindowProc;
wndClass.cbClsExtra = 0;
wndClass.cbWndExtra = sizeof(MCIDEVICEID);
wndClass.hInstance = MCIAVI_hInstance;
wndClass.hCursor = LoadCursorA(0, (LPSTR)IDC_ARROW);
wndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
wndClass.lpszClassName = "MCIAVI";
if (!RegisterClassA(&wndClass)) return FALSE;
if (dwFlags & MCI_DGV_OPEN_PARENT) hParent = lpOpenParms->hWndParent;
if (dwFlags & MCI_DGV_OPEN_WS) dwStyle = lpOpenParms->dwStyle;
if (dwStyle & WS_CHILD) p = 0;