Solved

Communicate string between two instances of program

Posted on 2004-08-26
3
213 Views
Last Modified: 2010-05-02
I have created a program that opens a media file when the file is double clicked. The program tests if another instance of the program is already running and closes if App.PrevInstance=true.

My problem is that I would like to pass the contents of the Command$ function to the first instance of the program so the new file can be loaded.

What is the simplest way to transfew a string to another instance of the same application?
0
Comment
Question by:andrewstr
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 3

Accepted Solution

by:
nichia earned 300 total points
ID: 11908951
This is the simplest way:

"Use DDE to make an editor where a single instance handles all requests"
http://www.vb-helper.com/howto_one_instance_dde_editor.html

This is somewhat more difficult:

"Use SendMessage to make an editor where a single instance handles all requests"
http://www.vb-helper.com/howto_one_instance_sendmessage_editor.html

And this is unreasonably difficult:

"Registering File Associations and Passing Command Line Parameters to an Existing App Instance"
http://www.vbaccelerator.com/home/VB/Code/Libraries/Shell_Projects/Registering_File_Associations/article.asp
0
 
LVL 8

Expert Comment

by:plq
ID: 11910396
Ugh DDE is a nightmare.

Stick it in a file or save it in the registry. GetSettingEx and SaveSettingEx or let me know if you need a full registry class. Use scripting of VB Open to save a file/
0
 

Author Comment

by:andrewstr
ID: 11916614
Is used the DDE method, but it was a pain to get it working. It didn't help that the example cited above is not correct as is. I had to make some modifications to get it working enough to understand what was going on.

I may have used the file/registry method but I wasn't sure how to get the original app to check for a new setting without using a Timer.

Thanks for the tips!
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question