i have create 1 shape form.
in the init of the form i have this declaration:
DECLARE INTEGER SetLayeredWindowAttributes IN win32api;
INTEGER HWND, INTEGER crKey, INTEGER bAlpha, INTEGER dwFlags
DECLARE INTEGER SetWindowLong IN user32.DLL ;
INTEGER hWnd, INTEGER nIndex, INTEGER dwNewLong
DECLARE INTEGER GetWindowLong IN user32.DLL ;
INTEGER hWnd, INTEGER nIndex
DECLARE INTEGER GetActiveWindow IN user32
i have put a new method in the form "Makeirregular" and this is the code:
LPARAMETERS nHWND, nColor, nAction
*Constants for SetLayeredWindowAttributs
#DEFINE LWA_COLORKEY 1
#DEFINE LWA_ALPHA 2
*Constants for SetWindowLong and GetWindowLong
#DEFINE GWL_EXSTYLE -20
#DEFINE WS_EX_LAYERED 0x00080000
LOCAL lnFlags
*The form's window must be set to Layered, so that it is drawn
* in a separate layer.
do case
case nAction = 1 && Make Transparent
lnFlags = GetWindowLong(nHWND, GWL_EXSTYLE) &&Gets the existing flags from the window
*thisform.nFlags = lnFlags
lnFlags = BITOR(lnFlags, WS_EX_LAYERED) &&Appends the Layered flag to the existing ones
SetWindowLong(nHWND, GWL_EXSTYLE, lnFlags) &&Sets the new flags to the window
SetLayeredWindowAttributes(nHWND, nColor, 0, LWA_ALPHA)
case nAction = 2 && Make Opaque
SetWindowLong(nHWND, GWL_EXSTYLE, lnFlags) &&Sets the original flags to the window
SetLayeredWindowAttributes(nHWND, nColor, 0, 0)
endcase
for make irregular form i have put image on form picture property and in the init event i call:
Thisform.Makeirregular(Thisform.HWnd,RGB(0,0,255),1)
now, i have a shaped form and all work fine.
now, i want create a shaped button
i think the code for do this is the same but i must get the button handle.
for get button handle i use:
Declare Integer FindWindowEx In Win32API Integer, Integer, Integer, Integer
hB=FindWindowEx(thisform.HWnd,0,0,0)
This.Makeirregular(hB,RGB(0,0,255),,1)
but this code don't want work

why?