Hi Bob,
"Inno Setup" is the obvious solution for creating an installation
program for software distribution. It's free, easy to use and more
powerful than you'll ever need.
Although there are more elegant solutions for telling AutoCAD to load
your menus available with C++, here is one which works using lisp:
Copy LoadMyMenu.lsp to the AutoCAD\Support\temp folder with Inno Setup.
This is the program which does the work of loading the menu (and or
other program parts) Note that it gets deleted after its first run
From Inno Setup (with its Code functionality in Pascal script) append
to the Acad.LSP file code to find the LoadMyMenu.lsp, load it if found
and then delete it with code like:
(vl-load-com)
(setq sProgramPath (vl-registry-read
"HKEY_LOCAL_MACHINE\\Software\\Autodesk\\AutoCAD\\R17.2\\ACAD-7000:409"
"Location"))
(setq sAcadLisp2 (strcat sProgramPath "\\Support\\Temp\\LoadMyMenu.lsp"))
(if (findFile sAcadLisp2) (progn (load sAcadLisp2) (vl-file-delete
sAcadLisp2)))
The LoadMyMenu.lsp contains code like:
(defun HowMany ( / i z)
(setq i 1)
(setq z (menucmd (strcat "P" (itoa i) ".1=?")))
(while (= z (menucmd (strcat "P" (itoa i) ".1=?")))
(setq i (+ i 1))
) ; end while
(setq i (- i 2))
) ; End Defun HowMany
(defun MyLandMenu ( / x y sMyProgramPath vEcho)
(setq vEcho (getvar "CMDECHO"))
(setvar "CMDECHO" 0)
(setq sMyProgramPath (vl-registry-read
"HKEY_LOCAL_MACHINE\\Software\\CADApps\\MyProgram" "InstallPath"))
(if (not (= sMyProgramPath ""))
(progn
(if (Menugroup "MyMenuGroup") (command "menuunload" "MyMenuGroup"))
(command "menuload" (strcat sMyProgramPath
"\\MyProgram\\Programs\\MyMenu.cui"))
(setq x (+ (HowMany) 1))
(setq y (strcat "p" (itoa x) "=+MyMenuGroup.Pop1"))
(menucmd y)
(setq x (+ x 1))
(setq y (strcat "p" (itoa x) "=+MyMenuGroup.Pop2"))
(menucmd y)
(setq x (+ x 1))
(setq y (strcat "p" (itoa x) "=+MyMenuGroup.Pop3"))
(menucmd y)
) ; End progn
(Alert "My Program Installation path not found in Windows Registry.
\nMy Program program menus will not be loaded and the
program will not run.
\nThe menu file 'MyMenu.cui' can't be found in the
'...\\MyProgram\\Programs' directory
\n\nIf needed please contact our support.
'[email protected]'
")
) ; End if
(setvar "CMDECHO" vEcho)
(princ)
) ; End Function
(MyLandMenu)
The LoadMyMenu.lsp code can be improved on with further understanding of
lisp and CUI programming, but I never bothered.
If you don't have any Pop menus for your program, then you can omit the
code associated with them.
Regards
Laurie Comerford
wang890 wrote:
> say i programmed 1 or more dll files which each can contain 1 or more
> command which pop up a form once use netload into civil 3d. how do i
> create a installation packate which i can burn on to a disk and
> distribute to other people which once installed, then if the guy start
> civil 3d then he sees the new custom menu and may new tool bars with
> icons. so do i have to create a cui file first, but how to make civil 3d
> know to load the new cui file and the dll files. some dude posted
> something on some discussion group showing people how to install dll
> onto a machine. but that's just for 1 machine. i know how to create
> deployments in .net. but for example look at rdv system, autoturn. how
> does those people make installation package and stick inside civil 3d? i
> know it can be done. nothing can't be programmed programmatically. but i
> need to know how. anybody willing to share some knowledge? i have been
> nice and a keener on answering many people's questions. thank you Bob HMM