Author Topic: MS common dialog box in lisp  (Read 10139 times)

0 Members and 1 Guest are viewing this topic.

T.Willey

  • Needs a day job
  • Posts: 5251
MS common dialog box in lisp
« on: January 17, 2006, 05:38:59 PM »
I have seen this code for vb/a
Code: [Select]
Set objDialog = CreateObject("MSComDlg.CommonDialog")
And was wondering if it is possible to use this in lisp?  I have tried
Code: [Select]
(setq tmp (vlax-create-object "MSComDlg.CommonDialog"))
With no luck.  I think it is what I should be doing, but it doesn't work.  I have also tried
Quote
Command: (setq AcadObj (vlax-get-Acad-Object))
#<VLA-OBJECT IAcadApplication 00b60584>

Command: (setq tmp (vla-getinterfaceobject AcadObj "MSComDlg"))
; error: Automation Error. Problem in loading application

Command: (setq tmp (vla-getinterfaceobject AcadObj "ComDlg32.CommonDialog"))
; error: Automation Error. Problem in loading application

Command: (setq tmp (vla-getinterfaceobject AcadObj "ComDlg32.Application"))
; error: Automation Error. Problem in loading application

Any help or direction is appreciated.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

LE

  • Guest
Re: MS common dialog box in lisp
« Reply #1 on: January 17, 2006, 05:50:33 PM »
Only for/or if it is:

ActiveX Automation server's - and before has to be register in your PC

T.Willey

  • Needs a day job
  • Posts: 5251
Re: MS common dialog box in lisp
« Reply #2 on: January 17, 2006, 05:53:52 PM »
So I would have to register this file?

'MSComDlg
'    Microsoft Common Dialog Control 6.0
'    C:\WINNT\System32\COMDLG32.OCX

If so, how?  I don't think I have ever done this before.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

LE

  • Guest
Re: MS common dialog box in lisp
« Reply #3 on: January 17, 2006, 06:01:02 PM »
So I would have to register this file?

'MSComDlg
'    Microsoft Common Dialog Control 6.0
'    C:\WINNT\System32\COMDLG32.OCX

If so, how?  I don't think I have ever done this before.

Here is a register tool.... that I have been using for years...

Or something like this:

