Цитата: Я бы на вашем месте уже давно взялся править исходники инно.
Не дорос еще я до этого. Плюс - уже сделано это уважаемым товарищем
Vo1t. В личной беседе, он дал ссылку на исходник, в котором не нужно бороться с цветом окна, но я так и не смог осилить экспорт - там функция применяется не к хендлу, а к форме, переделка на хендл результата не дала, поскольку часть параметров применяется только к форме, обойти через TCanvas не удалось.
Вот эта функция, может, знающие товарищи подскажут, где может быть ошибка?
[more=код]procedure GlassForm(HandleW:HWND; cBlurColorKey: TColor); stdcall;
const
WS_EX_LAYERED = $80000;
LWA_COLORKEY = 1;
type
_MARGINS = packed record
cxLeftWidth: Integer;
cxRightWidth: Integer;
cyTopHeight: Integer;
cyBottomHeight: Integer;
end;
PMargins = ^_MARGINS;
TMargins = _MARGINS;
DwmIsCompositionEnabledFunc = function(pfEnabled: PBoolean): HRESULT; stdcall;
DwmExtendFrameIntoClientAreaFunc = function(destWnd: HWND; const pMarInset: PMargins): HRESULT; stdcall;
SetLayeredWindowAttributesFunc = function(destWnd: HWND; cKey: TColor; bAlpha: Byte; dwFlags: DWord): BOOL; stdcall;
var
hDWMDLL: Cardinal;
osVinfo: TOSVERSIONINFO;
fDwmIsCompositionEnabled: DwmIsCompositionEnabledFunc;
fDwmExtendFrameIntoClientArea: DwmExtendFrameIntoClientAreaFunc;
fSetLayeredWindowAttributesFunc: SetLayeredWindowAttributesFunc;
bCmpEnable: Boolean;
mgn: TMargins;
begin
ZeroMemory(@osVinfo, SizeOf(osVinfo));
OsVinfo.dwOSVersionInfoSize := SizeOf(TOSVERSIONINFO);
if ((GetVersionEx(osVInfo) = True) and (osVinfo.dwPlatformId = VER_PLATFORM_WIN32_NT) and (osVinfo.dwMajorVersion >= 6)) then
begin
hDWMDLL := LoadLibrary('dwmapi.dll');
if hDWMDLL <> 0 then
begin
@fDwmIsCompositionEnabled := GetProcAddress(hDWMDLL, 'DwmIsCompositionEnabled');
@fDwmExtendFrameIntoClientArea := GetProcAddress(hDWMDLL, 'DwmExtendFrameIntoClientArea');
@fSetLayeredWindowAttributesFunc := GetProcAddress(GetModulehandle(user32), 'SetLayeredWindowAttributes');
if ((@fDwmIsCompositionEnabled <> nil) and (@fDwmExtendFrameIntoClientArea <> nil) and (@fSetLayeredWindowAttributesFunc <> nil)) then
begin
fDwmIsCompositionEnabled(@bCmpEnable);
if bCmpEnable = True then
begin
Canvas := TCanvas.Create;
Canvas.Handle := HandleW;
Canvas.Brush.Color := cBlurColorKey;
SetWindowLong(HandleW, GWL_EXSTYLE, GetWindowLong(HandleW, GWL_EXSTYLE) or WS_EX_LAYERED);
fSetLayeredWindowAttributesFunc(HandleW, cBlurColorKey, 0, LWA_COLORKEY);
ZeroMemory(@mgn, SizeOf(mgn));
mgn.cxLeftWidth := -1;
mgn.cxRightWidth := -1;
mgn.cyTopHeight := -1;
mgn.cyBottomHeight := -1;
fDwmExtendFrameIntoClientArea(HandleW, @mgn);
end;
end;
FreeLibrary(hDWMDLL);
end;
end;
end;[/more]
Цитата: Сконвертить хендл в объект можно с помощью все той же FindControl.
Можно пример использования?
В моем случае, както так?
Код: var
frmCtrl:Tform;
...................
frmCtrl:=FindControl(AHandle);