Announcement

Collapse
No announcement yet.

Launch ODBC applet from PB

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Scott Wolfington
    replied
    Thanks Peter. I'll take a look.

    Scott


    ------------------
    Scott Wolfington
    http://www.boogietools.com


    [This message has been edited by Scott Wolfington (edited March 05, 2003).]

    Leave a comment:


  • Peter Scheutz
    replied
    Hi Scott

    You could also look at:

    MSDN:
    HOWTO: Enumerate and Run Available Control Panel Applets
    ID: Q232536
    Last Reviewed: June 10, 1999

    It's C code

    --
    Peter Scheutz


    ------------------

    Leave a comment:


  • Eric Pearson
    replied
    Scott --

    Unfortunately it's not quite that simple. First, there is no correllation between ODBC drivers being installed and the ODBC Manager applet being installed. Testing for one won't tell you about the other.

    To test for the ODBC Manager program I'd get the ENVIRON$ for the Windows system directory (or use an API function to get it) and use DIR$ to look for the .cpl file. If it exists, then you can SHELL to it.

    Testing for ODBC itself is trickier. If the ODBC DLLs are not available, your SQL Tools program won't even start up. You'll get the Windows message box about a missing DLL. If your app may be run on systems where ODBC is not installed (i.e. if your program's installation program does not install ODBC) you will probably need to use a small "launcher" app. It would be a very simple program that tries to use the LoadLibrary API to load one of the "core" ODBC DLLs, such as ODBC32.DLL. If LoadLibrary fails, the program would display a message box and exit. If LoadLibrary works, use FreeLibrary then SHELL to your main app, which would then be able to run.

    -- Eric


    ------------------
    Perfect Sync: Perfect Sync Development Tools
    Email: mailto:[email protected][email protected]</A>

    Leave a comment:


  • Scott Wolfington
    replied
    Thanks gents. Peter, your code worked great under Windows 2000 Server
    too. Eric, what's a good way to see if ODBC is installed? I'm
    thinking of using the SQL_DriverCount function, and if that returns
    0 (zero) then I can probably assume that ODBC is *not* installed,
    or, at least an installation of ODBC that has any use to me. What's
    ODBC without any drivers anyway? What do you think?

    Thanks,
    Scott


    ------------------
    Scott Wolfington
    http://www.boogietools.com


    [This message has been edited by Scott Wolfington (edited March 05, 2003).]

    Leave a comment:


  • Eric Pearson
    replied
    That technique works on NT4 as well. Assuming, of course, that the ODBC manager has been installed on the system. As noted in the SQL Tools Help File (Scott is a SQL Tools user), the ODBC Manager is not "standard equipment" on 95, 98, and ME systems. So you should make sure that it is installed before SHELLing to it, or be prepared for the SHELL to fail.

    BTW, you don't need WIN32API.INC in that program. Including it does nothing but increase your compile-time by about 10,000%.

    -- Eric


    ------------------
    Perfect Sync: Perfect Sync Development Tools
    Email: mailto:[email protected][email protected]</A>

    [This message has been edited by Eric Pearson (edited February 01, 2001).]

    Leave a comment:


  • Peter Scheutz
    replied
    Originally posted by Scott Wolfington:
    Hey all!
    Does anyone know how to launch the ODBC control panel applet
    from PB code? Any push in the right direction would be much
    appreciated.
    Hi Scott

    I have not checked with MSDN, but this seems to work on WIN98 SE:

    Code:
    #Compile Exe
    #Include "win32api.inc"
    
    Function PbMain()
       
       Shell "rundll32.exe shell32.dll,Control_RunDLL Odbccp32.cpl,,1"
       
       
    End Function
    --
    Best Regards
    Peter Scheutz


    ------------------

    Leave a comment:


  • Scott Wolfington
    started a topic Launch ODBC applet from PB

    Launch ODBC applet from PB

    Hey all!

    Does anyone know how to launch the ODBC control panel applet
    from PB code? Any push in the right direction would be much
    appreciated.

    Thanks,
    Scott


    ------------------
    Scott Wolfington
    http://www.boogietools.com


    [This message has been edited by Scott Wolfington (edited March 05, 2003).]
Working...
X