Hi Mile510,
A control image does not have a hdc, but a userform yes. If you place the
image on the userform, you can recover the hdc with:
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Sub UserForm_Initialize()
Dim MehDC As Long
MehDC = GetDC(FindWindow(vbNullString, Me.Caption))
End Sub
Dear Mr. Pierron,
thank you very much for your detailed reply. The same advice was give to me
by Mr. Stephen Bullen earlier. But this way I will plot on a form itself and
not on an Image control. For example, in VB there is a Picture Box comtrol
which does have a hDC. And people can access it with Picture.hDC property.
As I do not have VB, I assume that Image in VBA is the same as Picture Box
in VB. It seems that I am wrong and lost. How can I plot or do other API
things with Image control only? Or should I try completely diffrent
approach?
Hi Mike510;
That is not possible in VBA with a control image; but if you admit to use
the userform like surfaces tracing, it is possible for example, to trace
directly a function on it. You have an example here: http://www.excelabo.net/moteurs/compteclic.php?nom=mp-graphonform
Not quite. A VB picturebox is a container object. Userform controls
that are containers include frame and mulipage which do have a hWnd
(but is hard to find without a caption <g>).
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.