[Pharo-dev] How to listen for windows messages?
astares at gmx.de
Tue Feb 28 03:33:05 EST 2017
I guess what you want to achieve will not be an easy task for you if you are new to programming.
But it is always good to have a goal and if you have time to learn I'm pretty sure you will master
Even when OS-Windows inspire you for automizing tasks in other Windows processes (like autoit) you
should not start with my OS-Windows project directly as contributing to it requires knowledge
on your side on Smalltalk as well as Win32 C programming.
First start with learning Smalltalk and Pharo
After having an idea about Smalltalk and Pharo you should try to learn UFFI which
is Pharos unified foreign function interface and ability to call C DLL's.
Sideways start learning about the Win32 API and C as this helps to better understand
how things are done on the Windows side. There are many, many tutorials out there.
Try to call or wrap some simple DLL functions on you own first.
There is a nice and tiny C compiler if you want to try out some C samples
With this initial knowledge you can try to understand why and how OS-Windows was done.
I wrote many tests - just add a breakpoint and run them to debug through the code to understand.
Google for the API descriptions of the Win32 functions that are called to get an understanding
how Pharo and C get connected.
Also check how you work with callbacks in UFFI (as this would be required for a hook).
If you are then still interested in interception windows messages you should start reading here
Primarily one has to wrap SetWindowsHookEx API function and friends and wrap a good API
for them in Pharo.
Hope that helps to get started.
> Gesendet: Dienstag, 28. Februar 2017 um 06:04 Uhr
> Von: lw1990 <lukewallace1990 at gmail.com>
> An: pharo-dev at lists.pharo.org
> Betreff: [Pharo-dev] How to listen for windows messages?
> In the OS-Windows package, there exists the ability to use the windows api in
> This is very powerful, and I intend to add more of the windows api into it
> (it's only partially implemented).
> This appears to all have been done with DllCalls (FFI calls) so far.
> A big part of interacting with windows is listening to/intercepting and
> responding to windows messages.
> For example, every time a user presses a key on the keyboard, a windows
> message will happen in the background for that key. If Pharo was aware of
> these messages, then Pharo could do things in response to hotkeys pressed on
> Windows (outside of a pharo window).
> It would also make reacting to events potentially nicer. Like making a
> windows-desktop-manager in Pharo that can tell when a new window is created
> by windows (maybe they opened notepad). It would certainly be better than an
> infinite loop or timer of 'get active window and compare to last active
> window and see if it changed'. Instead it would be 'when receive the
> WM_MESSAGE for new window created, notify Pharo so it can react'.
> How can I set up a windows message hook in Pharo?
> Please keep in mind I'm very new to programming, but I work from home and
> have lots of time to learn :-)
> View this message in context: http://forum.world.st/How-to-listen-for-windows-messages-tp4936285.html
> Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
More information about the Pharo-dev