Here is what I am trying to do. I need to grab the color from a pixel
that I have loaded to an Image on the form.
I am using this function to grab the pixel:
Private Declare Function GetPixel Lib "GDI32" (ByVal hDC As Long, ByVal
X As Long, ByVal Y As Long) As Long
Which means that I need the hDC of the image. In order to do that I am
using this function:
Private Declare Function GetDC Lib "user32" (ByVal hWnd As Long) As
Long
Which means that I need the hWnd of the image, but I can't find it
anywhere. I've tried using this function to grab it:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA"
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long
But this function requires the caption of the Image, but Images in VBA
don't use captions. Is there any other way for me to find the hWnd of
the image? I can't simply use the hWnd of the form because my GetPixel
function won't grab the pixel from the image, only from the form
itself. I'm at a loss. Any help would be great.
Thanks
Wow. I've found the hex number of a color that I wanted and I didn't have to
jump thru hoops of fire with poisonous snakes slithering under them. That's
what your process sounds like to me. :-(
Is there a reason you're going thru all of that?

Signature
JoAnn Paules
MVP Microsoft [Publisher]
~~~~~
How to ask a question
http://support.microsoft.com/KB/555375
> Here is what I am trying to do. I need to grab the color from a pixel
> that I have loaded to an Image on the form.
[quoted text clipped - 19 lines]
>
> Thanks
Ed Bennett - 25 Jan 2007 22:34 GMT
> Wow. I've found the hex number of a color that I wanted and I didn't have to
> jump thru hoops of fire with poisonous snakes slithering under them. That's
> what your process sounds like to me. :-(
>
> Is there a reason you're going thru all of that?
Well, there's a reason this group is called .programming.
Unfortunately, I have no idea either, so it's doubtful the question is
going to get answered.
(schlefty, you are working in Microsoft Publisher VBA, yes?)

Signature
Ed Bennett - MVP Microsoft Publisher
http://ed.mvps.org
JoAnn Paules [MVP] - 26 Jan 2007 00:06 GMT
It just seems like such a long way around the process to find a color. Call
me silly.

Signature
JoAnn Paules
MVP Microsoft [Publisher]
~~~~~
How to ask a question
http://support.microsoft.com/KB/555375
>> Wow. I've found the hex number of a color that I wanted and I didn't have
>> to jump thru hoops of fire with poisonous snakes slithering under them.
[quoted text clipped - 8 lines]
>
> (schlefty, you are working in Microsoft Publisher VBA, yes?)
Ed Bennett - 26 Jan 2007 09:25 GMT
> It just seems like such a long way around the process to find a color. Call
> me silly.
Yes, but if the program needs the colour to do something with, then it
has to be able to find it on its own - it can't have you sitting there
and clicking to find the colours and then telling it. Unless you're
volunteering...

Signature
Ed Bennett - MVP Microsoft Publisher
http://ed.mvps.org
JoAnn Paules [MVP] - 26 Jan 2007 21:33 GMT
<snort!> What I know about programming would fit in a thimble and you'd
still have room for a brick.

Signature
JoAnn Paules
MVP Microsoft [Publisher]
~~~~~
How to ask a question
http://support.microsoft.com/KB/555375
>> It just seems like such a long way around the process to find a color.
>> Call me silly.
[quoted text clipped - 3 lines]
> clicking to find the colours and then telling it. Unless you're
> volunteering...
Am 25 Jan 2007 07:00:38 -0800 schrieb schlefty:
[description partially snipped]
> Private Declare Function GetDC Lib "user32" (ByVal hWnd As Long) As
> Long
> Which means that I need the hWnd of the image, but I can't find it
> anywhere. I've tried using this function to grab it:
> Private Declare Function FindWindow Lib "user32" Alias "FindWindowA"
> (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
> But this function requires the caption of the Image, but Images in VBA
> don't use captions. Is there any other way for me to find the hWnd of
> the image?
I once had a similar problem, I needed the hwnd of a printer and vba did
not offer it. I used a function called CreateDC and it worked for me.
You find it here:
http://www.allapi.net/apilist/CreateDC.shtml
(But as I said, it was for a printer).
Maybe this gives you ideas. Another place to ask concerning API-Functions
is here:
microsoft.public.vb.winapi
And I recall that we once used a (grahical) program to find out about
hwnds, as far as I remember. If you're interested in the name of that
program I'll try to find out (I don't have that at home).
HTH
Greetings from Germany
Susanne

Signature
Mein System:
Office XP, SP3, aktueller Patchstand
Windows 2000, SP4, aktueller Patchstand