|
-
May 12th, 2003, 11:33 PM
#1
Thread Starter
Frenzied Member
Call a make my application run a sub routine, from another application?
hey guys,
how can i make my application run a sub routine, from another external application?
Explaination:
Say i have two EXE's
1) MainApp.exe
2) Settings.exe
When / If I change & save any settings in Settings.exe, how can i make MainApp.exe re-call a sub (IE: LoadSettings()) to get the new settings from an ini file?
is it possible?
Thanks guys.
Wayne
-
May 13th, 2003, 12:21 AM
#2
-
May 13th, 2003, 12:34 AM
#3
Thread Starter
Frenzied Member
Originally posted by MartinLiss
No.
K, Tnx
-
May 13th, 2003, 07:01 AM
#4
Hyperactive Member
Actually
This is possible, provided you have the source code of both apps in VB.
-
May 13th, 2003, 07:03 AM
#5
Retired VBF Adm1nistrator
This is possible.
You simply need the Address of the sub routing in the other application.
You can use AddressOf to get the memory location of the sub or function, and then you could use the CallWindowLong() API to call that function.
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
May 13th, 2003, 07:12 AM
#6
CallWindowLong is an in-process call. You can't call an address of another application this way, I'm afraid, because it will look for the address in the current process (insert weird analogy of streets and addresses here...).
You can, however, get Windows to execute code in another application by sending the main window of that application a WM_TIMER message with lParam pointing to the address you want to run.
Alternatively, if you have the source code for both applications you can implement Inter process communication using registered messages from Visual Basic...
-
May 13th, 2003, 07:13 AM
#7
Hyperactive Member
Another way i think would work is if both apps are in VB, you can make one or both with exports and call with normal API.
Just edited, wont work, app crashes without error message.
Last edited by packetVB; May 13th, 2003 at 07:23 AM.
-
May 13th, 2003, 07:14 AM
#8
Retired VBF Adm1nistrator
You sure CallWindowLong is in-process ?
Bugger. Never knew that. 
I wonder if it will work inside process-trees...?
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
May 13th, 2003, 07:22 AM
#9
Retired VBF Adm1nistrator
Brilliant article on interprocess comms btw!!
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
May 13th, 2003, 07:25 AM
#10
You sure CallWindowLong is in-process ?
It'd probably work cross-process in Windows 95-Me. Most stuff does...which is why those OSes have stability and security issues
-
May 13th, 2003, 02:00 PM
#11
Fanatic Member
why don't you just make a dll and then call the sub from the dll.
-
May 13th, 2003, 02:03 PM
#12
Thread Starter
Frenzied Member
Originally posted by Merrion
CallWindowLong is an in-process call. You can't call an address of another application this way, I'm afraid, because it will look for the address in the current process (insert weird analogy of streets and addresses here...).
You can, however, get Windows to execute code in another application by sending the main window of that application a WM_TIMER message with lParam pointing to the address you want to run.
Alternatively, if you have the source code for both applications you can implement Inter process communication using registered messages from Visual Basic...
thanks, i will look into this later on 
I think its just what i need (not had a proper look yet though)
why don't you just make a dll and then call the sub from the dll.
i dont want both of the apps to be able to run the sub,
I want to force the external app to run the sub
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
|