Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
December 05, 2004 winsamp.d examples does not work when compiled -release | ||||
---|---|---|---|---|
| ||||
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; } |
December 05, 2004 Re: winsamp.d examples does not work when compiled -release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Russell Wilkins | 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 |
December 05, 2004 Re: winsamp.d examples does not work when compiled -release | ||||
---|---|---|---|---|
| ||||
Posted in reply to J C Calvarese | J C Calvarese wrote:
> 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
You are correct, removing the assert around the RegisterClass fixes the problem.
|
December 06, 2004 Re: winsamp.d examples does not work when compiled -release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Russell Wilkins | 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. |
December 06, 2004 Re: winsamp.d examples does not work when compiled -release | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stewart Gordon | "Stewart Gordon" <smjg_1998@yahoo.com> wrote in message news:cp1dn5$241c$1@digitaldaemon.com... > 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 *** It's also been fixed now. |
Copyright © 1999-2021 by the D Language Foundation