FoxPro/Visual FoxPro - Formulario Transparente

 
Vista:

Formulario Transparente

Publicado por Ruben Antunes (46 intervenciones) el 05/09/2006 01:47:15
Adjunto la siguiente formulario que lo que debería de hacer es dejar al mismo transparente, pero en VFP6 con Win98 no anda, da un error y no se como solucionarlo, agradeceria si alguien del foro me ayuda. Gracias

oForm = CREATEOBJECT("Tform")
oForm.Visible = .T.
READ EVENTS
DEFINE CLASS tform As Form
#DEFINE LWA_COLORKEY 1
#DEFINE LWA_ALPHA 2
#DEFINE GWL_EXSTYLE -20
#DEFINE WS_EX_LAYERED 0x80000
Autocenter=.T.
Caption="Transparent Form"
ShowWindow=2
TransparentModeSet=.F.
hwnd=0
ADD OBJECT cmdSet As CommandButton WITH;
Left=10, Top=10, Height=27, Width=80, Caption="Set"
ADD OBJECT cmdClear As CommandButton WITH;
Left=100, Top=10, Height=27, Width=80, Caption="Clear"
ADD OBJECT chRgb As CheckBox WITH;
Left=10, Top=50, Autosize=.T., BackStyle=0,;
Caption="ColorRef", Value=.F.
ADD OBJECT lblRgb As Label WITH;
Left=100, Top=50, Autosize=.T., Caption="Rgb:"
ADD OBJECT txtRgb As TextBox WITH;
Left=140, Top=48, Width=80, Height=24, Value=RGB(192,192,192)
ADD OBJECT cmdRgb As CommandButton WITH;
Left=220, Top=48, Width=24, Height=24, Caption="..."
ADD OBJECT chAlpha As CheckBox WITH;
Left=10, Top=80, Autosize=.T., BackStyle=0,;
Caption="Alpha", Value=.T.
ADD OBJECT lblAlpha As Label WITH;
Left=100, Top=80, Autosize=.T., Caption="Value:"
ADD OBJECT txtAlpha As Spinner WITH;
Left=140, Top=78, Width=80, Height=24, Value=128,;
SpinnerLowValue=0, SpinnerHighValue=255,;
KeyboardLowValue=0, KeyboardHighValue=255
PROCEDURE Init
DECLARE INTEGER GetWindowLong IN user32;
INTEGER hWnd, INTEGER nIndex
DECLARE INTEGER SetWindowLong IN user32;
INTEGER hWnd, INTEGER nIndex, INTEGER dwNewLong
DECLARE INTEGER SetLayeredWindowAttributes IN user32;
INTEGER hwnd, INTEGER crKey,;
SHORT bAlpha, INTEGER dwFlags
THIS.txtRgb.Value = THIS.BackColor
IF INT(VERSION(5)/100)<7
This.RetHandle()
ENDIF

PROCEDURE Destroy
CLEAR EVENTS
PROCEDURE SetTransparentMode
LOCAL nExStyle, nRgb, nAlpha, nFlags
nExStyle = GetWindowLong(THIS.HWnd, GWL_EXSTYLE)
nExStyle = BITOR(nExStyle, WS_EX_LAYERED)
= SetWindowLong(THIS.HWnd, GWL_EXSTYLE, nExStyle)
IF NOT THIS.chRgb.Value AND NOT THIS.chAlpha.Value
THIS.chAlpha.Value=.T.
ENDIF
nRgb = IIF(THIS.chRgb.Value, THIS.txtRgb.Value, 0)
nAlpha = IIF(THIS.chAlpha.Value, THIS.txtAlpha.Value, 0)
nFlags = IIF(THIS.chRgb.Value, LWA_COLORKEY, 0) +;
IIF(THIS.chAlpha.Value, LWA_ALPHA, 0)
= SetLayeredWindowAttributes(THIS.HWnd, m.nRgb,;
m.nAlpha, m.nFlags)
PROCEDURE ClearTransparentMode
LOCAL nExStyle
nExStyle = GetWindowLong(THIS.HWnd, GWL_EXSTYLE)
nExStyle = BITXOR(nExStyle, WS_EX_LAYERED)
= SetWindowLong(THIS.HWnd, GWL_EXSTYLE, nExStyle)
PROCEDURE cmdSet.Click
ThisForm.SetTransparentMode
ThisForm.TransparentModeSet=.T.
PROCEDURE cmdClear.Click
ThisForm.ClearTransparentMode
ThisForm.TransparentModeSet=.F.
PROCEDURE chRgb.Click
IF ThisForm.TransparentModeSet
ThisForm.SetTransparentMode
ENDIF
PROCEDURE txtRgb.When
RETURN .F.
PROCEDURE cmdRgb.Click
LOCAL nRgb
nRgb = GETCOLOR()
IF nRgb <> -1
ThisForm.txtRgb.Value = nRgb
IF ThisForm.TransparentModeSet AND ThisForm.chRgb.Value
ThisForm.SetTransparentMode
ENDIF
ENDIF
PROCEDURE chAlpha.Click
IF ThisForm.TransparentModeSet
ThisForm.SetTransparentMode
ENDIF
PROCEDURE txtAlpha.InteractiveChange
IF ThisForm.TransparentModeSet AND ThisForm.chAlpha.Value
ThisForm.SetTransparentMode
ENDIF
Procedure RetHandle
DECLARE INTEGER FindWindow IN WIN32API ;
STRING cClassName, ;
STRING cWindName
THISFORM.hwnd = FindWindow(0,This.CAPTION)
ENDPROC
ENDDEFINE
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:Formulario Transparente

Publicado por Harry Altmann Masip (15 intervenciones) el 05/09/2006 17:01:04
No veo nada en el código que cause el problema. Yo tuve bastantes inconvenientes con mis sistemas bajo windows 98, te recomiendo que pases como minimo a windows ME, preferible windows 2000, asi se me quitaron todos los lios que tuve con el visual
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:Formulario Transparente

Publicado por Plinio (7841 intervenciones) el 06/09/2006 13:26:15
Los formularios transparentes no son para Windows 98.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:Formulario Transparente

Publicado por Juan Ayala (8 intervenciones) el 06/09/2006 20:15:53
pequeña rutinita para que haga transparente? pense que era mas facil... yo estuve intentando hacerlo pero como veo es muy complicado
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar