DAO

This is a discussion on DAO within the Windows Programming forums, part of the Platform Specific Boards category; Hello, First scenarion : I'm using AfxDaoInit() from win32 C console application it works fine. Second scenario: I created a ...

  1. #1
    Registered User
    Join Date
    Jul 2009
    Posts
    2

    DAO

    Hello,

    First scenarion :

    I'm using AfxDaoInit() from win32 C console application it works fine.

    Second scenario:

    I created a win32 C dll, that has a method below

    Code:
    DLLEXPORT void Init()
    {
        AfxDaoInit();
    }
    I have managed C# .exe that using Interop.Services to call Init function.
    I can see that it reach the Init function, but it fails on AfxDaoInit().

    Is there any problem running AfxDaoInit() from non-GUI thread?
    I'll appreciate your help.

    Thanks

  2. #2
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,655
    >> Is there any problem running AfxDaoInit() from non-GUI thread?

    I'm not sure, but AfxDaoInit is for applications that are properly linked with the MFC libraries, so perhaps they aren't being loaded? On a side note, it looks like AfxDaoInit is deprecated, so you should probably use a more up-to-date API.
    Code:
    #include <ip.hpp>

  3. #3
    Registered User
    Join Date
    Jul 2009
    Posts
    2
    I'm not familiar with DAO and very little with MFC. Can you please explain how can check if MFC libraries are loaded?

    The strange thing is that the same code run perfect from win32 console application.

  4. #4
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,856
    IIRC you need to call

    Code:
    AFX_MANAGE_STATE(AfxGetStaticModuleState());
    iwithin any exported function in a DLL that uses MFC.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. DAO accessing Jet v4
    By Morgan in forum Windows Programming
    Replies: 3
    Last Post: 07-19-2004, 02:23 AM
  2. Using LIKE in DAO
    By zMan in forum Windows Programming
    Replies: 4
    Last Post: 07-10-2003, 04:34 PM
  3. Mfc Dao Access Database
    By LISANANA in forum Windows Programming
    Replies: 1
    Last Post: 07-03-2003, 01:18 PM
  4. using DAO without MS Access installed
    By zMan in forum Windows Programming
    Replies: 2
    Last Post: 02-20-2002, 02:14 PM
  5. dao demo with embedded property sheet
    By zMan in forum Windows Programming
    Replies: 4
    Last Post: 02-09-2002, 05:49 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21