[Q] Using FFI to call standard Windows dialogs

Stefan Matthias Aust sma at 3plus4.de
Sat Jul 1 08:45:47 UTC 2000


At 08:29 30.06.00 -0400, Jarvis, Robert P. \(Contingent\) wrote:

>         typedef struct tagPD {
>           ...
>           HWND            hwndOwner;
>           HINSTANCE       hInstance;

I think, it's tricky to fill in the above values.  While you probably can 
get the HWND of Squeak's windows by searching that window by its class I 
see no easy way to get the hInstance.  This value is passed to the Windows 
VM during startup via the WinMain() function call.  The VM stores the value 
but there's no way to access it.

As Squeak even support strange platform dependent information like the itsy 
battery power, I'd like to see a way to get the hInstance and hWnd values 
of the Squeak VM which are required for a lot of API calls.

I'm currently using this code

  HWND hWnd = FindWindow("SqueakWindowClass", NULL);
  if (hWnd == NULL)
    return 0;
  return (HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE);

which answers the hInstance or 0 if it cannot be retrieved (should never 
happen with VM 2.8 or 2.9).

>Personally, I think printing is one of the most God-awful things an
>application ever has to do.

Actually, it's not that bad.  Window's GDI provides some abstraction here 
and drawing on a printer HDC is nearly the same than drawing on the screen HDC.


bye
--
Stefan Matthias Aust  //  Bevor wir fallen, fallen wir lieber auf





More information about the Squeak-dev mailing list