|
-
October 30th, 2002, 04:32 PM
#1
postmessage to another instance of my app?
I have set up my mdi app so that only one instance of my app can run at a time. Now the twist is that when the second app is executed and he sees that there is already an instance running, he needs to send to the already running instance a file path/name to open, and then exit. The part where only one instance runs at a time is working flawlessly. The problem that I am having is that I cannot seem to send a user message to the app after calling RegisterWindowMessage(). Is there a good example out there on how to do this correctly? Couple of things trouble me:
1. examples that I have seen show views receiving user-defined messages. Mine is set up for the application to receive. Is this my problem?
2. I do a search in CodeGuru for "RegisterWindowMessage" and get a bunch of hits, but when I do a 'Find on this page' in IE, I get no matches?!
Thanx
-
October 30th, 2002, 08:51 PM
#2
As for how to send a message to the application instead of a window I don't know how to do that. For RegisterWindowMessage I hope my simple sample helps; see Using Registered Message Ids. If you need to send a string then you might need to use WM_COPYDATA instead.
-
October 30th, 2002, 08:52 PM
#3
You know every app has its own message queue, that means you just send mess inside your app.
If you want to send mess to another app, may be you have to use Hook technology. With this skill, you can send any kind of messages to any apps in Microsoft Desktop app.
-
October 30th, 2002, 09:01 PM
#4
every app has its own message queue
every thread has it's own message queue (if it's GUI-thread). Hence, in process there is a many message queues.
-
October 30th, 2002, 09:19 PM
#5
Perhaps ::PostThreadMessage will send a message to the application but you might need to get the threadid to do that and you cannot use it to send a WM_COPYDATA message.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|