.NET

Reply
Active Contributor
Jan1
Posts: 43
Registered: ‎05-14-2004
Message 1 of 5 (127 Views)

How to use SetWindowLong

127 Views, 4 Replies
04-07-2006 03:47 AM
Hello,

I'm trying to create a modeless dialog for ACAD 2005 with VB .NET. As I got read in several discussions this should be possible with using the SetWindowLong function. I have tried but could not succeed. Here is my code:

Public Const GWL_HWNDPARENT = (-8)

Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As IntPtr, ByVal nIndex As Long, ByVal wNewLong As Long) As Long

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim appACAD As Autodesk.AutoCAD.Interop.AcadApplication = Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication
SetWindowLong(Me.Handle, GWL_HWNDPARENT, acadApp.HWND)
End Sub

What is wrong with this code? Can anyone please correct it?

Regards, Jan
Distinguished Contributor
fantum
Posts: 313
Registered: ‎12-06-2004
Message 2 of 5 (127 Views)

Re: How to use SetWindowLong

04-07-2006 07:39 AM in reply to: Jan1
In your Declare for SetWindowLong, all three parameters and the return type should be Int32. In your call to SetWindowLong, the first argument should be Me.Handle.ToInt32.
Active Contributor
Jan1
Posts: 43
Registered: ‎05-14-2004
Message 3 of 5 (127 Views)

Re: How to use SetWindowLong

04-07-2006 10:48 AM in reply to: Jan1
Thanks, it works!
Distinguished Contributor
NathTay
Posts: 1,691
Registered: ‎12-15-2003
Message 4 of 5 (127 Views)

Re: How to use SetWindowLong

04-09-2006 04:18 PM in reply to: Jan1
If your program is a dll loaded into AutoCAD use the ShowModelessDialog method of the Application object.

Regards - Nathan
*Mark Gardiner
Message 5 of 5 (127 Views)

Re: How to use SetWindowLong

04-09-2006 06:31 PM in reply to: Jan1
That was introduced in acad 2006 not 2005

wrote in message news:5137111@discussion.autodesk.com...
If your program is a dll loaded into AutoCAD use the ShowModelessDialog
method of the Application object.

Regards - Nathan
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.