Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: [1]   Go Down

Author Topic: [Solved][C++] Loading files automatically?  (Read 1082 times)

0 Members and 1 Guest are viewing this topic.
[Solved][C++] Loading files automatically?
« on: April 21, 2009, 05:02:09 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 1141
In stead of opening the program first and then selecting a file to open; how can I implement it in C++ so that I can right-click a file and choose "Open with.." => "program name" and the program loads it when it opens?
« Last Edit: April 21, 2009, 11:38:31 pm by sjegtp »
Logged
Re: [C++] Loading files automatically?
« Reply #1 on: April 21, 2009, 08:28:56 pm »
  • *
  • Reputation: +3/-0
  • Offline Offline
  • Gender: Male
  • Posts: 6629
You need to create a file system association. To do this you need to modify the registry.

Here a link to an explanation of how to do it, read the 2nd reply.

http://stackoverflow.com/questions/69761/how-to-associate-a-file-extension-to-the-current-executable-in-c

When the application starts the url of the file to be opened will be passed as the 1st command line argument (well 2nd if you count the executable url).
Logged
Re: [C++] Loading files automatically?
« Reply #2 on: April 21, 2009, 09:13:23 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 1141
Thanks, it worked! :)
Logged

gm112

Re: [C++] Loading files automatically?
« Reply #3 on: April 21, 2009, 10:47:55 pm »
In stead of opening the program first and then selecting a file to open; how can I implement it in C++ so that I can right-click a file and choose "Open with.." => "program name" and the program loads it when it opens?
You'll have to look into Windows Registry to implement this. You could add the key via winAPI, which shouldn't be too hard.
Logged
Pages: [1]   Go Up

 


Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved



Page created in 0.621 seconds with 42 queries.