ObjectARX
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Determine AutoCAD Type

6 REPLIES 6
Reply
Message 1 of 7
schneider
599 Views, 6 Replies

Determine AutoCAD Type

Hi all,

is there a possibility to determine what type of AutoCAD is running? Standard AutoCAD or Map3D or Civil3D or whatever? I already drag the version info from the currently running acad.exe file, but there is to information about the AutoCAD type saved in the version info. I could parse the path, but that's not a solution for me since everyone can change the pathname to whatever he likes.
Any ideas?
Thanks in advance!

Cheers, Hannes
6 REPLIES 6
Message 2 of 7
davidm_adn
in reply to: schneider

Hannes,

Its in the registry:
HKLM\Software\Autodesk\R**.*\ACAD-****:***\ProductName
Message 3 of 7
Anonymous
in reply to: schneider

How about the AutoCAD _VERNUM variable?

Deelip Menezes

wrote in message news:5319201@discussion.autodesk.com...
Hi all,

is there a possibility to determine what type of AutoCAD is running?
Standard AutoCAD or Map3D or Civil3D or whatever? I already drag the version
info from the currently running acad.exe file, but there is to information
about the AutoCAD type saved in the version info. I could parse the path,
but that's not a solution for me since everyone can change the pathname to
whatever he likes.
Any ideas?
Thanks in advance!

Cheers, Hannes
Message 4 of 7
Anonymous
in reply to: schneider

It's code maybe useful for you:
[code]
static public void AInfo()
{
Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
string AcadVer = Autodesk.AutoCAD.ApplicationServices.Application.Version.ToString();
ed.WriteMessage("\nAcadVersion: {0}", AcadVer);
string ProductKey = Autodesk.AutoCAD.Runtime.SystemObjects.DynamicLinker.ProductKey;
ed.WriteMessage("\nProductKey: {0}", ProductKey);
RegistryKey key = Registry.LocalMachine.OpenSubKey(ProductKey);
string ProductName = key.GetValue("ProductName").ToString();
ed.WriteMessage("\nProductName: {0}", ProductName);
string ProductId = key.GetValue("ProductId").ToString();
ed.WriteMessage("\nProductId: {0}", ProductId);
string ProductCode = key.GetValue("ProductCode").ToString();
ed.WriteMessage("\nProductCode: {0}", ProductCode);
}
[/code]
In ObjectARX you can use:
AcDbHostApplicationServices::getRegistryProductRootKey()
AcDbHostApplicationServices::product()
and so on. Message was edited by: Alexander Rivilis
Message 5 of 7
schneider
in reply to: schneider

Thanks for all replies. I've found a way to definitely distinguish between different AutoCAD releases and versions. For those also facing this problem, here is the way to go:

CString regRootKey = acdbHostApplicationServices()->getRegistryProductRootKey();
CRegistry reg;
reg.Open(HKEY_LOCAL_MACHINE, regRootKey, KEY_READ);
TCHAR buf[200];
ULONG bufSize = 200;
reg.QueryStringValue(_T("ProductName"), buf, &bufSize);
reg.Close();

Now buf is "AutoCAD 200x" for standard AutoCAD-Releases, "Autodesk Map 3D 200x" for Map3D, "Autodesk Civil 3D 200x" for Civil3D and so on.

Thanks everyone for pointing me to the right direction.

Cheers, Hannes.
Message 6 of 7
ZK_BUDiKOM
in reply to: schneider

What is this: CRegistry ??

error C2065: 'CRegistry' : undeclared identifier

Message 7 of 7


@ZK_BUDiKOM wrote:

What is this: CRegistry ??

error C2065: 'CRegistry' : undeclared identifier


Registry Wrapper Class (CRegistry)

 

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"


Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
Expert Elite Member

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost