Important alert: (current site time 7/16/2013 3:38:55 AM EDT)
 

winzip icon

Inter-Process Communications

Email
Submitted on: 6/13/2000 2:41:02 PM
By: Roger D Taylor 
Level: Advanced
User Rating: By 16 Users
Compatibility: VB 5.0, VB 6.0
Views: 29610
 
     OK, we've all been in the situation where you want a multi tread application but since VB is single threaded it is difficult to do, so you create a second vb app and line the two together using winsock .... this is slow and you my be woring in a machine that does not have IP installed .... what choices do you have ..... well you can use pipes, winsock as i've already mentioned and you can also use Read/WriteProcess memory, these are time consuming and difficult to understand and write ..... but hey, what about SendMessage.... yep that good old API call. it allows you to send a data structure to an other process ..... which is fast and the message will always get there .... this code gives you a quick example of how to do this..... hope you fins this code useful .... You may find that quitting the Client Application after you have sent the message wil cause your VB IDE to crash with a Memory exception .... if you click the control box on this form it might not crash the IDE ... this does not happen as an EXE
 
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
  3. Scan the source code with Minnow's Project Scanner

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.


Other 4 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Advanced category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments
6/13/2000 4:45:22 PMStephan Kirchmaier

The best thing I've ever saw on PSC!
(If this comment was disrespectful, please report it.)

 
6/13/2000 4:54:41 PMRoger Taylor

Glad you like it .....
(If this comment was disrespectful, please report it.)

 
6/13/2000 6:34:20 PMwebmaistre_alain

a REALLY good piece of code. I will be able to awake the second processor of my bipro with VB ;-)
(If this comment was disrespectful, please report it.)

 
6/13/2000 6:35:22 PMwebmaistre_alain

a REALLY good piece of code. I will be able to awake the second processor of my bipro with VB ;-) thanks
(If this comment was disrespectful, please report it.)

 
6/14/2000 7:59:50 AMErik Forbes

Very nice! :) Solved a couple delimahs for me, actualy. :p

You may want to note to others that they should not use the VB Development Environemnt's 'Stop' button or command any time before calling the 'unhook' function. This crashes VB. :p

Thanks,
Erik Forbes
(If this comment was disrespectful, please report it.)

 
6/14/2000 8:24:13 AMRoger Taylor

Thanks for the note Erik, I made nodes about this problem on the submission form for this item ... it just does not seem to be printed for some reason ......




(If this comment was disrespectful, please report it.)

 
6/27/2000 5:34:44 PMMike

I dont know if its just me but if the function on the client form has a do loop in it it will not execute the other subs on the other forms till it exits the do in the first one hence this is not 'threading' sorry help me if im wrong
(If this comment was disrespectful, please report it.)

 
6/27/2000 5:40:28 PMMike

please disregard post it was for a different project sorry.
(If this comment was disrespectful, please report it.)

 
7/26/2000 9:50:13 AMHarry

Why not do Multithreading using Active-X EXE Server in VB? I think it is a better approach than this one...Am i right?
(If this comment was disrespectful, please report it.)

 
7/27/2000 7:37:10 AMThe Author of the Code

Harry, The Point of this is not just multithreading, its an example of how to get two completly different applications to talk to one another.
(If this comment was disrespectful, please report it.)

 
9/21/2000 8:27:09 AMmarvin

coooool just what I was looking for !
I have two programs that access an SQL Database the one Program stores data into the database (from the serial port) and the other is for looking up the data... the storing program has to inform the reading program when new data arrived.. I first used sendkeys() but that was crappy.... now it's excellent ! good work !
(If this comment was disrespectful, please report it.)

 
12/23/2000 10:02:29 PMAnthony

Is it just me or does this program lock because it won't unhook
(If this comment was disrespectful, please report it.)

 
12/30/2000 2:14:58 PMRoger D Taylor

I guess its just you mate, and it does unhook correctly.
(If this comment was disrespectful, please report it.)

 
6/16/2001 9:29:01 AMxeek

what about dde connections?
(If this comment was disrespectful, please report it.)

 
6/19/2001 5:47:19 AMroger_d_taylor

DDE is ok, but its a nasty beast, this way is much simpler.
(If this comment was disrespectful, please report it.)

 
9/4/2002 7:17:33 AM

Hi Roger,

I can not open the project1.vbp neither the clientapp.vbp. I am getting an error like
(If this comment was disrespectful, please report it.)

 
9/4/2002 7:21:37 AM

Hi Roger,

After trying to load your application with VB5.0 sapnish version I am getting the following error in both .vbp: "The clue "retained" does not exist. Impossible to open project".. Do you know how can I solve this problem?
Thanks,
(If this comment was disrespectful, please report it.)

 
12/2/2003 12:42:13 AMSoloSoftware

It works OK if you are the builder of both apps, however if you take out the hook function from the client the communication fails.
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.