Transparent VB5.0 forms in Windows NT 
Author Message
 Transparent VB5.0 forms in Windows NT

I'm trying to make a VB5.0 form transparent to sit over another application
in Windows NT. The transparent form takes all the user clicks and passes
them to the application below (in essence, the user thinks they are
clicking on the application itself). The problem is I cannot get it to work
consistently. I've used 'WS_EX_TRANSPARENT' as described in MSDN Tip 113
with the code below, but what happens is the form takes the colour of its
BACKCOLOR property. Later, when other standard VB forms appear and
disappear, the space left by the disappearing form can be (but not always)
filled by the application I want to see. It's not consistent!

All I need is the main VB form to be transparent when maximised. The
results I have at the moment are flakey! I have AUTOREFRESH set to TRUE,
etc. Is there a custom/3rd party VB control that do this????

Present code:

        Dim Res as Long

        Res = SetWindowLong(MyTransparentForm.hWnd,GWL_EXSTYLE,WS_EX_TRANSPARENT)
        MyTransparentForm.WindowState = vbMAXIMISE

        MyTransparentForm.Show

Thanking anyone in advance!

Matt



Sat, 25 Mar 2000 03:00:00 GMT  
 Transparent VB5.0 forms in Windows NT

take a look at xshaper by Greentree.

Quote:

> I'm trying to make a VB5.0 form transparent to sit over another application
> in Windows NT. The transparent form takes all the user clicks and passes
> them to the application below (in essence, the user thinks they are
> clicking on the application itself). The problem is I cannot get it to work
> consistently. I've used 'WS_EX_TRANSPARENT' as described in MSDN Tip 113
> with the code below, but what happens is the form takes the colour of its
> BACKCOLOR property. Later, when other standard VB forms appear and
> disappear, the space left by the disappearing form can be (but not always)
> filled by the application I want to see. It's not consistent!

> All I need is the main VB form to be transparent when maximised. The
> results I have at the moment are flakey! I have AUTOREFRESH set to TRUE,
> etc. Is there a custom/3rd party VB control that do this????

> Present code:

>         Dim Res as Long

>         Res = SetWindowLong(MyTransparentForm.hWnd,GWL_EXSTYLE,WS_EX_TRANSPARENT)
>         MyTransparentForm.WindowState = vbMAXIMISE

>         MyTransparentForm.Show

> Thanking anyone in advance!

> Matt



Tue, 28 Mar 2000 03:00:00 GMT  
 Transparent VB5.0 forms in Windows NT

Mike, this is quite easy. But you need to use a technique known as
'subclassing'.
You have to use a message blaster. Or try softcircuit's SubClass
control. This will definetly help you. Now here's the real trick to it.

Suppose you want a part of your form to be able to be clicked, and part
of your form to show the background applications through. Something like
this:

Say u have a picture of a circle or a star, etc. This part forms the
part that you want your window to be clicked. Whatever is outside the
star, circle, etc, is what you want to pass clicks through to the below
application, right. So what you have to do is create a mask. You need to
use a colour that determines the masking background, such as red.

Let's think of the circle. You have a DC (device context) that holds the
circle bitmap (the colour one for the window), and a DC for the mask
bitmap (the black and white version of the circle). The circle should be
white and the rest black. The white pixels are going to be checked when
we have a WM_NCHITTEST message. The hit testing magic is to check the
pixels by using some relativity with where the window is. Obtain the
window's rectangle, and then use the left and top as 0,0 in the device
context mask (that's a hint), and then check by using GetPixel when the
mouse is over the window (WM_NCHITTEST), and then check. If it's on one
of the white pixels, then we have a part of the window that will return
the window procedure, if it's on a black pixel, the messages are sent
straight to the application underneath the window.

Anyway, I have an example in a week or so, and I'll e-mail it to you. It
makes use of subclassing and transparent bitblt's.

Anyway, work it out. Soon your e-mail will come, with the full example.

Benjamin.



Mon, 03 Apr 2000 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Transparent VB5.0 forms in Windows NT

2. Transparent VB5.0 forms in Windows NT

3. transparent from in vb 6.0 sp3 under windows NT 4.0

4. Launching and Monitoring a 16-bit Windows app from VB5 application running on Windows NT 4.0

5. Launching and Monitoring a 16-bit Windows app from VB5 application running on Windows NT 4.0

6. Windows NT Users form a Windows 95 / 98 Client

7. Transparent Forms under NT

8. Transparent Windows/Forms

9. transparent forms and windows - FSTransparent ActiveX Control

10. Transparent forms and windows - FSTransparent ActiveX control

11. Transparent Windows/Forms in VB3

12. Transparent Forms / Windows

 

 
Powered by phpBB® Forum Software