Set Library To Home() + "Foxtools.fll" ADDITIVE ** Declare API functions Declare Integer CombineRgn in "gdi32" integer hDestRgn, integer hRgn1, integer hRgn2, integer nMode Declare Integer CreateRectRgn in "gdi32" integer X1, integer Y1, integer X2, integer Y2 Declare Integer SetWindowRgn in "user32" integer hwnd, integer hRgn, integer nRedraw ** Calling Method This.SetTransparent()FORM Resize:
** Call Method when resizing THIS.SetTransparent()FORM gethwndform (New Method)
** Returns form windows handle or identifier Local lcOldCaption, lnHWND With Thisform lcOldCaption = .Caption .Caption = Sys(3) lnHWND = _WhToHwnd(_WFindTitl(.Caption)) .Caption = lcOldCaption EndWith Return lnHWNDFORM settransparent (New Method)
LOCAL lnControlBottom, ; lnControlRight, ; lnControlLeft, ; lnControlTop, ; lnBorderWidth, ; lnTitleHeight, ; lnFormHeight, ; lnFormWidth, ; lnInnerRgn, ; lnOuterRgn, ; lnCombinedRgn, ; lnControlRgn, ; lnControl, ; lnRgnDiff, ; lnRgnOr, ; llTrue ** lnRgnDiff = 4 lnRgnOr = 2 llTrue = -1 With Thisform ** Setting border & title bar size lnBorderWidth = 3 lnTitleHeight = 23 ** Getting widht & Height lnFormWidth = (.Width + 1) + (lnBorderWidth * 2) lnFormHeight = .Height + lnTitleHeight + lnBorderWidth ** Creating internal & external regions lnOuterRgn = CreateRectRgn(0, 0, lnFormWidth, lnFormHeight) lnInnerRgn = CreateRectRgn(lnBorderWidth, lnTitleHeight, ; lnFormWidth - lnBorderWidth, lnFormHeight - lnBorderWidth) ** Retrieving internal from external region lnCombinedRgn = CreateRectRgn(0, 0, 0, 0) CombineRgn(lnCombinedRgn, lnOuterRgn, lnInnerRgn, lnRgnDiff) ** For Each Control in .Controls lnControlLeft = Control.Left + lnBorderWidth lnControlTop = Control.Top + lnTitleHeight lnControlRight = Control.Width + lnControlLeft lnControlBottom = Control.Height + lnControlTop lnControlRgn = CreateRectRgn(lnControlLeft, lnControlTop, ; lnControlRight, lnControlBottom) CombineRgn(lnCombinedRgn, lnCombinedRgn, lnControlRgn, lnRgnOr) EndFor ** Set window region SetWindowRgn(.GetHwndForm(), lnCombinedRgn, llTrue) EndWith>I'm trying to make my form semi-transparent using WinAPI SetLayeredWindowAttributes() (VFP6SP5,Win2000). When the form is "As Top-Level" (ShowWindow=2) this function works, otherwise (In Screen or In Top-Level form) - not. Why? Please, help!