Code: [Select]
(startapp "regsvr32.exe" (strcat "/s \"" server "\"")

Or...

Code: [Select]
;;..............................
;; (gwz-findServer "myServer.ocx")
;; (gwz-findServer "Roboex32.dll")
(defun gwz-findServer  (file)
  (findFile
    (strcat (vl-fileName-directory (getEnv "ComSpec"))
    (strcat "\\" file))))

;;..............................
(setq file "myServer.ocx")
(defun gwz-registerServer  (file)
  (if (not (gwz-findServer file))
    (progn
      (vl-file-copy
(findFile file)
(strcat
  (vl-fileName-directory (getEnv "ComSpec"))
  "\\"
  file))
      (if
(findFile
  (strcat (vl-fileName-directory (getEnv "ComSpec"))
  "\\regsvr32.exe"))
(startApp
   (strcat
     (vl-fileName-directory (getEnv "ComSpec"))
     "\\"
     "regsvr32.exe /s ")
   file)
(alert "Cannot register the server.")))))

There must be better alternatives than the above... but will give you the idea...
« Last Edit: January 17, 2006, 06:07:20 PM by LE »

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: MS common dialog box in lisp
« Reply #4 on: January 17, 2006, 06:11:54 PM »
Going back to some old Notes :
This will set the object for me :
(setq cdlg (vla-GetInterfaceObject (vlax-get-acad-object) "MSComDlg.CommonDialog"))

.. but I couldn't  access any methods  <usably> or properties ..
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

LE

  • Guest
Re: MS common dialog box in lisp
« Reply #5 on: January 17, 2006, 06:20:29 PM »
Tim,

Here is a sample of something similar... I did many moons ago...

HTH

T.Willey

  • Needs a day job
  • Posts: 5251
Re: MS common dialog box in lisp
« Reply #6 on: January 17, 2006, 06:25:52 PM »
Thanks for the help, but I still can't seem to get it to work.  I'm not sure I'm doing it right, but I think I am.  Here is the command line in Acad after I loaded Luis's two functions.
Quote
Command: (gwz-registerServer "ComDlg32.ocx")
nil

Command: (setq cdlg (vla-GetInterfaceObject (vlax-get-acad-object)
"MSComDlg.CommonDialog"))
; error: Automation Error. Problem in loading application

Command: (startapp "regsvr32.exe" "/s \"C:\WINNT\System32\COMDLG32.OCX \"")
33

Command: (setq cdlg (vla-GetInterfaceObject (vlax-get-acad-object)
"MSComDlg.CommonDialog"))
; error: Automation Error. Problem in loading application

Command: (setq tmp (vlax-create-object "MSComDlg.CommonDialog"))
nil
As you can see it didn't work.  What am I doing wrong?

Luis,

I don't think I can use the exe file because we are trying to find a way to browse for multiple files (like the open dialog) and send it to all people we work with.  Thanks though.
You posted too fast for me.  I will try you latest post and see if this will work.  Thanks again.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: MS common dialog box in lisp
« Reply #7 on: January 17, 2006, 06:31:46 PM »
Tim, DosLib has the solution wrapped. .. and Dale is committed to updating the Library in line with AutoCAD updates.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: MS common dialog box in lisp
« Reply #8 on: January 17, 2006, 06:36:30 PM »
The problem is that the people we send this to may not have DosLib, and they (IT) didn't want to have to install more stuff on our consultants computers.  That is why I don't think I will be able to use Luis's routine either.  When I looked in the zip, and compare what was in there to my computers files, I don't have the neccessary files.

I was kind of hoping that this could be done with pure lisp/vlisp/activex OOTB from Cad.  If it can't then I will have to tell them that.

Thanks for all the help.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: MS common dialog box in lisp
« Reply #9 on: January 17, 2006, 06:40:38 PM »
Perhaps it won't be too long before someone wraps a lot of this stuff into a NET based Com server that can be used from VLisp.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: MS common dialog box in lisp
« Reply #10 on: January 17, 2006, 06:54:47 PM »
Perhaps it won't be too long before someone wraps a lot of this stuff into a NET based Com server that can be used from VLisp.
That would be sweet.  I've been checking out the MSDN website (which makes me feel stupid) and saw some cool things.  They looked like they would work with ActiveX, but I don't know enough to implament the ideas.  Maybe soon I will.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

LE

  • Guest
Re: MS common dialog box in lisp
« Reply #11 on: January 17, 2006, 07:00:10 PM »
That would be sweet.  I've been checking out the MSDN website (which makes me feel stupid) and saw some cool things.  They looked like they would work with ActiveX, but I don't know enough to implament the ideas.  Maybe soon I will.

I have seen your work, and effort... don't waste your time, trying to master lisp... jump into a more powerful language... as soon as you can.

If you write code for living... again... do not waste your time... learning more about lisp.... lisp is ok, and handy...

T.Willey

  • Needs a day job
  • Posts: 5251
Re: MS common dialog box in lisp
« Reply #12 on: January 17, 2006, 07:09:14 PM »
I have seen your work, and effort... don't waste your time, trying to master lisp... jump into a more powerful language... as soon as you can.

If you write code for living... again... do not waste your time... learning more about lisp.... lisp is ok, and handy...

Thanks for the kind words.  I thought I was doing pretty good, then I found this site, and found that I didn't know as much as I thought I did, which is cool because I love to learn.  After seeing some of the stuff you were doing with ObjectARX I wanted to get into that, but my job is drafting right now, so it doesn't look like a lot of payoff for learning it, for I don't think that my job to come will be programing or have anything to do with it.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

LE

  • Guest
Re: MS common dialog box in lisp
« Reply #13 on: January 17, 2006, 07:16:08 PM »
Thanks for the kind words.  I thought I was doing pretty good, then I found this site, and found that I didn't know as much as I thought I did, which is cool because I love to learn.  After seeing some of the stuff you were doing with ObjectARX I wanted to get into that, but my job is drafting right now, so it doesn't look like a lot of payoff for learning it, for I don't think that my job to come will be programing or have anything to do with it.

 :-(

Well I tried.....

BTW, I work here as a Janitor... I do code or pretending doing code.. and still learning...  8-)

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: MS common dialog box in lisp
« Reply #14 on: January 17, 2006, 07:21:37 PM »
From what I can tell, the CommonDialog control is for use on VB forms. These types of controls, AFAIK, are not usable in VBA or Lisp. For instance, I just tried to place a CommonDialog control into a form in VBA and I recieved an error message stating that the program was not properly licensed to use such control.