Good Day Group,
I'm trying to make my application open and run some code when a user clicks
on a file with an associated extension. This is *my* understanding of what
actually happens, please correct me if I am wrong. I've searched the net,
but there doesn't seem to be much on the subject.
1) When using the DotNetPackager (called dotfuscator I believe), we can
associate files with a specific extension to a specific program. Basically
just a registry key being written. Perhaps there is a way to check this
through code and actualy write to the registry if there was a mistake?
2) when a user clicks on an associated file, its like a command line
argument i.e.: "myApp.exe" "c:\myPath\myFile.aaa".
3)In order to use the file, the Main() must accept Args. ie"static void
Main(string[] Args) at which point I can access the filename by accessing
the Args[0] of the Main and store it in a variable in my program.
Please let me know if there's anything else I should know about, or if my
understanding is erroneous.
Thanks and best regards,
Marco 3 1586
"Marco Martin" <ma**********@sympatico.ca.antispam> schreef in bericht
news:%W********************@news20.bellglobal.com. .. Good Day Group,
I'm trying to make my application open and run some code when a user
clicks on a file with an associated extension. This is *my* understanding of
what actually happens, please correct me if I am wrong. I've searched the net, but there doesn't seem to be much on the subject.
Google returns plenty of hits. Just use " fileassociation "c#" " 1) When using the DotNetPackager (called dotfuscator I believe), we can associate files with a specific extension to a specific program.
Basically just a registry key being written. Perhaps there is a way to check this through code and actualy write to the registry if there was a mistake?
Check http://www.mentalis.org/soft/class.qpx?id=5 It contains both a C# and
VB.Net version with examples.
2) when a user clicks on an associated file, its like a command line argument i.e.: "myApp.exe" "c:\myPath\myFile.aaa".
yes
3)In order to use the file, the Main() must accept Args. ie"static void Main(string[] Args) at which point I can access the filename by accessing the Args[0] of the Main and store it in a variable in my program.
No, you still need to use Main() without arguments but then use
Environment.CommandLine to get the commandline data.
Please let me know if there's anything else I should know about, or if my understanding is erroneous.
Thanks and best regards,
Marco
Yves
Thanks Yves,
I managed to get file name by using the code below(it works...) Thanks for
the link on associating extentions, its exacly what I needed.
regards,
Marco
static void Main(string[] Args)
{
string strInputFile = null;
if(Args.length == 1)
{
strInputFile = Args[0];
}
Application.Run(new Form1(strInputFile);
}
public Form1(String strInputFile)
{
initializeComponent();
strLocalVar = strInputFile;
}
private void Form1_Load(object sender, System.EventArgs e)
{
//do stuff
if(strLocalVar != null)
{
//Do file stuff
}
}
"phoenix" <pa******@skynetWORK.be> wrote in message
news:er**************@TK2MSFTNGP09.phx.gbl... "Marco Martin" <ma**********@sympatico.ca.antispam> schreef in bericht news:%W********************@news20.bellglobal.com. .. Good Day Group,
I'm trying to make my application open and run some code when a user clicks on a file with an associated extension. This is *my* understanding of what actually happens, please correct me if I am wrong. I've searched the
net, but there doesn't seem to be much on the subject.
Google returns plenty of hits. Just use " fileassociation "c#"
" 1) When using the DotNetPackager (called dotfuscator I believe), we can associate files with a specific extension to a specific program. Basically just a registry key being written. Perhaps there is a way to check this through code and actualy write to the registry if there was a mistake?
Check http://www.mentalis.org/soft/class.qpx?id=5 It contains both a C#
and VB.Net version with examples.
2) when a user clicks on an associated file, its like a command line argument i.e.: "myApp.exe" "c:\myPath\myFile.aaa".
yes
3)In order to use the file, the Main() must accept Args. ie"static void Main(string[] Args) at which point I can access the filename by
accessing the Args[0] of the Main and store it in a variable in my program.
No, you still need to use Main() without arguments but then use Environment.CommandLine to get the commandline data.
Please let me know if there's anything else I should know about, or if
my understanding is erroneous.
Thanks and best regards,
Marco
Yves
Thanks Yves,
I managed to get file name by using the code below(it works...) Thanks for
the link on associating extentions, its exacly what I needed.
regards,
Marco
static void Main(string[] Args)
{
string strInputFile = null;
if(Args.length == 1)
{
strInputFile = Args[0];
}
Application.Run(new Form1(strInputFile);
}
public Form1(String strInputFile)
{
initializeComponent();
strLocalVar = strInputFile;
}
private void Form1_Load(object sender, System.EventArgs e)
{
//do stuff
if(strLocalVar != null)
{
//Do file stuff
}
}
"phoenix" <pa******@skynetWORK.be> wrote in message
news:er**************@TK2MSFTNGP09.phx.gbl... "Marco Martin" <ma**********@sympatico.ca.antispam> schreef in bericht news:%W********************@news20.bellglobal.com. .. Good Day Group,
I'm trying to make my application open and run some code when a user clicks on a file with an associated extension. This is *my* understanding of what actually happens, please correct me if I am wrong. I've searched the
net, but there doesn't seem to be much on the subject.
Google returns plenty of hits. Just use " fileassociation "c#"
" 1) When using the DotNetPackager (called dotfuscator I believe), we can associate files with a specific extension to a specific program. Basically just a registry key being written. Perhaps there is a way to check this through code and actualy write to the registry if there was a mistake?
Check http://www.mentalis.org/soft/class.qpx?id=5 It contains both a C#
and VB.Net version with examples.
2) when a user clicks on an associated file, its like a command line argument i.e.: "myApp.exe" "c:\myPath\myFile.aaa".
yes
3)In order to use the file, the Main() must accept Args. ie"static void Main(string[] Args) at which point I can access the filename by
accessing the Args[0] of the Main and store it in a variable in my program.
No, you still need to use Main() without arguments but then use Environment.CommandLine to get the commandline data.
Please let me know if there's anything else I should know about, or if
my understanding is erroneous.
Thanks and best regards,
Marco
Yves
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Che |
last post by:
I have the following code
/*
WinTest.java
*/
import java.io.*;
|
by: BoonHead, The Lost Philosopher |
last post by:
I think the .NET framework is great!
It's nice, clean and logical; in contradiction to the old Microsoft.
It only saddens me that the new Microsoft still doesn't under stand there own...
|
by: Gos |
last post by:
Hi,
I have a program that needs to open a list of attachments
displayed on a ListView. I have used Process.Start method to open the
files using their associated program. This works correctly if...
|
by: Shane Story |
last post by:
I want to be able to get the icon associated with a certain file extension.
I can read the registry hkey_classes to get the ext. then look to the other
key for default icon.
How can I then...
|
by: IcingDeath via DotNetMonster.com |
last post by:
I am building this SQL Server database app in which i can store files. In
order to display files I want to have the app show the associated icon for
the extension of the file that is in the...
| |
by: pamelafluente |
last post by:
Hi guys, I have a little question (hope it's not dumb) ;-)
I have a form, containing a TreeView, say TreeView1, I want to to add a
file to the tree:
Sub AddFile(ByVal MyFile As...
|
by: cj |
last post by:
I run this program and to exit click the X in the upper right corner.
But apparently it isn't really ending the program. If I return to VB
and make changes then try to rebuild the app it says the...
|
by: memoman |
last post by:
Can any body help me in that program ???
mail me if anybody could reach any -helpfull- thing
Write a C++ program that namely insert, delete, and search in a fixed record length file (containing...
|
by: plbaldri |
last post by:
I have written a very simple and basic program for an intro Comp Sci class and am having trouble with it crashing. The program needs to accept a filename on the command line at the prompt and has to...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |