digitalmars.D.bugs - winsamp.d examples does not work when compiled -release
- Russell Wilkins (54/54) Dec 05 2004 The following example shows the problem, it's a stripped down version
- J C Calvarese (11/16) Dec 05 2004 Could it be the issue discussed here?
- Russell Wilkins (3/30) Dec 05 2004 You are correct, removing the assert around the RegisterClass fixes the...
- Stewart Gordon (7/11) Dec 06 2004 *** This bug has been marked as a duplicate of
- Walter (3/10) Dec 06 2004 It's also been fixed now.
The following example shows the problem, it's a stripped down version
of winsamp.d. If its compiled without -release it works fine, it you
compile it with -release the value hWnd is 0 after the CreateWindow
call. This works fine on 106, but fails on 108/109. What's going on?
import std.c.windows.windows;
extern(Windows)
int WindowProc(HWND hWnd, uint uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
break;
}
return DefWindowProcA(hWnd, uMsg, wParam, lParam);
}
extern (Windows) int WinMain(HINSTANCE hInstance, HINSTANCE
hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
try
{
WNDCLASS wc;
wc.lpszClassName = "DWndClass";
wc.style = CS_OWNDC | CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = &WindowProc;
wc.hInstance = hInstance;
wc.hIcon = LoadIconA(cast(HINSTANCE) null, IDI_APPLICATION);
wc.hCursor = LoadCursorA(cast(HINSTANCE) null, IDC_CROSS);
wc.hbrBackground = cast(HBRUSH) (COLOR_WINDOW + 1);
wc.lpszMenuName = null;
wc.cbClsExtra = wc.cbWndExtra = 0;
assert(RegisterClassA(&wc));
HWND hWnd = CreateWindowA("DWndClass", "Just a window", WS_THICKFRAME |
WS_MAXIMIZEBOX | WS_MINIMIZEBOX | WS_SYSMENU | WS_VISIBLE,
CW_USEDEFAULT, CW_USEDEFAULT, 400, 300, HWND_DESKTOP,
cast(HMENU) null, hInstance, null);
assert(hWnd);
MSG msg;
while (GetMessageA(&msg, cast(HWND) null, 0, 0))
{
TranslateMessage(&msg);
DispatchMessageA(&msg);
}
}
catch (Object o)
{
return 1;
}
return 0;
}
Dec 05 2004
In article <couv61$20pu$1 digitaldaemon.com>, Russell Wilkins says...The following example shows the problem, it's a stripped down version of winsamp.d. If its compiled without -release it works fine, it you compile it with -release the value hWnd is 0 after the CreateWindow call. This works fine on 106, but fails on 108/109. What's going on?Could it be the issue discussed here? http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D.bugs/2358 I would think that this assert(RegisterClassA(&wc)); would turn into this: RegisterClassA(&wc); but maybe it turns into this: ; In any case, it has to be a compiler bug.assert(RegisterClassA(&wc));jcc7
Dec 05 2004
J C Calvarese wrote:In article <couv61$20pu$1 digitaldaemon.com>, Russell Wilkins says...You are correct, removing the assert around the RegisterClass fixes the problem.The following example shows the problem, it's a stripped down version of winsamp.d. If its compiled without -release it works fine, it you compile it with -release the value hWnd is 0 after the CreateWindow call. This works fine on 106, but fails on 108/109. What's going on?Could it be the issue discussed here? http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D.bugs/2358 I would think that this assert(RegisterClassA(&wc)); would turn into this: RegisterClassA(&wc); but maybe it turns into this: ; In any case, it has to be a compiler bug.assert(RegisterClassA(&wc));jcc7
Dec 05 2004
Russell Wilkins wrote:The following example shows the problem, it's a stripped down version of winsamp.d. If its compiled without -release it works fine, it you compile it with -release the value hWnd is 0 after the CreateWindow call. This works fine on 106, but fails on 108/109. What's going on?*** This bug has been marked as a duplicate of http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D.bugs/2271 *** Stewart. -- My e-mail is valid but not my primary mailbox. Please keep replies on the 'group where everyone may benefit.
Dec 06 2004
"Stewart Gordon" <smjg_1998 yahoo.com> wrote in message news:cp1dn5$241c$1 digitaldaemon.com...Russell Wilkins wrote:It's also been fixed now.The following example shows the problem, it's a stripped down version of winsamp.d. If its compiled without -release it works fine, it you compile it with -release the value hWnd is 0 after the CreateWindow call. This works fine on 106, but fails on 108/109. What's going on?*** This bug has been marked as a duplicate of http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D.bugs/2271 ***
Dec 06 2004









Russell Wilkins <rwilkins grovestarsoftware.com> 