Link to home
Start Free TrialLog in
Avatar of mgronlund
mgronlund

asked on

Transparent Form + Transparent GIF = Splash Screen

Im Hoping Someone Can Shed A Little Or Preferably ALOT Of Light On My Problem. I Have A .gif With A Transparent Background Which I Place In An Image Control And When I Make The Form Transparent Everything Disappears.
 
The API Calls I'm Using To Make The Form Transparent Are:

Public Const GWL_EXSTYLE = (-20)
Public Const WS_EX_TRANSPARENT = &H20&
Public Const SWP_FRAMECHANGED = &H20
Public Const SWP_NOMOVE = &H2
Public Const SWP_NOSIZE = &H1
Public Const SWP_SHOWME = SWP_FRAMECHANGED Or SWP_NOMOVE Or SWP_NOSIZE
Public Const HWND_NOTOPMOST = -2

Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong 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 MakeFormTransparent(FormObject As Form)
    SetWindowLong FormObject.hwnd, GWL_EXSTYLE, WS_EX_TRANSPARENT
    SetWindowPos FormObject.hwnd, HWND_NOTOPMOST, 0&, 0&, 0&, 0&, SWP_SHOWME
End Sub


Any Help Would Be Greatly Appreciated
Avatar of KDivad
KDivad

I've always suspected that an image control doesn't really exist and the image is actually on the form itself (same with labels). If this is true, then your code will make it disappear along with the rest of the form.

Don't know of a way around it unless you use form-shaping APIs to crop the form to the same shape as the gif's image.
Avatar of mgronlund

ASKER

Thought About Doing That First But The Shape Is To Irratic
:ping:
ASKER CERTIFIED SOLUTION
Avatar of KDivad
KDivad

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Tried It, Doesnt Do A Terrible Job But It Doesnt Do The Inside Transparentancies (Like The Center Of Od or a)

FYI Its At http://members.fortunecity.com/alexv/index.html?VBSFC.html
AHHHHHH NEVERMIND I Found An Option That Did What I Need Thanks!
Great! Glad you got your problem worked out.
Just In Case Anyone Tries To Do What I Did You Need To Set The Edge Tracer To Use Rectangle File.

The Only Problem Is That (For Example) My Image Made 800+ Calls To The API, That In Itself Made The Routine Too Large For VB To Handle. You'll Need To Do A Search And Replace For Screen.TwipsPerPixelX + OffsetX And Screen.TwipsPerPixelY + OffsetY And Assign Them A Variable, Also Might Need To Assign ScaleY * 15 and  ScaleX * 15 To A Variable. End Results Are The Same Just Results In Smaller Code And Faster Execution Since VB Won't Have To Do 800+ Calculations

mgronlund: Thank you for this latest comment. It certainly adds value to the PAQ.
I agree. It's great when the asker posts their results back like this.
Try To Help Those That Help Me,... Have One Wuestion What Is The PING Messages?