davyquyo
asked on
transparency
van i makt the background form the exe file
transparant
i load a progra into the exe fule and i know how i disalble the window but i stil get the background
how do disable this
transparant
i load a progra into the exe fule and i know how i disalble the window but i stil get the background
how do disable this
ASKER
this is very cool bu not exactly what i ment
i have somthing that looks what i want
http://www.davyquyo.be/xfire.doc
on this url there's a picture tou can see that there's a program open that have no window and no window background how do i do that
i have somthing that looks what i want
http://www.davyquyo.be/xfire.doc
on this url there's a picture tou can see that there's a program open that have no window and no window background how do i do that
ASKER
ok i should say a little more
i'm a flash scripter and i want to import de flash into
the exe file and if you open it that you can see the flash but not the window
i know how i import flash but i don't know how i get lost of the window
i'm a flash scripter and i want to import de flash into
the exe file and if you open it that you can see the flash but not the window
i know how i import flash but i don't know how i get lost of the window
Oh.
This is also possible, but again, I'm not sure about Win9x OS'es
- create a form with 3 command buttons and paste this
'------------------------- ---------- ---------- ---------- ---------- ---------- -
Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
Private Declare Function CreateEllipticRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Declare Function CreateRoundRectRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long, ByVal X3 As Long, ByVal Y3 As Long) As Long
Private Declare Function CreateRectRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Dim Shape As Long
Private Sub Command1_Click()
Shape = CreateEllipticRgn(0, 0, Me.Width / Screen.TwipsPerPixelX, Me.Height / Screen.TwipsPerPixelY)
SetWindowRgn Me.hWnd, Shape, True
End Sub
Private Sub Command2_Click()
Shape = CreateRoundRectRgn(50, 50, Me.Width / Screen.TwipsPerPixelX, Me.Height / Screen.TwipsPerPixelY, 20, 20)
SetWindowRgn Me.hWnd, Shape, True
End Sub
Private Sub Command3_Click()
Shape = CreateRectRgn(0, 0, Me.Width / Screen.TwipsPerPixelX, Me.Height / Screen.TwipsPerPixelY)
SetWindowRgn Me.hWnd, Shape, True
End Sub
'------------------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- --------
The idea is to create some Region (shape) using 'Create....Rgn' API function and then assign this shape to a window using SetWindowRgn
This example shows only predefined shapes: Ellipse, Round Rectangle and normal rectangle, but it is possible to create more complex shapes by combining simple shapes.
So it is even possible to create holes in the window but I can't remember how to do this at the moment.
I'll know it tommorow when I get to my computer at work. I have it saved somewhere there.
Regards! Until tommorow.....
This is also possible, but again, I'm not sure about Win9x OS'es
- create a form with 3 command buttons and paste this
'-------------------------
Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
Private Declare Function CreateEllipticRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Declare Function CreateRoundRectRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long, ByVal X3 As Long, ByVal Y3 As Long) As Long
Private Declare Function CreateRectRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Dim Shape As Long
Private Sub Command1_Click()
Shape = CreateEllipticRgn(0, 0, Me.Width / Screen.TwipsPerPixelX, Me.Height / Screen.TwipsPerPixelY)
SetWindowRgn Me.hWnd, Shape, True
End Sub
Private Sub Command2_Click()
Shape = CreateRoundRectRgn(50, 50, Me.Width / Screen.TwipsPerPixelX, Me.Height / Screen.TwipsPerPixelY, 20, 20)
SetWindowRgn Me.hWnd, Shape, True
End Sub
Private Sub Command3_Click()
Shape = CreateRectRgn(0, 0, Me.Width / Screen.TwipsPerPixelX, Me.Height / Screen.TwipsPerPixelY)
SetWindowRgn Me.hWnd, Shape, True
End Sub
'-------------------------
The idea is to create some Region (shape) using 'Create....Rgn' API function and then assign this shape to a window using SetWindowRgn
This example shows only predefined shapes: Ellipse, Round Rectangle and normal rectangle, but it is possible to create more complex shapes by combining simple shapes.
So it is even possible to create holes in the window but I can't remember how to do this at the moment.
I'll know it tommorow when I get to my computer at work. I have it saved somewhere there.
Regards! Until tommorow.....
ASKER
fore al the troble you have done for me
i'l raise it with 100 points but
this is what i can and what i have
this is the result:
http://www.davyquyo.be/Project1.exe
this is what i want without the window
this is the project i have
http://www.davyquyo.be/Project1.vbp
http://www.davyquyo.be/Project1.vbw
thanx for the help
i'l raise it with 100 points but
this is what i can and what i have
this is the result:
http://www.davyquyo.be/Project1.exe
this is what i want without the window
this is the project i have
http://www.davyquyo.be/Project1.vbp
http://www.davyquyo.be/Project1.vbw
thanx for the help
ASKER
ok it seems you also wil need this
http://www.davyquyo.be/intro.swf
the intro is the flash that's been loaded into the exe
the intro must bu placed on this location
c:\intro.swf
there is where he load it for now
i just want thet the flash canbeen seen wthout a window or background
that's was the point al allong
http://www.davyquyo.be/intro.swf
the intro is the flash that's been loaded into the exe
the intro must bu placed on this location
c:\intro.swf
there is where he load it for now
i just want thet the flash canbeen seen wthout a window or background
that's was the point al allong
Ok. Another try.... :)
If I understand it correctly now, then all you have to do is the following:
- set form's Borderstyle property to 0-None
- stretch form to desired size
- set form's StartUpPosition property to 2-CenterScreen
- create a ShockwaveFlash control
- paste this code
'------------------------- ---------- ---------- ---------- ---------- ---------- ---------- -
Private Sub Form_Activate()
ShockwaveFlash1.LoadMovie 0, "c:\intro.swf"
ShockwaveFlash1.Play
End Sub
Private Sub Form_Load()
ShockwaveFlash1.Top = 0
ShockwaveFlash1.Left = 0
ShockwaveFlash1.Width = Me.Width
ShockwaveFlash1.Height = Me.Height
End Sub
'------------------------- ---------- ---------- ---------- ---------- ---------- ---------- ---
When you compile it to exe it should show the intro without surrounding background.
However I didn't implement the code which would exit after the intro stops playing yet, becouse it seems that you didn't implement it in your EXE.
To exit the application when the intro stops playing do the following:
- create Timer control
- replace previous code with this:
'------------------------- ---------- ---------- ---------- ---------- ---------- ---------- -----
Private Sub Form_Activate()
ShockwaveFlash1.LoadMovie 0, "D:\davor\Gluposti\Happy Tree Friends\05_HAVIN_A_BALL.SW F"
ShockwaveFlash1.Play
DoEvents
Timer1.Interval = 10
Timer1.Enabled = True
End Sub
Private Sub Form_Load()
ShockwaveFlash1.Top = 0
ShockwaveFlash1.Left = 0
ShockwaveFlash1.Width = Me.Width
ShockwaveFlash1.Height = Me.Height
End Sub
Private Sub Timer1_Timer()
If ShockwaveFlash1.IsPlaying = False Then End
End Sub
'------------------------- ---------- ---------- ---------- ------
I hope this solves it, but if this is not what you wanted, feel free to ask. You don't need to increase the points.
If I understand it correctly now, then all you have to do is the following:
- set form's Borderstyle property to 0-None
- stretch form to desired size
- set form's StartUpPosition property to 2-CenterScreen
- create a ShockwaveFlash control
- paste this code
'-------------------------
Private Sub Form_Activate()
ShockwaveFlash1.LoadMovie 0, "c:\intro.swf"
ShockwaveFlash1.Play
End Sub
Private Sub Form_Load()
ShockwaveFlash1.Top = 0
ShockwaveFlash1.Left = 0
ShockwaveFlash1.Width = Me.Width
ShockwaveFlash1.Height = Me.Height
End Sub
'-------------------------
When you compile it to exe it should show the intro without surrounding background.
However I didn't implement the code which would exit after the intro stops playing yet, becouse it seems that you didn't implement it in your EXE.
To exit the application when the intro stops playing do the following:
- create Timer control
- replace previous code with this:
'-------------------------
Private Sub Form_Activate()
ShockwaveFlash1.LoadMovie 0, "D:\davor\Gluposti\Happy Tree Friends\05_HAVIN_A_BALL.SW
ShockwaveFlash1.Play
DoEvents
Timer1.Interval = 10
Timer1.Enabled = True
End Sub
Private Sub Form_Load()
ShockwaveFlash1.Top = 0
ShockwaveFlash1.Left = 0
ShockwaveFlash1.Width = Me.Width
ShockwaveFlash1.Height = Me.Height
End Sub
Private Sub Timer1_Timer()
If ShockwaveFlash1.IsPlaying = False Then End
End Sub
'-------------------------
I hope this solves it, but if this is not what you wanted, feel free to ask. You don't need to increase the points.
Correction...
Note that in second piece of code I gave you in my last comment, the line: ShockwaveFlash1.LoadMovie 0, "D:\davor\Gluposti\Happy Tree Friends\05_HAVIN_A_BALL.SW F"
should be the same as before: ShockwaveFlash1.LoadMovie 0, "c:\intro.swf"
I was having trouble downloading your intro.swf file so I was using one of the files from my comp for testing.
Note that in second piece of code I gave you in my last comment, the line: ShockwaveFlash1.LoadMovie 0, "D:\davor\Gluposti\Happy Tree Friends\05_HAVIN_A_BALL.SW
should be the same as before: ShockwaveFlash1.LoadMovie 0, "c:\intro.swf"
I was having trouble downloading your intro.swf file so I was using one of the files from my comp for testing.
ASKER
ok but youre last code it says sothing from
object required
so it's not correct i think
and i love it what you did but stil there's is a problem
in flash we can't create a movie without a background so i alwys make the background transparand
but dan is tsil get a window
can it be created that this background can not been seen
object required
so it's not correct i think
and i love it what you did but stil there's is a problem
in flash we can't create a movie without a background so i alwys make the background transparand
but dan is tsil get a window
can it be created that this background can not been seen
Where does this error message appear?
The following steps should work:
- start New Standard EXE project
- click on Project -> Components, find and select Shockwave Flash, click OK.
- create Shockwave control on the form, its name should be: ShockwaveFlash1 (It is the default name for which the code is designed)
- create Timer control. (It is represented as a stopwatch icon in toolbar)
- follow the steps from my previous comment
To make the control's background transparent, just click on (custom) property and change WindowMode field to Transparent.
However there is still form's background behind all of this. And this is a bit harder to remove than control's background.
There is no other way to do it (at least I don't know any) than to cut out all background based on the color of the pixels, using the method similar to my second comment.
But this is very slow becouse program has to check every pixel on the form as fast as possible.
I'll try to find another some faster way.
The following steps should work:
- start New Standard EXE project
- click on Project -> Components, find and select Shockwave Flash, click OK.
- create Shockwave control on the form, its name should be: ShockwaveFlash1 (It is the default name for which the code is designed)
- create Timer control. (It is represented as a stopwatch icon in toolbar)
- follow the steps from my previous comment
To make the control's background transparent, just click on (custom) property and change WindowMode field to Transparent.
However there is still form's background behind all of this. And this is a bit harder to remove than control's background.
There is no other way to do it (at least I don't know any) than to cut out all background based on the color of the pixels, using the method similar to my second comment.
But this is very slow becouse program has to check every pixel on the form as fast as possible.
I'll try to find another some faster way.
ASKER
you did great help but how do these programe do this
for example
msn they have a winow of there own and not the standard window
how do they do that
for example
msn they have a winow of there own and not the standard window
how do they do that
Maybe it goes faster in other languages, but everything I try in VB is really slow.
Maybe I'm just not aware of any faster method, but I have seen many similar questions and they all end up cutting unwanted pixels out from the window.
It is acceptable if the transparent regions are allways in the same place, becouse then it is enough to define the region once and leave it alone, but if each frame has different areas transparent,
then it's just too much processor work to cut out everything 25 times per second.
I have some unexplored ideas left, but I'm not sure the will work. I'm trying it at hte moment but I can't promiss anything yet.
Maybe I'm just not aware of any faster method, but I have seen many similar questions and they all end up cutting unwanted pixels out from the window.
It is acceptable if the transparent regions are allways in the same place, becouse then it is enough to define the region once and leave it alone, but if each frame has different areas transparent,
then it's just too much processor work to cut out everything 25 times per second.
I have some unexplored ideas left, but I'm not sure the will work. I'm trying it at hte moment but I can't promiss anything yet.
ASKER
hmmm i think it's not realy possible then
i'm very new wit h this al and how do you cut pixels in a window then
and
how do i change
form's Borderstyle property to 0-None
with a click on a button
if i have this i think it wil do a lot
i'm very new wit h this al and how do you cut pixels in a window then
and
how do i change
form's Borderstyle property to 0-None
with a click on a button
if i have this i think it wil do a lot
To change properties of the form on design time, just select the form, press F4 and the list of available properties will appear.
Find Borderstyle and double click it until you get the value you want ( or click the downarrow icon and select the value from the list)
This also works for all controls you placed on the form.
I'm examining the example from: http://www.vb-helper.com/howto_clock_face.html
But as I said, it removes unwanted pixels only once, and you can see how much time it needs to do it. (Note the delay before the clock is actualy displayed)
It takes almost a whole second on my computer.
This is not a good method for repeating.
Find Borderstyle and double click it until you get the value you want ( or click the downarrow icon and select the value from the list)
This also works for all controls you placed on the form.
I'm examining the example from: http://www.vb-helper.com/howto_clock_face.html
But as I said, it removes unwanted pixels only once, and you can see how much time it needs to do it. (Note the delay before the clock is actualy displayed)
It takes almost a whole second on my computer.
This is not a good method for repeating.
Unfortunately BorderStyle property is Read only at Run-Time.
So you can't use a button in running programm to add or remove the border and titlebar.
So you can't use a button in running programm to add or remove the border and titlebar.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanx, i wil do it with that
Thanks for accepting.
It works on Win2000 and WinXP. I'm not sure that it will work on older Windows O.S.
- create a textbox and a command button
- paste this code:
'-------------------------
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
Private Const GWL_EXSTYLE = (-20)
Private Const WS_EX_LAYERED = &H80000
Private Const LWA_ALPHA = &H2&
Sub SetSemiTransparent(frm As Object, TransparencyAmount As Byte)
SetWindowLong frm.hwnd, GWL_EXSTYLE, GetWindowLong(frm.hwnd, GWL_EXSTYLE) Or WS_EX_LAYERED
SetLayeredWindowAttributes
End Sub
Private Sub Command1_Click()
If Val(Text1.Text) > 255 Then Text1.Text = "255"
If Val(Text1.Text) < 0 Then Text1.Text = "0"
Call SetSemiTransparent(Form1, Val(Text1.Text))
End Sub
Private Sub Form_Load()
Text1.Text = 100
End Sub
'-------------------------
- type the amount of transparency into the textbox ( 0 to 255 ) and press command button
- the complete form should now become semi-transparent or even completely invisible