• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 265
  • Last Modified:

How to have one VB program make a request of another VB .exe program that is already running.

I know VB6 well, but not ActiveX, COM, etc.

I want to create two VB6 programs.  The first .exe program will run first, have a UI, and do some communication to the Internet and then wait idle.  The second .exe program will run later, and needs to request the first program to communicate with a certain website.  How can I reliably pass that request from program two to program one?

Do I use ActiveX?  Do I use COM?  For whatever simplest method you recommend, please provide sample VB6 code in program one and two.
0
samuel999
Asked:
samuel999
  • 4
  • 3
  • 2
  • +4
1 Solution
 
mkhaleelrCommented:
pls try winsock
0
 
mkhaleelrCommented:
0
 
2AngelCommented:
Hi,

You can use a FLAG that will be "light-up" by the first program and will be monitor by the second program.
You can use a txt file or a ini file or to use a database file (like MsAccess) if you need more then a flag to shere with the two appliecations...

Good luck!
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
samuel999Author Commented:
Both .exe's will be running on the same machine.  Winsock is probably not the best way to communicate between two .exe's running on the SAME machine.  Anyone have a COM example?
0
 
BarshamDevelopment Team LeadCommented:
try one of these :
1. use DDE technic
2. program 1 can use SENDMESSAGE Api to read sample text from any text box on form progran2 and take state
3. P1 write state in registery key & p2 read that value
4. P1 create file & P2 Read That File
5. P1 Work Like com server & p2 search for existence of com server
6. p1 write data in shared DB & p2 read from DB
etc

say for more ;)
0
 
EDDYKTCommented:
Make your first task to activex exe and create a new class in it

In your second task just use createobject and call the function inside your new class and pass the into into
0
 
2AngelCommented:
Hi,

I stiil think my comment above is the best way to tranfer/share data between two application (especially after reading your last comment... )

Have fun.
0
 
EDDYKTCommented:
>>I stiil think my comment above is the best way to tranfer/share data between two application (especially after reading your last comment... )

No offense, just a question, how often do you think he should scan the ini file to see the changes?
0
 
2AngelCommented:
Well, I know you are very good programer and real expert - I can not compete you, I am just a beginer...
So, there is "no offence",  but read the question - its the matter of how often the secound program will "...communicate with a certain website..."
From the question above "...The first .exe program will run first, have a UI, and do some communication to the Internet and then wait idle.  The second .exe program will run later, and needs to request the first program to communicate with a certain website..."
Well as I see it, he said that the first program will do something and wait idle and then the second program will run later (!) and do somthing....
So, again he can check the flag every time he thinks he need it....

Secondly: if he will use MsAccess there is no problem, both application can keep the database open and the value of the flag can be, lets say, the value of a yes/no checkbox... or whatever...

What do you think my friend?
0
 
samuel999Author Commented:
Before this question starts a fight....

I don't think using a database will work.  When program #2 wants program#1 to communicate with a certain website, it needs to happen within a second or two after program #2 initiates the request.  So, program #1 would have to check the database every second.  Too often.

DDE is not forward compatible, so that's out...
SMESSAGE is a possibility...

Really want something that allows an instant response from program #1, and also an API I can give to others if they want to write a program that requests program #1 to do something.
0
 
EDDYKTCommented:
I don't think there is a fight. It is just discussion.

In Window's world, it is better to program as event driven instead of polling.

It is just my opinion, sorry for interruption.

8->
0
 
2AngelCommented:
I'm with EDDYKT - there is no fight.

Maybe you can use "SendKey" to a controll of the other program and use the event "on change"?

Anyhow good luck to all of you!
0
 
senthil_msvCommented:
Try to write service for handling both exe

http://www.smsoft.ru/en/ntservice.htm
0
 
PaulHewsCommented:
If you want to share your first program's interface with other developers, then it would be logical to use an ActiveX EXE as suggested by EDDYKT.  The other methods may work, but they are a little too "quirky" to seriously consider sharing with other developers.

The only other approach I might suggest would be to pass a command string to the first program, so instead of having it sitting idle, you launch a new instance of it with a command string, and when it finishes it's task, exits.  Assuming it's getting information from an internet site, you can save the information somewhere so the calling program can read it.
0
 
PaulHewsCommented:
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 3
  • 2
  • +4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now