Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




File Association


I've tried to search google, for file association in vb, but i always get errors...
Somethimes i get error like, can't edit hkey_class_root or something...

So can anyone explain how to make my own file extension?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Open A File With Default Text Editor That Has No File Association
I wrote a program that creates a log file and then opens it using whatever program is associated with the extention log.  This works fine as long as the user has associated log with a program.  If user does not have log associated with a program, I trap the error and open the log file using notepad.  What I'd really like to do in that case is open the file with whatever text editor is associate with txt files (many of my users do not use notepad as their default).  Any idea how I can determine which program is associated with txt files in that case?

File Association
Hello, anyone knows where to find a good tutorial on file association. i've found some code about this but haven't be able to undestand the hall scope. What i need is to create my own shortcut for my application and the files saved, linked to my program. When clicked on a file made from the app, first i need to make some adjustments in my application then make the information visible.

File Association
When my program runs for the first time on a computer, it associates a certain file type with itself, by adding the appropriate entries to the registry. When I right click on a file with my extension, choose "Open With..." and then click on my app, my program runs and displays the contents of whatever file I'd just opened - Success! However, if I double-click the file, or right click and choose open, my app runs but the filename is not passed to my app. This doesn't really make sense to me - anyone know how to fix this?

The registery changes I made are the following:

Created 'HKEY_CLASSES_ROOT.myext' and changed default value to 'MyApp.Doc'

Created 'HKEY_CLASSES_ROOTMyApp.Docshellopencommand' and changed default value to '"C: hepathofmy.exe" "%1"'

Why will clicking "Open" not work, when using "Open With..." is doing the exact same thing, but works???

Help!

File Association
I have about 700 files that are not defined. I want to associate all of them to be .smc files. How do i go about doing this without the monotonous procoess of renaming/reassociating each one individually?

-Thanks in advance!

File Association
Hi Folks

I was wondering if anyone knew how to associate a file to an executeable that I have writen so that the file opens the application, and the application then knows what to do with the file?

The program is a stand alone database application and the file is a monthly update. The idea being that the file can be double clicked to perform the update as opposed to the user selecting the file (which is what happens at present).

I know how to set up file association through the windows settings/folder options but was looking for a programatic solution. Any ideas?

PS the database HAS to be standalone! - if I was allowed to establish a connection my life would be so much easier!


Thanks in advance

File Association
Hi All!

I am developing my own Mp3 Player, and would like to associate all ".Mp3" Files with it...
I know I can use the "Command" Function in VB, And I also know how to associate filetypes.

...But, I would like to know how I can overcome the following problem...
When I select multiple files in explorer, I want them to be added to the playlist just like WinAmp does.
Winblows opens a new instance of my program each time.

I saw a post on this board, which said that someone would have to do something like this...
1) Check if program is already running!
2) Use the FindWindow() stuff
3) SendMessage() -- Pass it to the other instance

How would I do something like this?
Thanks a lot in advance...

With Friendly Regards,
Kevin

File Association
We have ftp macros set up as .vbs files. Clicking on them ran the macros in the CuteFTP transfer engine. Made the mistake of reassociating .vbs files to a text editor and now the macros won't run in Cutre even though the extension has been changed back from .txt to .vbs. How can we undo our error? Thanks!

File Association?
I know how to associate the file type with my software... but how do I get my program to recognize that a file type has called it? So let's say I made a text editor, and when you open a text file, it launches my program. The text file should be open inside it, right? How do I make that happen?

Thanks!

File Association
Hi there!

How can I open a file having the it's extension?.

eg: My system returns ".doc, .bmp, .jpg.........etc", and I want to open the file using Windows File associations. Is it possible to do it ??

Thanks in advance and have a great weekend!!!!

File Association.
Boy this is difficult when you can't see what is happening!

I'm trying to get my app to load a txt file when I double click it. Apparently the double clicked file name is stored in a variable named "Command$". In my child form I have these lines


Code:
If Command$ <> "" Then
FileCopy Command$, App.Path & "Undefined.ini"


I have an error trap :

Code:
MsgBox "Error " & Err.number & " (" & Err.Description & ") on line " & Erl & " in Form_Load of FrmInput" & Command$


Which produces the line :

