Author Topic: AutoCAD window hDC  (Read 6326 times)

0 Members and 1 Guest are viewing this topic.

dann.boy.001

  • Guest
AutoCAD window hDC
« 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

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: AutoCAD window hDC
« Reply #1 on: June 09, 2010, 11:40:44 AM »
It's possible ... I'll have to look up the reference though
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: AutoCAD window hDC
« Reply #2 on: June 09, 2010, 12:12:12 PM »
To get the device context, you use the GetDC API call

Code: [Select]
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
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

dann.boy.001

  • Guest
Re: AutoCAD window hDC
« Reply #3 on: June 10, 2010, 05:25:26 AM »

Thank you Keith!

I will try this code, but I am not sure how to get hWndToAutoCAPApplication!

Best regards,
Danijel

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: AutoCAD window hDC
« Reply #4 on: June 10, 2010, 08:54:55 AM »

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.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

jgr

  • Guest
Re: AutoCAD window hDC
« Reply #5 on: June 12, 2010, 04:31:00 PM »