Sorry, I know this sounds pretty impossible, but is there a way I could check to see what windows would be displaying under my application were it not there? Thanks.
Yes, but it may take a good amount of code using APIs. You would enumerate
the windows checking the z order position and window areas that would
overlap your apps form. Sounds like a real pain to code.
Why do you want to get what is behind your form? Maybe there is a better solution.
Are you trying to get the desktop display behind your form for some kind of
transparency?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
ZOrder may change at any given moment: user may activate or deactivate any window when they want regardless so handle that your app stored a few seconds ago might not be valid any longer.
I suppose it would be transparent, is that easier? I don't want the whole form to be transparent though, just the body of the form. So i'd want to keep the title bar and the small bit around the edges that gives it a 3d effect.
yeah on Win 2k and XP it's easy using layers but on win98 there are two ways that I know of. I placed both ways into one function for your choice.
VB Code:
Option Explicit
Public Enum iMode
AlphaBlendingDLL = 1
msimg32DLL = 2
End Enum
Public Type BLENDFUNCTION
BlendOp As Byte
BlendFlags As Byte
SourceConstantAlpha As Byte
AlphaFormat As Byte
End Type
Public Declare Function AlphaBlending Lib "Alphablending.dll" _
(ByVal destHDC As Long, ByVal XDest As Long, ByVal YDest As Long, _
ByVal destWidth As Long, ByVal destHeight As Long, ByVal srcHDC As Long, _
ByVal xSrc As Long, ByVal ySrc As Long, ByVal srcWidth As Long, ByVal srcHeight As Long, ByVal AlphaSource As Long) As Long
Public Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
Public Declare Function AlphaBlend Lib "msimg32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal WidthSrc As Long, ByVal HeightSrc As Long, ByVal blendFunct As Long) As Boolean
Public Sub Blend(Destination As Object, Source As Object, Amount As Integer, in_iMode As iMode)
Use Blend PictureDestination, PictureSource, 120, AlphaBlendingDLL for the 1st method
Use Blend PictureDestination, PictureSource, 120, msimg32DLL for the 2nd method
Make sure all pictureboxes are set to autoredraw and are scaled in pixels. Also you SHOULD have msimg32.dll on your pc, but you might not have Alphablending.dll, so i'll attach it. Put the Alphablending.dll into your system folder. Also source and destination could be a form, not a picturebox but make sure autoredraw is on and form is scaled to pixels.
Last edited by Dmitri K; Jan 3rd, 2005 at 08:31 PM.