02-25-2010 01:35 PM - edited 02-25-2010 01:36 PM
Hello,
I have a DLL that takes a hDC parameter which will then "draw" something into it using Windows API. An example of this might be the WinSDK function TextOut(HDC hdc, int nXStart, int nYStart, LPCTSTR lpString, int cbString).
How would I get the hDC of a Canvas control, or another control (not the Panel) to be able to use these functions?
Also, are there any caveats to be aware of?
Regards,
Jason.
Solved! Go to Solution.
02-26-2010 01:33 AM
Hi Jason,
Even if you get the handle you need, are you sure Windows API will be able to "directly" draw something on NI's canvas control?
02-26-2010 07:34 AM
As far as I am aware, CVI controls are not windowed controls, so they do not have their own window handles and you cannot get a device context handle for them. The same is true for CVI child panels. You will only able to get a device context handle for the enclosing main panel.
02-26-2010 12:58 PM
Thanks Martin for your concise answer. At least this explains why it's possible to get the hWnd for a panel (for which there are examples from NI on how to get the hDC) and not from other controls.
Therefore, I'll start planning importing an ActiveX picture control or similar that can give me a hDC to write into.