Code:
Error 52(Bad file name or number on line 30 in Form_Load of FrmInput"C:Documents and SettingsSamRDesktopPunching Shear 1.PShear


I remember in the olden days that filenames couldn't contain spaces. Is this the case with Command$. Is there a way around this or is there something I'm not seeing?

File Association.
I'm trying to associate a file extension with my program using code from the codeback. For some reason the file type is created but not the association (opens with). This is the calling line that I've modified to suit my program.

http://vbforums.com/showthread.php?t=241188

What's does %1 and the ,-1 do? Are they surposed to be there?
Also, what's the difference between the sEXE and sCommand variables? Why would they need to be different and why is one optional?


Code:
AssociateMyApp "PUNCH Project", App.Path & "PUNCH.exe %1", "PShear", App.Path & "PUNCH.exe,-1", App.Path & "Perim.ico"

File Association
Hi all,

http://www.vbcodemagician.dk/tips/files_association.htm

I am using the site above to link zip files to my application (ZIP Archiver). Its working fine, icon changes and on the double click of the file, my application is executing. How can I pass filename to my application as parameter so that I may be able to extract the file directly.

Thanks.

File Association Example Zip?
Hi,

Can anyone post an example project on how to work file associations? Preferably an example project where it shows you how to create your own file extensions and then associate that file type with a specific application. Thanks in advance.

File Association ??
I have made a program which makes a data file, with a single table, and saves the files with an extension .ndt, and saves whichever data is added to it. Another application ( data retriver) Opens it, opens the table, and shows all the records in the data in a MS Flexgrid. Now this part is completed.

What I wanted next is to make a file association ( of .ndt file with the data opener). I made the file association manually. & associated the "Open" action for the .ndt file to the data retriver.

Now when I double click on the data file, the data retriver is started, but the data file is not loaded into it. How can I do this ?

File Association
Umm...how do you change the file association of particular extentions from within VB?

File Association Help
This is the problem though you know when a person clicks start browse and opens a file and it goes to that program, and the information is opened up. Like when you open a word document and the information opens up in the textbox. Well I have three listboxes that I save the information in and open it when the user clicks open and then selects the file. Is there a way that I when the user clicks start browse and selects the file they saved by using my program the information saved is opened in the three listboxes. Here is the code I used in the open box, the code splits the information in three listboxes.

[highlight=VB]
cdbexpenditures.Flags = cdlOFNOverwritePrompt + cdlOFNExplorer
cdbexpenditures.Filter = "Expense files (*.exp)|*.exp"
cdbexpenditures.CancelError = True
cdbexpenditures.ShowOpen
sfilename = cdbexpenditures.FileName

Open sfilename For Input As #1
Do While Not EOF(1)
Line Input #1, sfilename
strlistdata = Split(sfilename, "::")
list1.AddItem strlistdata(0)
List2.AddItem strlistdata(1)
List3.AddItem strlistdata(2)
Loop
Close #1
lblexpense.Caption = ""
lbldate.Caption = ""
lblprice.Caption = ""
[vbcode]

File Association
How do I associate a file with my application and display my progrms icon for the file icon, through code?

File Association
Right, here's how it goes:

I have created a peice of software and need to be able to have the *.pba files associated with it so that when you double click them they load in my software.

I can create an association in windows easily and make it run my prog from a double-click but I can't get it to then run the open file module. The prog just loads with no file open as if it was run in the normal way.

Any tips would be great.

Is there some way to tell that the prog has been run from clicking on an associated file?

Cheers in advance

Nick
----------------------------------------------

File Association
I want to associate a file extension I have devised for my application. This was the easy bit. How do I now get my program to open and load the (RTF) file into the RTF Box and also create the file association when the program is first run. If someone can point me in the right direction I would be most grateful.


Thanks in advance

Rich


Richard Hare
Haresoftware

Agr! File Association
Does anyone know the link to the tip about file association on Vb-world.net? Their search function isn't working for me, and I can't find it! I just want to know how to associate a file with my program!

File Association ...
How do i associate files with my app? and can i prevent the users from openin' those files with another app?

File Association
If i have created file association in the windows registry how can i check it is still working next time the program runs?

Thanx
IceSoft

Please Help With File Association
How can I retrieve the file path and file name of the file who is double-clicked and who open my application ?

If it is possible, I need a working example !

Thanks !

How Do I Get A File&#039;s Association?
How do I get a file's association?

E.G.
blahblah.txt ---> Text file
blahblah.doc ---> Word document
blahblah.exe ---> Executable


-----------------
Niv
steiny@netvision.net.il

File Association
I suceed in associating a file to my program but can't get the program to open the file, can anyone help and also explain how to use the "program.exe %1" statment,

Thanks

File Association
Trying to create a file association in VB. Everything I'm doing works fine with one slight problem. It doesn't work until I actually go into folder options and edit the open action. I Do not not actually edit anything though, just going in seems to set it to begin working. Does anyone know why I have to do this. I don't want users to have to do this for my program. Re-booting doesn't set the file association either.

File Association
I have made my program so it is associated with a certain extension, lets say .abc for example. When i open a .abc file my program opens up, but i don't know how to get the path of the .abc file i open to be recognized by my program so it can do whatever it needs to do to that file. Any ideas on how i can do this?

File Association, Please Help
Is there a way to get the icon that is associated with a certain extentision and put it into a imagelist or picturebox. I am using vb6 and havent been able to find any code to do this so far

File Association
how can i make a code that when i double click on a file in a file-list, will execute the file with the program that it is associated with ?

File Association
I have a picture program. I want to make it default viewer of JPG files.

Dim strCmdLine As String

strCmdLine = Command$()

If strCmdLine<>"" Then
'Open the file
End If

When I double click a JPG file in explorer, it works well.

But now the problem is:

I have opened 1 file. When I double click the second file in explorer, my program can't replace the first file with the second one.

Anyone could help?

File Association?
How can i make it so that all of the files with my extension (*.sur) will make my program open up that file? Thanks again!

File Association
How to get file assocaition in VB ?I have a file open dialog box.If I select a doc file it should open it with latest MSword,if it is pdf it should open in Acrobat reader etc.I can't use word objects or shell command bcoz i will have to hard code the progID which is diff. for diff. versions of word. like Word.Application.8, Word.Document.6 etc.
Any suggestions ???
Thanx in advance.

File Association
I have written programs using C++/MFC and it is relatively easy to associate a file extension with my program. So that when, in the File Manager, the user clicks on a '*.LIQ' file it knows to open it with my application.
Is there a way to do this in Visual Basic?

Rob.

File Association Question
Hey. I already know how to setup my installer to make my program open a file and how to open the file from the command$ string. My question is how do you make your program open a file when it is already running? My software only runs 1 copy on the machine at a time. Is there an easy way to send it a message like "Hey buddy grab this file:". I'd prefer something like interupt driven where i'm not polling something with a timer every 100ms or so. It seems like MS word and many other programs have some standard functionality with this. Thanks!!!

Professional File Association
There is a lot of code around for file association. What I mean by this is API calls that associate a custom file type with your VB program so that it has a nice icon, opens by double clicking, etc.


My concern is - it seems a bit like "hacking" the registry. What is the professional way of doing this? Should the user have the option? Should there be a "disaccociate" option that deletes the key (I could not find code for this). Should the installer take care of this issue rather than doing it in the body of the program with API calls?


All opinions welcome - but my question is for those that have distributed code to others - if I wasn't doing that, I'd be satisfied with the API calls - they work fine.


Thanks.

File Association Problems
The name of my program is MultiText. You can open more than one text document at a time and each one gets its own tab. The program works fine. However, I figured out how to write to the registry to get my app to associate with files of its extension. It works great when I open one file, either by double-clicking the file or dragging it onto my app, but something strange happens when I do two. If I drag multiple files onto the app's icon, they both open fine. But when I select multiple files, right click, choose "Open", the program doesn't even execute. I am almost certain that the problem lies within the association in the registry. Even if I change the first line of my program to msgbox command, it shows fine when I open one file, but when I do multiple files, it doesn't even show (so obviously the program isn't even executing.) What I write in the registry to HKEY_CLASSES_ROOTMultiTextshellopencommand is: "C:whatevermultitext.exe" %1 . That is with quotes. The problem, I think, is the %1. What do I use instead to make the association pass on the right path to the app?

