HDC property

Everything DG Kernel: Technical discussions and issues
Post Reply
Measure
Posts: 6
Joined: Wed Oct 23, 2024 1:54 pm

HDC property

Post by Measure »

Is there any way to access the HDC property of the control?

-Adam
Mike Zubovic
Posts: 6
Joined: Mon Jul 15, 2024 5:20 am

Re: HDC property

Post by Mike Zubovic »

Not really, as far as I could find out.
HDC is kind of specific to a particular technology. We are trying to abstract from that.
But. It is handy for older native apps. We will give it another thought and will see what we can do in the next update.

Thanks for the good question.

Mike Zubovic
Developer
DInsight
Mike Zubovic
Posts: 6
Joined: Mon Jul 15, 2024 5:20 am

Re: HDC property

Post by Mike Zubovic »

We have added access to it in today's update 5559.
There are two new integer properties in the control context. HDC has id 9. HWND has id 8. See also Component Context.

We have tested it in a modified copy of C++ Light sample:

Code: Select all

IView_DGPtr iView = m_DGKern.GetViewDG();
IContext_DGPtr iCont;
iView->GetContext(&iCont);

int hwnd = 0;
iCont->GetInt(8, &hwnd);
HWND hWnd = (HWND)hwnd;

int hdc = 0;
iCont->GetInt(9, &hdc);
HDC hDC = (HDC)hdc;
This is backward compatibility functionality. It should be considered unsupported and not recommended.

The properties will not work for 64 bit apps. We will look at adding it in v7.3.

Regards
Post Reply