Jump to content


Photo

Make the executable open a file on start


  • Please log in to reply
3 replies to this topic

#1 master123

master123

    GMC Member

  • GMC Member
  • 57 posts
  • Version:GM8

Posted 09 March 2012 - 11:45 AM

I want to be able to open files that are either dragged into the exe (not running) or opened with explorer. What l mean is like opening a video file using vlc by either double clicking it or opening with vlc before it is running (right click - open with - vlc...).
  • 0

#2 filulilus

filulilus

    GMC Member

  • GMC Member
  • 928 posts
  • Version:GM:Studio

Posted 09 March 2012 - 12:00 PM

You need a DLL to be able to drag files to the window but you can start the program from files by using the parameter functions in the "game start"-event.

if parameter_count() > 0
{
    fileToOpen = parameter_string(1)
}

Not 100% sure about the following part, its been a while since I tried it:
Keep in mind that the program will think that it is running from the folder from which the file executed the program.
For example, it will change working_directory to the file folder.

Edited by filulilus, 09 March 2012 - 12:06 PM.

  • 0

#3 master123

master123

    GMC Member

  • GMC Member
  • 57 posts
  • Version:GM8

Posted 10 March 2012 - 05:43 AM

i tried that last time it did not work, but tried it again and it worked.... funny!

Any way i am trying to make my program a defalt program for the file extension how do i do that.
  • 0

#4 filulilus

filulilus

    GMC Member

  • GMC Member
  • 928 posts
  • Version:GM:Studio

Posted 10 March 2012 - 09:28 PM

You can simply right click the file and change it but if you want it to happend automatly you need to change the registry keys, you can do it with GM functions.
I'm sure you find something usefull here, else google it.
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users