.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to use SetWindowLong

4 REPLIES 4
Reply
Message 1 of 5
Jan1
415 Views, 4 Replies

How to use SetWindowLong

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
4 REPLIES 4
Message 2 of 5
fantum
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.
Message 3 of 5
Jan1
in reply to: Jan1

Thanks, it works!
Message 4 of 5
NathTay
in reply to: Jan1

If your program is a dll loaded into AutoCAD use the ShowModelessDialog method of the Application object.

Regards - Nathan
Message 5 of 5
Anonymous
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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost