Windows API Programmers...

Discussion in 'Archived Threads 2001-2004' started by Steven K, Aug 9, 2001.

  1. Steven K

    Steven K Supporting Actor

    Joined:
    Jan 10, 2000
    Messages:
    830
    Likes Received:
    0
    I've been rifling through the MSDN all day, looking for a good function to find the version number of a DLL file. I've found a few:

    DllGetVersion( )

    Unfortunately, this only seems to work on newer, shell DLL files (not the ones I am trying to access).
    GetFileVersionInfo( ), GetFileVersion( ), then VerQueryValue( )
    This one is very complicated; it involves bit-shifting and I have been running into trouble with it a little bit.
    I just wanted to check with anyone with an advanced knowledge of the WinAPI to see if there exists a simpler way of checking for a DLL version number. If not, looks like Im going to have to go with option #2.
     
  2. David Broome

    David Broome Stunt Coordinator

    Joined:
    Jun 2, 2001
    Messages:
    226
    Likes Received:
    0
  3. Steven K

    Steven K Supporting Actor

    Joined:
    Jan 10, 2000
    Messages:
    830
    Likes Received:
    0
    Hey David,
    This is a good example, too bad it's a VB example (I need a CC++ function). It does use the FIXEDFILEINFO structure, which is what I am implementing now. It's just very long and tedious; there are 3 functions that you have to call in order to get the information, not to mention the bit-shifting.
    The MSDN Library contains all of this information. Unfortunately, reading the MSDN entries can be a more difficult task than actually doing the coding (not to mention, there are several errors in the MSDN Lib).
    On an off subject, someone needs to write a good SAPI book Microsoft Speech API). There is only one SAPI book in existence, and it isn't very good. Strangely enough, the SAPI book that does exist deals with C++ SAPI only; 99% of SAPI programmers out there use COM SAPI.
    There are a ton of SAPI engines out there, and tons of companies integrate Text-to-Speech SAPI engines in their apps.
     
  4. David Broome

    David Broome Stunt Coordinator

    Joined:
    Jun 2, 2001
    Messages:
    226
    Likes Received:
    0
    I had just assumed that you meant VB, sorry about that. Isn't against the Code of C++ Programmers to ask for help? ;-)
    I don't have any C++ examples handy, but if you get stuck let me know and I could probably scare one up.
    I have only messed with SAPI under VB, and yes, I used the OCX's in ver 4.0 of the SDK. Used it to write an MP3 browser that puts all my MP3's into a tree view control (Genre, artist, album, song). When you use the keyboard to move the cursor from node to node, it reads out the text of the node you are on. That way I can move the jukebox into the car for long trips and browse through my music without having to have a monitor or any fancy display devices. Plus it supports my Pronto for instant selection of a song. Quite proud of it, in case you can't tell :)
    I wouldn't want to try it in C++, that's for sure, since I am a little rusty...
     
  5. Bill Spahn

    Bill Spahn Auditioning

    Joined:
    Nov 14, 1999
    Messages:
    13
    Likes Received:
    0
    Steven,
    I use the following to get file version info:
    GetFileVersionInfoSize, GetFileVersionInfo, and then VerQueryValue. For VerQueryValue, I use "\StringFileInfo\040904B0\FileVersion" which assumes that the Language and Codepage Identifier is hardcoded.
    Let me know if you would like the specific code.
    Bill
     
  6. Steven K

    Steven K Supporting Actor

    Joined:
    Jan 10, 2000
    Messages:
    830
    Likes Received:
    0
    Hey Bill,
    I went with GetFileVersionInfoSize, GetFileVersionInfo, and VerQueryValue, and didn't mess with the FIXEDFILEINFO structure (with major and minor version numbers).
    Thanks!
     

Share This Page