[Tutorial]Vb6 Transparent Form

Posts 1–15 of 17 · Page 1 of 2
[Tutorial]Vb6 Transparent Form
The title says all, but i will explain i little.
Wat it does is to make the form background transparent but u can see the controls, labels...

Put that in a module:
Const LWA_ALPHA = &H2
Const GWL_EXSTYLE = (-20)
Const WS_EX_LAYERED = &H80000
Public lngresult As Long
Public Const LWA_COLORKEY = 1
Option Explicit
Public Const SWP_NOMOVE = 2
Public Const SWP_NOSIZE = 1
Public Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE
Public Const HWND_TOPMOST = -1
Public Const HWND_NOTOPMOST = -2
Private m_lngRetVal As Long

Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hWnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long

Public Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long

Declare Function SetWindowPos Lib "user32" _
(ByVal hWnd As Long, _
ByVal hWndInsertAfter As Long, _
ByVal x As Long, _
ByVal Y As Long, _
ByVal cx As Long, _
ByVal cy As Long, _
ByVal wFlags As Long) As Long



Public Sub maketrans()
lngresult = GetWindowLong(Form1.hWnd, GWL_EXSTYLE)
lngresult = SetWindowLong(Form1.hWnd, GWL_EXSTYLE, lngresult Or WS_EX_LAYERED)
SetLayeredWindowAttributes Form1.hWnd, RGB(255, 255, 255), 128, LWA_COLORKEY 'Change the 255, 255, 255 for the background color that ur 'using (here white), so white will be transparent (ALL things that have white 'background).
End Sub

Public Sub nomaketrans()
SetWindowLong Form1.hWnd, GWL_EXSTYLE, WS_EX_LAYERED
SetLayeredWindowAttributes Form1.hWnd, 255, 255, LWA_ALPHA 'Same Here (U can find LWA_ALPHA on top)
End Sub
(Change the Form1.hWnd for ur FormX.hWnd)

Now if u want to make the form transparent.
Put that where u want (better in Form_Load())
maketrans
And if u want to make the form untransparent.
Where u want or in Form_Unload()
nomaketrans
IF I HAVE HELP U +REP TO ME AND CLICK THANKS!!!
(Pls can a mod stick it?)
nice one mate will surely help out some people!
Why is this in the C++/C section when the title says "[Tutorial]Vb6 Transparent Form"? Is this for Visual C++?
Quote Originally Posted by condor01 View Post
nice one mate will surely help out some people!
NP!! I had the same problem with the transparent form a while ago, and now i have seen some1 who needed it, so... i posted it!

(thx to the mod that has moved it)
PERFECT!!!!!!!!!!!!!

Man it worked the first time.. and for a beginner like me that feels really good. Thanks SO MUCH!!!
Quote Originally Posted by blipi View Post
NP!! I had the same problem with the transparent form a while ago, and now i have seen some1 who needed it, so... i posted it!


OOOOps sorry, i think i have confused of section. PLS wr194t can u move it?
If i was a Moderator i would move it but I'm not. PM a Moderator/Administrator and request for it to get moved. I'll ask Arun on MSN.
good work !

Keep working your tuts are really nice !
I have A problem, whenever i combine ur 2 Tuts. Transparent and on the foreground, my hproccess doesn't work anymore!
So now i have a Hack with Crosshair Ingame Overlay, Uberdot and alot of hacks but it doesn't work@ CAn u help me?
Quote Originally Posted by alien888 View Post
I have A problem, whenever i combine ur 2 Tuts. Transparent and on the foreground, my hproccess doesn't work anymore!
So now i have a Hack with Crosshair Ingame Overlay, Uberdot and alot of hacks but it doesn't work@ CAn u help me?
Idk, cus i have both (transparent and always on top) working at the same time on my crosshair, and i have no problems?

Check it again. If not, try making only 1 of them
Quote Originally Posted by blipi View Post
Idk, cus i have both (transparent and always on top) working at the same time on my crosshair, and i have no problems?

Check it again. If not, try making only 1 of them
I did ur tuts 10 times already, and found out that only Transparent doesn't works for me, maybe u can fix that?
Its prob something with double functions
cuz i made it in a other module and now it does work
The only Problem now is that i can't edit my hwnd, but that will come later, Tyvm!
Quote Originally Posted by alien888 View Post
Its prob something with double functions
cuz i made it in a other module and now it does work
The only Problem now is that i can't edit my hwnd, but that will come later, Tyvm!
OOO SORRY, the api SETWINDOW POS... I have confused, it mustn't be here.
Delete one of them, sorry.
thx man works for ma friends
Quote Originally Posted by blipi View Post
The title says all, but i will explain i little.
Wat it does is to make the form background transparent but u can see the controls, labels...

Put that in a module:

(Change the Form1.hWnd for ur FormX.hWnd)

Now if u want to make the form transparent.
Put that where u want (better in Form_Load())

And if u want to make the form untransparent.
Where u want or in Form_Unload()


IF I HAVE HELP U +REP TO ME AND CLICK THANKS!!!
(Pls can a mod stick it?)
when i do this , i gor only the border and the check box transparent.
same if i select " borderstyle - 0-none . what the probleme???

and..if no , is this a way to do it with picture box or image and make it transparent ??

thx for help
Posts 1–15 of 17 · Page 1 of 2
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?