TheSwamp
Code Red => .NET => Topic started by: dann.boy.001 on June 09, 2010, 10:22:09 AM
-
Hello!
Is posible to get hDC window of AutoCAD?
I want to use it to draw on autocad window with
windows api (in net system.drawing.graphics).
Maybe somebody know is posible it :?
Best regards,
Danijel
-
It's possible ... I'll have to look up the reference though
-
To get the device context, you use the GetDC API call
Public Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Dim hDC As Long = GetDC(hWndToAutoCAPApplication)
You may have to use IntPtr as the type though ... I have not tried it
-
Thank you Keith!
I will try this code, but I am not sure how to get hWndToAutoCAPApplication!
Best regards,
Danijel
-
Thank you Keith!
I will try this code, but I am not sure how to get hWndToAutoCAPApplication!
Best regards,
Danijel
:lmao: ok, sorry, that is the hWnd of the application window you want to modify ... presumably you have a reference to the application window, just not the hDC ... so you should have a hWnd property ... just pass that value to the function.
-
p/invoke?... Why?:
Graphics.FromHwnd
See:
http://msdn.microsoft.com/en-us/library/system.drawing.graphics.fromhwnd%28v=VS.71%29.aspx