Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[visualBasic6]Fading Effect codes?

 
Post new topic   This topic is locked: you cannot edit posts or make replies.    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Pepsiguy
I post too much
Reputation: 0

Joined: 16 Aug 2007
Posts: 2016

PostPosted: Mon Dec 03, 2007 2:50 pm    Post subject: [visualBasic6]Fading Effect codes? Reply with quote

i know u can do it with timers and opacity but how?
_________________
Back to top
View user's profile Send private message
Blader
I post too much
Reputation: 2

Joined: 19 Jan 2007
Posts: 2049

PostPosted: Mon Dec 03, 2007 3:31 pm    Post subject: Reply with quote

You can use this code, although it's a little slow
You just need a timer =)

Code:
Dim Alpha
Const LWA_COLORKEY = &H1
Const LWA_ALPHA = &H2
Const GWL_EXSTYLE = (-20)
Const WS_EX_LAYERED = &H80000
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hWnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long



Private Sub Form_Load()
Dim Ret As Long
    Ret = GetWindowLong(Me.hWnd, GWL_EXSTYLE)
    Ret = Ret Or WS_EX_LAYERED
    SetWindowLong Me.hWnd, GWL_EXSTYLE, Ret
    Timer1.Interval = 20
End Sub




Private Sub Timer1_Timer()
Alpha = Alpha + 1
If Alpha > 255 Then
   Timer1.Enabled = False
Exit Sub
End If
    SetLayeredWindowAttributes Me.hWnd, 0, Alpha, LWA_ALPHA
End Sub

_________________
Back to top
View user's profile Send private message
Pepsiguy
I post too much
Reputation: 0

Joined: 16 Aug 2007
Posts: 2016

PostPosted: Mon Dec 03, 2007 3:45 pm    Post subject: Reply with quote

um.....i need a quick code like there was this thingy that you could set it to like 100 and 200 and etc
_________________
Back to top
View user's profile Send private message
Blader
I post too much
Reputation: 2

Joined: 19 Jan 2007
Posts: 2049

PostPosted: Mon Dec 03, 2007 4:24 pm    Post subject: Reply with quote

Umm I don't think there is...
It isin't that simple

_________________
Back to top
View user's profile Send private message
Devilizer
Master Cheater
Reputation: 0

Joined: 22 Jun 2007
Posts: 451

PostPosted: Mon Dec 03, 2007 6:35 pm    Post subject: Reply with quote

Edit: Bleh, found out.

Code:
Dim Alpha
Const LWA_COLORKEY = &H1
Const LWA_ALPHA = &H2
Const GWL_EXSTYLE = (-20)
Const WS_EX_LAYERED = &H80000
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hWnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
Private Sub Form_Load()
Dim Ret As Long
    Ret = GetWindowLong(Me.hWnd, GWL_EXSTYLE)
    Ret = Ret Or WS_EX_LAYERED
    SetWindowLong Me.hWnd, GWL_EXSTYLE, Ret
    Timer1.Interval = 20
End Sub

Private Sub Timer1_Timer()
Alpha = Alpha + 10
If Alpha > 255 Then
   Timer1.Enabled = False
Exit Sub
End If
    SetLayeredWindowAttributes Me.hWnd, 0, Alpha, LWA_ALPHA
End Sub


Use this.
Back to top
View user's profile Send private message
Blader
I post too much
Reputation: 2

Joined: 19 Jan 2007
Posts: 2049

PostPosted: Mon Dec 03, 2007 6:47 pm    Post subject: Reply with quote

Lulz that's the same as mine o.o
_________________
Back to top
View user's profile Send private message
Devilizer
Master Cheater
Reputation: 0

Joined: 22 Jun 2007
Posts: 451

PostPosted: Mon Dec 03, 2007 6:53 pm    Post subject: Reply with quote

Blader wrote:
Lulz that's the same as mine o.o

Yeah i just played around with it and edited it to fade faster, i think 2 or 3 seconds.

Edit: Sorry, forget to credit ya -_-.
Back to top
View user's profile Send private message
Blader
I post too much
Reputation: 2

Joined: 19 Jan 2007
Posts: 2049

PostPosted: Mon Dec 03, 2007 7:09 pm    Post subject: Reply with quote

Well it wasn't really mine, I copy and pasted stuff from the internet lol
All you changed is the alpha increase I think, that's what I did too, except I did +5 XD

_________________
Back to top
View user's profile Send private message
Never Again
I post too much
Reputation: 0

Joined: 13 Jan 2007
Posts: 2000
Location: New Mexico

PostPosted: Mon Dec 03, 2007 8:28 pm    Post subject: Reply with quote

That's a big code Delphi's is much shorter :
Code:
procedure TForm1.Timer1Timer(Sender: TObject);
begin
  if Form1.AlphaBlendValue >= 255 then
    begin
      Timer1.Enabled := false;
    end
  else
    begin
      Form1.AlphaBlendValue := Form1.AlphaBlendValue + 5;
    end;
end;


Fade out is the same, but reversed.
Back to top
View user's profile Send private message MSN Messenger
Pepsiguy
I post too much
Reputation: 0

Joined: 16 Aug 2007
Posts: 2016

PostPosted: Mon Dec 03, 2007 9:19 pm    Post subject: Reply with quote

i do not give a Fuc* about delphi
_________________
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   This topic is locked: you cannot edit posts or make replies.    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites