TRY
oWord := CREATEOBJECT( "Word.Application" )
if VAL(oword:Version) < 12
msginfo("Sie haben nicht die notwendige WINWORD-Version installiert!")
else
MsgInfo( oword:path )
endif
endif
oWord:Quit()
CATCH
msginfo( "Fehler mit : CREATEOBJECT Word.Application" )
END
static eOfficeVersion StringToVersion(const CString& versionString)
{
// mapping between the marketing version (e.g. 2003) and the behind-the-scenes version
if(_T("7") == versionString){
return eOfficeVersion_95;
}else if(_T("8") == versionString){
return eOfficeVersion_97;
}else if(_T("9") == versionString){
return eOfficeVersion_2000;
}else if(_T("10") == versionString){
return eOfficeVersion_XP;
}else if(_T("11") == versionString){
return eOfficeVersion_2003;
}else if(_T("12") == versionString){
return eOfficeVersion_2007;
}else{
return eOfficeVersion_Unknown; // added another ???
}
}
Dim WSHShell, objFSO, textout
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set WSHShell = CreateObject("WScript.Shell")
Dim part(4,1)
part(0,0) = "Word" : part(1,1) = "WINWORD.EXE"
part(1,0) = "Excel" : part(2,1) = "EXCEL.EXE"
part(2,0) = "Outlook" : part(4,1) = "OUTLOOK.EXE"
part(3,0) = "PowerPoint" : part(0,1) = "POWERPNT.EXE"
part(4,0) = "Access" : part(3,1) = "MSACCESS.EXE"
textout = "Installed Office-Applications :" & vbCRLF & vbCRLF
Call ChkOffice("12.0","2007")
Call ChkOffice("11.0","2003")
Call ChkOffice("10.0","XP")
Call ChkOffice("9.0", "2000")
Call ChkOffice("8.0", "97")
MsgBox textout,64,"CheckOffice.vbs"
Function ChkOffice(ver, verfull)
Dim pfad, res, helptext
On Error Resume Next
pfad = "HKLM\Software\Microsoft\Office\" & ver & "\Common\InstallRoot\Path"
res = WSHShell.RegRead(pfad)
If res <> "" Then
For i = 0 to 4
If objFSO.FileExists(res&part(i,1)) Then
helptext = part(i,0) & Space(1) & verfull & " (" & objFSO.GetFileVersion(res&part(i,1))&")"
textout = textout & helptext & vbCRLF
End If
Next
textout = textout & vbCRLF
End If
End Function
FUNCTION GetAllApps ()
LOCAL oWmi, objWMI, oApp
LOCAL strComputer := ".", aApps := {}
local objWMIService, colitems,objitem
oWMI := CheckWMI ()
IF oWMI != nil
objWMI:= oWMI:ConnectServer()
CursorWait ()
oApp:= objWMI:ExecQuery("SELECT * FROM Win32_Product")
For Each objItem in oApp
AAdd (aApps, {cValToChar(objItem:Description), cValToChar(objItem:Version)})
Next
CursorArrow()
Asort(aApps,,, {|x,y| x[1] < y[1] })
ELSE
? "WMI not installed"
ENDIF
RETURN (aApps)
//-------------------------------------------
FUNCTION CheckWMI ()
LOCAL oWMI, oErr
TRY
oLoc := CreateObject( "wbemScripting.SwbemLocator" )
CATCH oErr
oWMI := nil
END
RETURN (oWMI)
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 36 guests