Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Shortcut making .ini behaving abnormally

Shortcut making .ini behaving abnormally

Scheduled Pinned Locked Moved C / C++ / MFC
question
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    insanely420
    wrote on last edited by
    #1

    Greetings... My application createas .ini file to store some data. I have installer which creates a shortcuts to the .exe the Program Files directory and creates two icons in the start menu and in the desktop. When I run the application through the desktop shortcut, the .ini file is getting created in the Program Files directory which is what I expect. But when I run the application from the Start menu shortcut, the .ini is getting created in the Start Menu diorectory which is causing the .ini file to be also shown in the Start Menu, which I dont want. In my application I am using the following method which I belive is wrong - CreateFile ( "Application.ini", ........ ); How can I make sure that the ini is created in the directory of the program and not anywhere ? Thanks in advance. Rgds Ritesh

    J D 2 Replies Last reply
    0
    • I insanely420

      Greetings... My application createas .ini file to store some data. I have installer which creates a shortcuts to the .exe the Program Files directory and creates two icons in the start menu and in the desktop. When I run the application through the desktop shortcut, the .ini file is getting created in the Program Files directory which is what I expect. But when I run the application from the Start menu shortcut, the .ini is getting created in the Start Menu diorectory which is causing the .ini file to be also shown in the Start Menu, which I dont want. In my application I am using the following method which I belive is wrong - CreateFile ( "Application.ini", ........ ); How can I make sure that the ini is created in the directory of the program and not anywhere ? Thanks in advance. Rgds Ritesh

      J Offline
      J Offline
      Joaquin M Lopez Munoz
      wrote on last edited by
      #2

      Try with ".\\Application.ini". Joaquín M López Muñoz Telefónica, Investigación y Desarrollo

      1 Reply Last reply
      0
      • I insanely420

        Greetings... My application createas .ini file to store some data. I have installer which creates a shortcuts to the .exe the Program Files directory and creates two icons in the start menu and in the desktop. When I run the application through the desktop shortcut, the .ini file is getting created in the Program Files directory which is what I expect. But when I run the application from the Start menu shortcut, the .ini is getting created in the Start Menu diorectory which is causing the .ini file to be also shown in the Start Menu, which I dont want. In my application I am using the following method which I belive is wrong - CreateFile ( "Application.ini", ........ ); How can I make sure that the ini is created in the directory of the program and not anywhere ? Thanks in advance. Rgds Ritesh

        D Offline
        D Offline
        Daniel Ferguson
        wrote on last edited by
        #3

        It sounds like your two shortcuts are using different 'Start it' folders. (Look at the properties of the shortcuts) You can either make sure that both shortcuts use the same folder, or you can use an absolute path in your program to access the ini file.

        as long as I live it will be fine / there's nothing what I can do /
        the world will die and so do I / so why should I take care
        'Take Care' Funker Vogt

        I 1 Reply Last reply
        0
        • D Daniel Ferguson

          It sounds like your two shortcuts are using different 'Start it' folders. (Look at the properties of the shortcuts) You can either make sure that both shortcuts use the same folder, or you can use an absolute path in your program to access the ini file.

          as long as I live it will be fine / there's nothing what I can do /
          the world will die and so do I / so why should I take care
          'Take Care' Funker Vogt

          I Offline
          I Offline
          insanely420
          wrote on last edited by
          #4

          Thanks. What is the best method to know the directory in which .EXE is being executed ? Ritesh

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups