Re: Setting up a TMessage trap



battles wrote:
I have a program that is using a timer to scan and determine if
another program has started. I would like to get away from using a
timer. Is there possibly a message trap I could set up to look for
certain messages, such as WM_CREATE, whereby I could upon encountering
do the above scan for the other program. An example would be
appreciated.

Thanks.
You need to run a windows Hook "SetWindowsHookEx" in a DLL file.
That way, you can monitor create messages from where ever.
P.S.
It needs to be in a DLL and to send notices back to your own
program, you need use a mapped file that you can open to obtain
a window handle that you stored there when your app started up
of your main window. There You can use the postMessage with a
user+xxxx
etc..
if you don't want to use a mapped file, you could use a shared
memory segment to hold the handle of your app. The reason for this
is when you receive a message from another app, your DLL isn't really
in your app's process space and using the FindWIndow to search for your
app isn't really good because it can get confused with commonly used names of other windows already running.
Last time I checked, delphi isn't able to create a DLL with a shared
segment how ever, if you have a C compiler, you can do it with that and
use the DLL in delphi.
or, You could use the shared Memory lib that Delphi has if that makes it easier for you.


http://webpages.charter.net/jamie_5";

.



Relevant Pages

  • Re: New Delphi roadmap is coming: NO UNICODE PLEASE!
    ... Avoids DLL hell, because it ... The app is deployed and the user is getting an error. ... instances where upgrading .NET broke things that were working. ... Coming from Delphi, this isn't any big deal of course. ...
    (borland.public.delphi.non-technical)
  • Re: Remove app from both device and desktop
    ... basic uninstall "stuff" reads the script and undoes everything. ... I added a setup DLL to provide a few extras. ... I don't bother to check whether my app is still running. ... application has at least one window with a unique window class name or ...
    (microsoft.public.pocketpc.developer)
  • Re: Problem closing app with big UDT
    ... Are you trying to pass the UDT between VB and Delphi, ... Passing it back and forth between a Delphi .dll to a VB application. ... ALL the data is of one of 3 types: Long, Double, or Byte array. ... In any one app, maybe, but this dll is in production use in several ...
    (microsoft.public.vb.general.discussion)
  • Re: Overridden WndProc not working in some cases?
    ... Unmanaged C++ DLL ... separate thread) it seems to work fine and receives all messages. ... However if I do what I was doing before which is creating a window in ... For some reason the first message hits my app okay, ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Re: calling application procedure from a dll
    ... In the main App I have a fancy decendant of TStream that reads its ... I suppose the DLL goes rooting around in the memory of the main App, ... Delphi 5, ...
    (comp.lang.pascal.delphi.misc)