?
Solved

Communicate string between two instances of program

Posted on 2004-08-26
3
Medium Priority
?
216 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 900 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

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…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…
Suggested Courses

777 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