dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 2 FirstFirst 12
Results 16 to 16 of 16

Thread: Connect database when start with Windows

  1. #16
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,173

    Re: Connect database when start with Windows

    Quote Originally Posted by capint
    Arjay, thank you so much.
    I really couldn't do any thing without your help
    I learned from your code that we can cast CString to _bstr_t and with my previous solution I still can solve my problem.
    I still don't understand why the app can't load mdb files while they're put at the same directory ...
    Thnks again Arjay !
    Your welcome.

    As far as why the app can't load an mdb file when it's in the same directory.

    That's a good question.

    I can think of a few of answers to that:
    1) The working directory (or 'start in' directory) has been set to something other than the location of the exe.
    2) The process has been started with CreateProcess (and the working directory has been changed like in 1)).
    3) A start menu short cut to the item has been created (like the one you would get from the startup menu). ...and the working directory has been set to something other than the exe's directory.

    Given that, take a look at the startup menu item for your application. Just right click on the item and select 'properties'. Notice the 'target' and the 'start in' edit boxes. The 'target' is the full path to the exe you wish to launch. The 'start in' edit box is the working directory used when the app starts up. They may not match. If the 'start in' folder is blank, (I believe) the location of exe is used.

    See the screenshot of one of my startup items - Pidgin. Notice how the startup location is different from the folder where the exe is located?
    Attached Images Attached Images  

Page 2 of 2 FirstFirst 12

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)