INNO - File Association
I want to create file association for my program..
It means that I want to double click on my file...that was created by my program. It's a new extension...And now...
How could I setup INNO to open this file with my program?
Do I even use INNO for it?
Tnx!

File Association And MDI Form
Hi all,

How can I load a text file in a richtexbox use on a MDIchild by using file association?

Can any on help?

Thanks in advance

Easy File Association?
Is there anyway to make easy file association? Like all i want is when a user clicks a certain file it launches my program

any ideas?

Receiving File Association
Hello,

I have a program working with some file extensions associated with it. I have my program set up right now so that if one instance is open and the user double clicks on a file in Windows Explorer, the new instance that is opened passes the value for Command() to the previous instance and then unloads itself. But, I am having a problem if the user multi-selects files in Windows Explorer and then hits enter. The program should load all the files one at a time. But all of the instances try to send the value for Command() at once and the initial instance is having problems procession all the values at once. Anybody have any pointers on how to fix this? Thanks

File Association And Command()
In my installation (using Inno Installer) I've associated files with the extension .dsh to be opened with my application, dashboard.exe.

That works as far as opening up dashboard when dbl clicking on a .dsh file.

What I also need though, is to pass the name of the file that was dbl clicked on, to dashboard so it can display the guts of it.
I thought I could use command() to get it but that doesn't work.

How do I do this?

Thanks.

File Association/Setup.exe
I have two quetion that are somewhat related.
1.) I want to create a file type for my application. I have no problem doing this, except for two things. When I create the open command I it only takes the application that is associated the %1 gets truncated. And I can not seem to get the icon that is packaged with the application.

2.) After I do this I want this to run one time during the setup, and not everytime the application is going. How do I make an .exe that only runs during the setup.

Thanks in Advance

File Association Problem... Anyone Help?
I am making an MP3 player using Media Player and I want to be able to double click on an MP3 and it to load up in my player. I can associate the program to open when an MP3 is clicked but can't get it to load. Can anyone help?

Thanks

Charlie

File Association Problem
Can someone please help me here.

I have associated a file type with my application that refuses to load and I have no idea why.
With these three lines of code

20 sourcefile = Command$
30 MsgBox sourcefile
40 If Dir(sourcefile) = "" Then MsgBox sourcefile

I get the messagebox showing the correct filepath of the double clicked file but then I get an error on the next line saying “Error 52 (Bad file name or number) on line 40......”

Why? It's got me dumfounded.

File Association With MDI Application
For some reason I don't think that there is going to be a simple answer to this question.

I have an MDI application however whenever I double click a file with the document extension that is associated with my app a new instance of the application opens acting like an SDI application. I would like windows to check if my program is already open and if it is then open the document inside the currently opened instance rather than creating a new one. Is this possible?

File Association Problem
I've used this to associate my application. It was all working well a while back but now for some reason my application document files are associated with VB6.0 rather than my application. What could have caused or be causing this?

Is there a better way to associate my application? Can it be done in innosetup?

File Association Problem
Probably not be the right forum to be posting this in but as a VB6.0 project it's somewhat related.

I've used thislink to associate my app. It was working but I'm having difficulties with it now.
For some reason I can't delete the file association that I created.

I know I should use Innosetup and probably will do from now but...

Can anyone suggest why it is not deletable?

Program Association With File
Hi all again!

I have associated files with a certain extension (.PShear) with my MDI application.

This is a little hard to explain....

I have a .ini file that contains all the information of the currently opened form. When I save the opened form it copies the .ini file to the file name that the user defines. Not sure if it's the way it should be done but...

When I open my program from a shortcut by default it opens the .ini file as "Document 1".

Problem is that when I double click any file with the associated program extension it opens the data of the .ini file and not the data of the file that I have double clicked.

Does this make sense? Is there a way of double clicking the file and opening the data in the file rather than the default .ini file?

File Icon Association
Hello and thank you for reading this post. My question is a general one. I'm thinking it would either involve too much work and/or stuff I don't know.

You know when you create a document in word, two things are associated with the file. The file's icon is one universally known to be a word document and when you open that icon, Word automatically starts up to open it. I'm mostly interested in the first part because the second would require me to actually make my program open the file up. I want the file that my program creates to have a specific icon but not to actually be opened with my program.

Any help would be greatly appreciated. Thank you.

PS - using VB5

Copyright © 2005-08 www.BigResource.com, All rights reserved