[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 783
  • Last Modified:

File type association using c or c++

Associate the file type to my own exe
ex

if my extension is ".ex"
if i double click the file with extension ".ex"
i should open with "myapp.exe"
0
NaveenKhanna
Asked:
NaveenKhanna
  • 2
1 Solution
 
SreejithGCommented:
You need to Associate File Extension with Shell OPEN command

sample available in
http://www.codeproject.com/KB/shell/cgfiletype.aspx
0
 
NaveenKhannaAuthor Commented:
thanks for the reply
pls provide me c example
0
 
itsmeandnobodyelseCommented:
You could add new file extensions and their associated application by using the explorer. Right-click at a file with that extension, choose the 'Open with ...' menu item, and make the settings that for the given file type always your application should be used. At the command line (dos box) you can do the same using the ASSOC command (type assoc /?).

To open the file using your app after association use

ShellExecute(NULL, "open", full_path_of_file, NULL, "", SW_SHOW);
0
 
NaveenKhannaAuthor Commented:
thank you
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now