Information about EXE version

This forum is for general support of Xbase++
Post Reply
Message
Author
Piotr D
Posts: 129
Joined: Mon Jul 28, 2014 1:26 am
Location: Poznań, Poland

Information about EXE version

#1 Post by Piotr D »

Hi,
how can I read from one Xbase application information about version of another Xbase application on the sam folder (another EXE file, compiled with ARC file with VERSION information)?

Piotr

User avatar
Auge_Ohr
Posts: 1405
Joined: Wed Feb 24, 2010 3:44 pm

Re: Information about EXE version

#2 Post by Auge_Ohr »

hi,

you need to use Manifest and these Entry in *.ARC File

Code: Select all

VERSION
   "CompanyName"      = "Yiu-Software"
   "LegalCopyright"   = "Copyright (c) Yiu-Software"
   "ProductName"      = "DXE_DualTabView"
   "ProductVersion"   = "1.90.0355.51"
   "FileDescription"  = "DXE Rebar,Toolbar,Tabpage,ListView,Statusbar / ot4xb"
   "FileVersion"      = "0.7.9.03"
   "OriginalFilename" = "XCM.EXE"
//
//LANGUAGE = "de"
//
#define MANIFEST_RESID 1
#define MANIFEST 24

USERDEF MANIFEST
  MANIFEST_RESID = FILE ".\..\RES\WIN10.MANIFEST"
---

when have a LNK of App you can look under Property which is Last Entry of Popup-Menu ( CTRL + ENTER )

this CODE will open same Property Dialog

Code: Select all

   WshShell := CreateObject( "WScript.Shell" )
   oShell := CreateObject( "Shell.Application" )
   IF NIL <> oShell
      oFolder := oShell:NameSpace( cPath )
      IF NIL <> oFolder
         oItem := oFolder:ParseName( cFile )
         cName := oItem:name
         WSHShell:AppActivate( cName )

          oVerbs := oItem:Verbs()
          jMax := oVerbs:Count                  // last Entry of Menu
          oVerb := oVerbs:Item( jMax - 1 )
          oVerb:DoIt()
          
          oFolder:destroy()
      ENDIF
      oShell:destroy()
      WshShell:destroy()
   ENDIF

   // remove activeX
   oVerbs := NIL
   oFolder := NIL
   oShell := NIL
   WshShell := NIL
greetings by OHR
Jimmy

Piotr D
Posts: 129
Joined: Mon Jul 28, 2014 1:26 am
Location: Poznań, Poland

Re: Information about EXE version

#3 Post by Piotr D »

Jimmy,
thanks for your tips. What I need is not only display this information but read into variable, like LoadResource(1,XPP_MOD_EXE,RES_VERSION). I will try

Piotr

User avatar
Auge_Ohr
Posts: 1405
Joined: Wed Feb 24, 2010 3:44 pm

Re: Information about EXE version

#4 Post by Auge_Ohr »

hi,

try this for Xbase++ (only)

Code: Select all

      IF !DllInfo(DllName,DLL_INFO_LOADED)
         hDll  := DllLoad(DllName,NIL,.T.)
         lFlag := .T.
      ENDIF

      hDll     := DllInfo(DllName,DLL_INFO_HANDLE)
      fVersion := LoadResource(1,hDll,RES_VERSIONFIXED)
      aVersion := LoadResource(1,hDll,RES_VERSION)

      cDLLpath := DllInfo( hDll, DLL_INFO_PATHNAME )
      ? "load from "+cDLLpath
      ? ""

      // Main Information
      //
      IF LEN(fVersion) > 0
         ? "Product Version: "+LTRIM(STR(fVersion[RES_PRODVER_MS]))+LTRIM(STR(fVersion[RES_PRODVER_LS]))
         ? "   File Version: "+LTRIM(STR(fVersion[RES_FILEVER_MS]))+LTRIM(STR(fVersion[RES_FILEVER_LS]))
         ? "      File Time: "+LTRIM(STR(fVersion[RES_FILETIME_MS]))+LTRIM(STR(fVersion[RES_FILETIME_LS]))
      ELSE
         ? "Product Version: "+"no Information"
         ? "   File Version: "+"no Information"
         ? "      File Time: "+"no Information"
      ENDIF

      // Detail Information
      //
      IF LEN(aVersion) > 0
         FOR J := 1 TO LEN(aVersion)
            ? aVersion[J][RES_VERSION_KEY]+": "+aVersion[J][RES_VERSION_VALUE]
         NEXT
      ELSE

      ENDIF
      ? ""

      // when using DLLload() so DLLUnload now
      //
      IF lFlag
         lFlag := .F.
         DllUnload(hDll)
      ENDIF
greetings by OHR
Jimmy

User avatar
Tom
Posts: 1165
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

Re: Information about EXE version

#5 Post by Tom »

Piotr asked for EXEs. This works for DLLs only.
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

User avatar
Auge_Ohr
Posts: 1405
Joined: Wed Feb 24, 2010 3:44 pm

Re: Information about EXE version

#6 Post by Auge_Ohr »

ask ChatGPT

can you tell me how to use GetDetailsOf and Shell.Application to get Property of file ?
1. Create an instance of the Shell.Application object:

Set objShell = CreateObject("Shell.Application")

2. Use the GetDetailsOf method to get the property of a file:

strProperty = objShell.NameSpace("C:\MyFolder").GetDetailsOf("MyFile.txt", 0)

The 0 in the above example is the index of the property you want to get. You can find a list of available properties and their corresponding index numbers here:

https://docs.microsoft.com/en-us/window ... tdetailsof

3. To get the value of the property, use the GetDetailsOf method again:

strValue = objShell.NameSpace("C:\MyFolder").GetDetailsOf("MyFile.txt", strProperty)
greetings by OHR
Jimmy

Post Reply