none
Absolute/relative path

    Question

  • Hi all,
       I have a problem. I use this instruction in my code:

    ...
     LPCTSTR fileName = (_T("\\sfondo7.bmp"));// RIVEDERE QUESTO
        if (m_bmp.CreateFromFile(m_pRichEditOle, fileName) )
     {...

    But my program don't view the image. If I write c:\\sfondo7.bmp the image is view correctly but I wan't a relative path that take my image in my folder. I can't write the absolute path of the folder, but I want only something like "this folder"
    Is there anyone that can help me?
    Monday, January 25, 2010 12:24 AM

All replies

  • Not sure what you want to do. If you want the path of the current running exe, use GetModuleFileName. If you need help in locating documentation and samples of Windows APIs, visit the Windows SDK forum.

    The following is signature, not part of post
    Please mark the post answered your question as the answer, and mark other helpful posts as helpful.
    Visual C++ MVP
    Monday, January 25, 2010 3:49 AM
  • If ypu want to use current folder write filename without slashes ("sfondo7.bmp")
    But it is better to use absolute folder name extracted from GetModuleFileName function
    Monday, January 25, 2010 8:35 AM
  • Thank you for your answer BomBimBom. I can't use GetModuleFileName because I have developed an explorer bar and when I call GetModuleFileName it return me the iexplorer.exe path. Moreover my project it must be installed from a lot of user and I can't know their path. 
    So I have add sfondo7.bmp without anything but it can't retrieve my bitmpap image. Retrieve it only if is in my desktop. Why this?
    May you help me?
    Thank you very much..
    valerio 
    Tuesday, January 26, 2010 1:25 PM
  • Valerius2003 wrote:
    > Thank you for your answer BomBimBom. I can't use GetModuleFileName because I have developed an explorer bar and when I call
    > GetModuleFileName it return me the iexplorer.exe path.
     
    Pass your HINSTANCE (which you get in DllMain) as the first parameter to GetModuleFileName: you'll get the full path to your DLL.
    --
    Igor Tandetnik
    Tuesday, January 26, 2010 1:40 PM
  • Thank you for your answer BomBimBom. I can't use GetModuleFileName because I have developed an explorer bar and when I call GetModuleFileName it return me the iexplorer.exe path. Moreover my project it must be installed from a lot of user and I can't know their path. 
    So I have add sfondo7.bmp without anything but it can't retrieve my bitmpap image. Retrieve it only if is in my desktop. Why this?
    May you help me?
    Thank you very much..
    valerio 

    I've the similar problem. Have you figured it our? Thanks.
    Saturday, July 24, 2010 8:29 AM