Jump to content
milurt

bitmap is not displayed

Recommended Posts

2 hours ago, KodeZwerg said:

Somewhere I've done a mistake, when I remove the "halt" app going into a deadlock. 

function WindowProc(hWnd: HWND; Msg: UINT; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall;
begin
  case Msg of
    WM_DESTROY:
      begin
        PostQuitMessage(0);
        Exit(0);
      end;
  else
    Result := DefWindowProc(hWnd, Msg, wParam, lParam);
  end;
end;

procedure RunClient;
begin
  UpdateWindow(LHWND);
  while (integer(GetMessage(LMsg, LHWND, 0, 0)) > 0) do
  begin
    if (LMsg.message = WM_QUIT) then
    begin
      PostQuitMessage(0);
      break;
    end;
    TranslateMessage(LMsg);
    DispatchMessage(LMsg);
  end;
  UnregisterClass(PChar(GClassName), LInst);
end;

 

The main problem was that GetMessage is declared to return a BOOL but it actually returns an integer. Specifically, it returns -1 when the message queue has been destroyed.

  • Thanks 1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×