View Full Version : How to find the AutoCAD product name from VBA
kishorev99
2008-11-19, 03:24 AM
Hello,
I would like to know on which AutoCAD Product my application is going to run by the user.
For example user will run the VBA application either in AutoCAD 2004 or AutoCAD 2005....to AutoCAD 2009. I would like to know what is the product name before user proccced further with my application.
I tried with Application.Version but i am not sure is this the correct way to differentate the products.
With regards,
Kishore V
rkmcswain
2008-11-19, 01:03 PM
Application.Version is one way.
17.2 = AutoCAD 2009
17.1 = AutoCAD 2008
16.2 = AutoCAD 2006
15.05 = AutoCAD 2000i, and so on.
Ed Jobe
2008-11-19, 04:07 PM
Sometimes you need to get the vertical app's name, because Application.Version always refers to acad.exe, which doesn't indicate which product is running. Therefore I wrote this function.
Public Function GetVerticalAppName() As String
Dim strName As String
strName = AcadApplication.Caption
'strip the dwg from the caption
strName = Left(strName, InStr(1, strName, " -"))
GetVerticalAppName = strName
End Function
B_Roche
2008-11-20, 01:47 AM
So, I had to write an "anti-function" ...
Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As Long
Sub Main
Dim AcadHwnd as long
AcadHwnd = Application.Hwnd
SetWindowText Application.hwnd, "NotePad"
End Sub
rkmcswain
2008-11-20, 02:05 PM
Be aware that 3rd party apps can change the title bar text.
You might also consider reading the registry for the product install.
Start here:
HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\[product]\[version]\[uniqueID]\
(Where the red items vary)
Look for ProductCode, ProductName and/or ProductID
kishorev99
2008-11-21, 05:19 AM
Thank you for all of you.
Kishore
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.