Welcome to Dream.In.Code
Become a VB Expert!

Join 149,932 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,747 people online right now. Registration is fast and FREE... Join Now!




clear... transparent... invisible...

 
Reply to this topicStart new topic

clear... transparent... invisible..., clear/transparent window background...

edward_pogi123
15 Jan, 2008 - 02:31 AM
Post #1

New D.I.C Head
*

Joined: 24 Nov, 2007
Posts: 7


My Contributions
hey again... how do i make my application background transparent ( so that i can see what is behind ) ???? blink.gif
User is offlineProfile CardPM
+Quote Post

benpap
RE: Clear... Transparent... Invisible...
15 Jan, 2008 - 04:55 AM
Post #2

New D.I.C Head
Group Icon

Joined: 24 Nov, 2007
Posts: 44


Dream Kudos: 100
My Contributions
QUOTE(edward_pogi123 @ 15 Jan, 2008 - 03:31 AM) *

hey again... how do i make my application background transparent ( so that i can see what is behind ) ???? blink.gif

i was wondering too how i can make a form transparent, only the objects should be visible blink.gif blink.gif
User is offlineProfile CardPM
+Quote Post

born2c0de
RE: Clear... Transparent... Invisible...
16 Jan, 2008 - 01:26 AM
Post #3

printf("I'm a %XR",195936478);
Group Icon

Joined: 26 Nov, 2004
Posts: 4,029



Thanked: 38 times
Dream Kudos: 2800
Expert In: 80x86 Assembly, C/C++, VB6, VB.NET, C#, J2SE, Win32 API, Reversing

My Contributions
Reduce the value of the Opacity Property of the Form.
User is offlineProfile CardPM
+Quote Post

edward_pogi123
RE: Clear... Transparent... Invisible...
16 Jan, 2008 - 03:19 AM
Post #4

New D.I.C Head
*

Joined: 24 Nov, 2007
Posts: 7


My Contributions
buti don't see any property of the form named 'opacity', i'm using vb 6.0.
User is offlineProfile CardPM
+Quote Post

born2c0de
RE: Clear... Transparent... Invisible...
16 Jan, 2008 - 11:16 AM
Post #5

printf("I'm a %XR",195936478);
Group Icon

Joined: 26 Nov, 2004
Posts: 4,029



Thanked: 38 times
Dream Kudos: 2800
Expert In: 80x86 Assembly, C/C++, VB6, VB.NET, C#, J2SE, Win32 API, Reversing

My Contributions
In that case you'll need to use 3 API Functions.
  • GetWindowLong
    To get attribute information about the window.
  • SetWindowLong
    To Set a window's Attribute Information.
  • SetLayeredWindowAttributes
    To set the Opacity of the Window.
This should do it.
CODE
Dim Msg As Long
Msg = GetWindowLong(hwnd, GWL_EXSTYLE)
Msg = Msg Or WS_EX_LAYERED
SetWindowLong(hwnd, GWL_EXSTYLE, Msg)
SetLayeredWindowAttributes(hwnd, 0, value, LWA_ALPHA))

User is offlineProfile CardPM
+Quote Post

edward_pogi123
RE: Clear... Transparent... Invisible...
18 Jan, 2008 - 11:33 PM
Post #6

New D.I.C Head
*

Joined: 24 Nov, 2007
Posts: 7


My Contributions
vb6 says for the 3 functions:
"function or sub not defined"
is there something i need to check in the references check list?
or something object/component i need to include?
User is offlineProfile CardPM
+Quote Post

born2c0de
RE: Clear... Transparent... Invisible...
20 Jan, 2008 - 07:17 AM
Post #7

printf("I'm a %XR",195936478);
Group Icon

Joined: 26 Nov, 2004
Posts: 4,029



Thanked: 38 times
Dream Kudos: 2800
Expert In: 80x86 Assembly, C/C++, VB6, VB.NET, C#, J2SE, Win32 API, Reversing

My Contributions
You need to include the API Declaration for the three API Functions that you are using.

Use the API Text Viewer tool included with Visual BASIC (Check the Tools subfolder) to find the API Declaration.
User is offlineProfile CardPM
+Quote Post

edward_pogi123
RE: Clear... Transparent... Invisible...
23 Jan, 2008 - 04:01 AM
Post #8

New D.I.C Head
*

Joined: 24 Nov, 2007
Posts: 7


My Contributions
hey dude, i can't find the declaration for 'SetLayeredWindowAttributes' when i searched declarations using the api text viewer. what should i do then?
User is offlineProfile CardPM
+Quote Post

born2c0de
RE: Clear... Transparent... Invisible...
23 Jan, 2008 - 05:21 AM
Post #9

printf("I'm a %XR",195936478);
Group Icon

Joined: 26 Nov, 2004
Posts: 4,029



Thanked: 38 times
Dream Kudos: 2800
Expert In: 80x86 Assembly, C/C++, VB6, VB.NET, C#, J2SE, Win32 API, Reversing

My Contributions
You could at least look at the code and guess the function declaration.
It isn't mentioned in the API Text Viewer but is defined in MSDN.

Here it is:
CODE
Public Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hwnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Boolean

User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/8/09 03:25PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month