Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Syntax for RegistryTools 1

Status
Not open for further replies.

Tobin1

Petroleum
Nov 9, 2007
176
Howdy,

I hope I'm asking this question correctly :).
I recently got my hands on a copy of SW2009 (liking it so far :D ). So I wanted to try to update my method for accessing the Windows Registry. I can tell that I need to add the reference to the VBATools library which contains the RegistryTools class, but, can't seem to figure out "exactly" the syntax for using the listed functions (CreateSectionKey, ReadKey, WriteKey, etc.).

I've attached an example of the existing method that requires the module written by Kenneth Ives. It still seems to work fine, but, I wanted to take advantage of the SW2009 API update.

Can anyone update my example or direct me to a "simple" example that demonstrates the syntax for use in SW2009?

Thanks


Tobin Sparks
 
Replies continue below

Recommended for you

Sorry, but I'm really unclear as to what you're trying to do. Are you trying to re-write COM stuff using the VSTA .net stuff? What is the VBATools library you're talking about? I don't see anything that looks like VBATools in my list of available references. What it its filename?

-handleman, CSWP (The new, easy test)
 
Howdy handleman,

Thanks for responding to my post. I'm starting to gain confidence that this can be figured out :).
Attached are a couple of screen shots that I hope will better explain where I found the VBATools library and CreateSectionKey function I would like to use.

My VB2005 book explains the VB.net method as:
My.Computer.Registry.CurrentUser.CreateSubKey("Software\CompanyName\MacroName")
I understand this method doesn't work with the SolidWorks API.

The current method (using the module written by Kenneth Ives) is:
regCreate_A_Key HKEY_CURRENT_USER, "Software\CompanyName\MacroName"
This module method seems to work fine in SW2009, but, I was looking for the syntax for the CreateSectionKey function provided in the VBATools library in SW2009.

I hope I'm not making this worse :).



Tobin Sparks
www.nov.com
 
 http://files.engineering.com/getfile.aspx?folder=9b8f4707-e057-41bd-9cab-ee163d5219ff&file=References.zip
Based on the path shown the References dialog, VBA Tools looks like something that comes with AutoCAD, not SolidWorks. I don't have a file named VbaTools anywhere on my hard disk.

Unless I'm mistaken, you can't use .net stuff in .swp type file. If you go to the VSTA type .net macros new in 2009 then you can use .net stuff.

-handleman, CSWP (The new, easy test)
 
handleman,

OH! After I sent the last post I was asking myself - why would you say you didn't have VBATools - then it struck me - all those libraries are found anywhere on my computer, not just in SolidWorks directories, even though I had to get to them thru the SolidWorks API. DA!

So - I'm not at all familiar with VSTA.net. I had to look it up. <Visual Studio Tools for Applications (VSTA) allows you to create macros and embed a Visual studio based IDE into your application using C# or VB.> My companies internet blocker prevented further access so I'll have to look into it at home.

I get the feeling that by creating a VSTA.net type macro others will not be able to view the code.
Is that correct?

Thanks for your response - always valuable and informative



Tobin Sparks
 
I'm not really very familiar with the new VSTA stuff. However, I believe the VSTA macros have to be "built" into a .dll before SW will run them. So yes, I believe others will not be able to easily view the code in your built macro. However, I think that it can still be decompiled relatively easily by someone who knows what they're doing, so it's not exactly secure.

-handleman, CSWP (The new, easy test)
 
WOW - I found the VSTA.net macro IDE by starting a new macro and choosing this type. The IDE looks and feels similar to Visual Studio VB.net and recognizes the < My.Computer.Registry.CurrentUser.CreateSubKey()> structure. COOL!. It also starts with a .vbproj file which will have to be saved in the .dll format when your done for use by SW. I'm going to have to experiment to see how much can be copied or imported from the old environment into the new VSTA.net environment. Anyway thanks for getting me started. Here we go 2thumbsup !

Thanks

Tobin Sparks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor