realbasic-plugins
[Top] [All Lists]

Re: Storing global data (was Callbacks and events on Windows)

To: REALbasic Plugins <realbasic-plugins at lists dot realsoftware dot com>
Subject: Re: Storing global data (was Callbacks and events on Windows)
From: James Milne <james dot milne at mac dot com>
Date: Wed, 26 Apr 2006 15:14:32 +0100
Cc: REALbasic Plugins <realbasic-plugins at lists dot realsoftware dot com>
Delivered-to: realbasic-plugins at lists dot realsoftware dot com
References: <C0753808 dot 4B4FC%listmail1 at dsl dot pipex dot com>
Dave Addey wrote:
> Okay, so I set about a variant of approach 2, and I've hit another snag.
> Perhaps that comes from trying to do everything in the plugin.  This one
> should be a quick question :-)
> 
> I have a HIDManager class, which manages all connections to DirectInput and
> provides devices and device elements when requested.  My approach is to add
> two functions to this class:
> 
> RegisterWindowForHIDEvents(inWindowHandle as integer)
> UnregisterWindowForHIDEvents(inWindowHandle as integer)
> 
> The register function stores the current WindowProc pointer for the window,
> and installs its own WindowProc instead.  What I need to do now is to make
> the old WindowProc pointer available to the new WindowProc, so that it can
> pass on any unwanted events to the usual RB window procedure.  Here's my
> dilemma: how do I store these old pointers in a global way such that they
> may be retrieved by the custom WindowProc? (It could then identify the right
> one to used based on the window handle passed in.)
> 
> If I store them in the HIDManager instance, I have no way to retrieve the
> instance from within the WindowProc.  Is there anywhere else (within my
> plugin code) that they could be stored and be globally available?

SetWindowData() is your friend. It allows you to store data against the Window 
Handle. When you create the window, call SetWindowHandle and stash your 
REALobject instance reference in there. 

You can use GetWindowData to retrieve your REALobject instance from the HWND 
passed to the WndProc.

--
Kind regards,
James Milne
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>