473,322 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

File associations and running only one instance of the application.

Hi,

I'm trying to implement file associations with my application. I've been
doing this in phases and I'm stuck at the last hurdle.

Phases
1) Installer sets up the file association
Main in my application changed to accept a string [] args parameter
then creates my class passing in the string [] args parameter
On loading the form if the passed in parameter is a string it
loads the file

This works fine.
When I double click on an assoociated file I get a new instance of the form.

2) The boss says he only wants one instance of the application to run

In Main check to see if the application is in the running processes list
if it is don't run
This works fine.

The bit I'm having trouble is that if it is in the running list I want
to call that process and tell it to load
the filename passed in.

Any ideas how to do this? I think the issue I'm having is the class is
not static and the Main function is.

Do I need to store a static reference to the form created and then use
Invoke on a delegate?

rollasoc



Jul 21 '05 #1
1 2266
Ok sorted it out now with the cunning use of SendMessage and WM_COPYDATA to
post a message to the first instances window.

rollasoc
"rollasoc" <ho*****@hotmail.com> wrote in message
news:uo**************@TK2MSFTNGP11.phx.gbl...
Hi,

I'm trying to implement file associations with my application. I've been
doing this in phases and I'm stuck at the last hurdle.

Phases
1) Installer sets up the file association
Main in my application changed to accept a string [] args parameter
then creates my class passing in the string [] args parameter
On loading the form if the passed in parameter is a string it
loads the file

This works fine.
When I double click on an assoociated file I get a new instance of the form.
2) The boss says he only wants one instance of the application to run

In Main check to see if the application is in the running processes list if it is don't run
This works fine.

The bit I'm having trouble is that if it is in the running list I want
to call that process and tell it to load
the filename passed in.

Any ideas how to do this? I think the issue I'm having is the class is
not static and the Main function is.

Do I need to store a static reference to the form created and then use
Invoke on a delegate?

rollasoc


Jul 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: David Allison | last post by:
I am looking to open my MDE Application using the DB files associated with the application I have created. My application is using a non descript three digit extension that is related to the...
1
by: john | last post by:
I have an exe console app that i wrote, which works on custom data files. I'd like to give these data files a custom extension and somehow register that file extension with my exe, so all i have to...
2
by: PJ Olson | last post by:
I have an app that allows only one instance to run at a time. I have a file extension associated with this app and would like to pass a running instance the file name if a user double-clicks the...
1
by: rollasoc | last post by:
Hi, I'm trying to implement file associations with my application. I've been doing this in phases and I'm stuck at the last hurdle. Phases 1) Installer sets up the file association Main in...
2
by: Robert W. | last post by:
With a WinForms app I know how to configure the registry to understand a specific file association so that it is associated with a given application. But how does one do this with a web browser?...
1
by: iwdu15 | last post by:
hi, how can i get the icon associated with a certain file type? thanks -- -iwdu15
2
by: Andrea Anastasescu | last post by:
Hi there, I have to integrate a previewer into a desktop application, that retains some links to resources (local files, internet-links, personal mails - this is not of certain concern). This...
1
by: Lyle Avery | last post by:
Hi guys, Who knows how to restore VS 2k5 file associations, I've clicked Tools->General->"Restore File Associations" button but it doesn't work at all. I know Repair the whole product could fix...
6
by: Jerad Rose | last post by:
I recently installed Visual Studio 2003, after having already installed VS 2005. Unfortunately, it took over all of the file associations. There is an option in Visual Studio 2005 to restore...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.