On Sunday, 17 May 2020 at 09:27:40 UTC, Vinod K Chandran wrote:
Hi all,
I am trying to create a win32 based gui in dlang. So far so good. I can create and display my window on screen. But for handling messages, i planned to write something like message crackers in c++. But since, my WndProc function is a "nothrow" function, i cannot use any function without "nothorw" in that WndProc. How to solve this problem ?

Hi,

You need to catch any exceptions inside of your WndProc so they don't propagate:

LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) nothrow
{
    try
    {
        // your code logic here may call throwing functions
    }
    catch (Exception e)
    {
        // You should log exceptions here
    }
}

Reply via email to