Could someone look at this simple code and explain why it doesnt work?
luis lenders
lgvlenders at yahoo.co.uk
Tue Nov 16 08:16:58 CST 2004
Hi, i found this very simple app which just pops up a
window:
#include <windows.h>
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM
wparam, LPARAM lparam)
{
switch (msg) {
case WM_DESTROY:
PostQuitMessage(0);
return 0;
default:
return DefWindowProc(hwnd, msg, wparam,
lparam);
}
}
int WINAPI WinMain(HINSTANCE instance, HINSTANCE prev,
LPSTR cmdLine, int cmdShow)
{
WNDCLASSEX class;
MSG msg;
HWND window;
/* this stuff is just boilerplate */
memset(&class, 0, sizeof(WNDCLASSEX));
class.cbSize = sizeof(WNDCLASSEX);
class.hInstance = instance;
class.lpszClassName = "MainWnd";
class.lpfnWndProc = WndProc;
class.hbrBackground = (HBRUSH) COLOR_WINDOW + 1;
if (!RegisterClassEx(&class)) {
MessageBox(NULL, "Could not register window
class", "", MB_OK | MB_ICONERROR);
return 1;
}
window = CreateWindowEx(0, "MainWnd", "Main
Window", WS_OVERLAPPEDWINDOW & ~WS_MAXIMIZEBOX,
CW_USEDEFAULT,
CW_USEDEFAULT, 200, 150, NULL, NULL, instance, NULL);
ShowWindow(window, cmdShow);
/* Every thread that creates a window must pump
the message loop */
while (GetMessage(&msg, NULL, 0, 0)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;
}
Now i tried to implement this in a dll (avicap32.dll)
in capCreatecapturewindow like this:
/***********************************************************************
* capCreateCaptureWindowW (AVICAP32.@)
*/
HWND VFWAPI capCreateCaptureWindowW(LPCWSTR
lpszWindowName, DWORD dwStyle, INT x,
INT y, INT nWidth,
INT nHeight, HWND hWnd,
INT nID)
{
HWND ret;
HINSTANCE dummy;
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM
wparam, LPARAM lparam)
{
switch (msg) {
case WM_DESTROY:
PostQuitMessage(0);
return 0;
default:
return DefWindowProcW(hwnd, msg, wparam,
lparam);
}
}
int WINAPI Try(HINSTANCE instance, HINSTANCE prev,
LPSTR cmdLine, int cmdShow)
{
WNDCLASSEXW class;
MSG msg;
HWND window;
/* this stuff is just boilerplate */
memset(&class, 0, sizeof(WNDCLASSEXW));
class.cbSize = sizeof(WNDCLASSEXW);
class.hInstance = instance;
dummy=instance;
class.lpszClassName = "MainWnd";
class.lpfnWndProc = WndProc;
class.hbrBackground = (HBRUSH) COLOR_WINDOW + 1;
if (!RegisterClassExW(&class)) {
MessageBoxW(NULL, "Could not register window
class", "", MB_OK | MB_ICONERROR);
return 1;
}
window = CreateWindowExW(0, "MainWnd", "Main
Window", WS_OVERLAPPEDWINDOW & ~WS_MAXIMIZEBOX,
CW_USEDEFAULT,
CW_USEDEFAULT, 200, 150, NULL, NULL, instance, NULL);
ret=window;
ShowWindow(window, cmdShow);
/* Every thread that creates a window must pump
the message loop */
while (GetMessageW(&msg, NULL, 0, 0)) {
TranslateMessage(&msg);
DispatchMessageW(&msg);}
return 0;
}
Try(dummy,NULL,NULL,0);
return ret;
}
Now when capcreatecapturewindow is called no window
shows up at all. What did i do wrong? Greetings
Robbert
:
___________________________________________________________
Moving house? Beach bar in Thailand? New Wardrobe? Win £10k with Yahoo! Mail to make your dream a reality.
Get Yahoo! Mail www.yahoo.co.uk/10k
More information about the wine-devel
mailing list