Silent error when using hashmap

ketmar via Digitalmars-d digitalmars-d at puremagic.com
Wed Jul 26 09:39:15 PDT 2017


FatalCatharsis wrote:

> I apologize, I'm not sure if this is expected behavior, a bug in the 
> compiler, or a bug in the core windows libraries, so I'll post this here 
> until pointed elsewhere.
>
> I've done this trick with win32 for awhile in other languages where I 
> pass a reference to a specific class of my own that represents an 
> instance of window to the CreateWindowEx function, and then use a static 
> router function to send messages to the specific instance. I've made the 
> most minimal example I can in this gist.
>
> https://gist.github.com/FatalCatharsis/d3cc6ec621f0600975806fe23610ae32
>
> When I compile this and run this, nothing is printed and no window is 
> created. I've tried putting try catches around everything (including the 
> inside of the static constructor), but nothing is caught.
>
> However, when I comment out the hash lookup on line 54, the compiled 
> program runs fine and creates a window, (but only for a moment since 
> there is not a message handling loop). The expected printout of "start" 
> and "end" occurs just fine.
>
> What is happening here that causes the program not execute at all, with 
> no output and no exceptions? Is this a bug with my code, a bug with the 
> core.sys.windows.windows library, or a bug with the compiler? Any info 
> about how to debug this further is greatly appreciated.

'cause `WM_CREATE` is not the first message window receiving. check if hwnd 
is in hash with `in` first.


More information about the Digitalmars-d mailing list