Solved

Communicate string between two instances of program

Posted on 2004-08-26
3
208 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
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

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 …
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

706 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now