[Vm-dev] How to Send a Message to the Squeak Image

John M McIntosh johnmci at smalltalkconsulting.com
Sun Mar 2 02:23:58 UTC 2008

Well not being a windows expert or even novice I can say if you are  
looking at the windows VM source code.

see usage of
  /* and lastly, fill in the event itself */
   event = (sqMouseEvent*) sqNextEventPut();
   *event = proto;

This is used to help you give a structure of data to the VM  
InputSensor event queue.

/* generic input event */
typedef struct sqInputEvent
   int type;			/* type of event; either one of EventTypeXXX */
   unsigned int timeStamp;	/* time stamp */
   /* the interpretation of the following fields depend on the type of  
the event */
   int unused1;
   int unused2;
   int unused3;
   int unused4;
   int unused5;
   int windowIndex;		/* SmallInteger used in image to identify a host  
window structure */
} sqInputEvent;

What values are in the unused1-unused5 integers are up to the VM and  
the image to decide and agree upon.   Setting up the data, then  
invoking sqNextEventPut and
doing the *event := whatever  places your event on the queue.


Is where the smalltalk image tirelessly remove events from the FIFO  
queue and processes them.

Obviously you then need a VM and image to agree on your protocol.

There maybe a different solution, Smalltalk code callbacks from C code  
are allowed in some variations of the VM>

On Mar 1, 2008, at 5:39 PM, Rob Rothwell wrote:

> Hello,
> Please let me know if this is a very VM question, and I will make  
> sure to post it on the Beginners list instead...
> Anyway...I would like to use Squeak as a background tray application  
> in Windows with a dynamic right-click menu depending on the state of  
> my application.  I have successfully modified and compiled a  
> "SqueakVM-Win32-3.10.6" package to include an "options menu" for the  
> taskbar icon.
> Keeping the menus in sync could be done using an INI file the same  
> way as the preference menu functionality in sqWin32Prefs.c, but with  
> custom message ID's listed there as well.  However, having never  
> poked around in the VM before (and being years since I did anything  
> in C), I was wondering if someone could point me in the right  
> direction to post a message from within the Windows message loop  
> that the interpreted image would see.
> This is obviously being done to pass keyboard and mouse events back  
> and forth...I was just hoping someone could help me narrow down my  
> search to find the correct functions to call on the C-side, and the  
> correct way to listen for the message on the Smalltalk side!
> Thanks,
> Rob Rothwell
> -- 
> The foolish reject what they see, not what they think; the wise  
> reject what they think, not what they see.  -- Huang Po

John M. McIntosh <johnmci at smalltalkconsulting.com>
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com

More information about the Vm-dev mailing list