Results 1 to 4 of 4

Thread: how to not specify the location of a file, but still have it read

  1. #1

    Thread Starter
    Member
    Join Date
    Sep 1999
    Location
    Texas, US
    Posts
    45

    Post

    in my program i want to play sounds that would be in the same directory as my prog., but the user can just put the thing in any freakin file they want how the heck is my game gonna know where the sound is. like if i specify in my game that rollerrink.mid is in C:\program files\mygame\gamesounds\rollerrink.mid, but the user puts the game in D:\mycrap\games i got\crappy games then it all get jacked up!

  2. #2
    Hyperactive Member badgers's Avatar
    Join Date
    Sep 1999
    Location
    Madison, WI USA
    Posts
    444

    Post

    you may be able to use app.path to find out where you game is. You can then find the folder relative to your game.
    you need to make sure that the music folder is installed the same way relative to your app
    ex
    D:\program files\mygame contains the .exe
    D:\program files\mygame\gamesounds contains the music
    app.path will retrive the path regardless if it is G:\hi\how\are\you\mygame\


    ------------------
    I am so skeptacle, I can hardly believe it!

  3. #3

    Thread Starter
    Member
    Join Date
    Sep 1999
    Location
    Texas, US
    Posts
    45

    Post

    Thanks man! I tried to do Me.path, but with no luck!

  4. #4
    Guest

    Post

    Here is an example I use in my code to load a picture for example from the same directory as my program.

    example1.Picture = LoadPicture(App.Path + "\example.gif")

    Then it doesn't matter what directory I put the program in.. It will read it from anywhere.

    You can do the same if you add a SUB directory to your app..

    example : C:\myprogram\images\example.gif

    so you would write it this way..
    example1.Picture = LoadPicture(App.Path + "\images\example.gif")

    Hope this helps..


    ------------------
    John T. Mieske
    Knight Vision Enterprises

    [email protected]


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width