.NET

Reply
Active Contributor
43 Posts
0 Kudos
Registered: ‎05-14-2004
Post 1 of 5

How to use SetWindowLong

128 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
313 Posts
0 Kudos
Registered: ‎12-06-2004
Post 2 of 5

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
43 Posts
0 Kudos
Registered: ‎05-14-2004
Post 3 of 5

Re: How to use SetWindowLong

04-07-2006 10:48 AM in reply to: Jan1
Thanks, it works!
Distinguished Contributor
1,691 Posts
3 Kudos
Registered: ‎12-15-2003
Post 4 of 5

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
Post 5 of 5

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