Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Win32/Win64 API (native code) (https://www.delphipraxis.net/17-win32-win64-api-native-code/)
-   -   Delphi DwmExtendFrameIntoClientArea Win10 (https://www.delphipraxis.net/199700-dwmextendframeintoclientarea-win10.html)

EWeiss 13. Feb 2019 05:45

DwmExtendFrameIntoClientArea Win10
 
Funktioniert das noch bei irgend jemand?
Bei mir unter Win10 leider nicht mehr.


Delphi-Quellcode:
program ScratchProgram;

uses
  Windows,
  Messages,
  DwmApi,
  UxTheme;

{ Window Procedure }
function WndProc(hWnd: HWND; uiMsg: UINT; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall;
var
    m: TMargins;
begin
    case uiMsg of
    WM_ACTIVATE:
        begin
            m.cxLeftWidth := 50;
            m.cxRightWidth := 50;
            m.cyTopHeight := 50;
            m.cyBottomHeight := 50;
            DwmExtendFrameIntoClientArea(hWnd, m);
        end;
    WM_DESTROY:
        begin
            PostQuitMessage(0);
            Result := 0;
            Exit;
        end;
    end;

    Result := DefWindowProc(hWnd, uiMsg, wParam, lParam);
end;

function WinMain(hInstance: HINST; hPrevInstance: HINST; lpCmdLine: PChar; nShowCmd: Integer): Integer; stdcall;
var
    wc: WNDCLASS;
    msg: TMSG;
    hWindow: HWND;
    instance: HINST;
begin
    instance := GetModuleHandle(nil);

    wc.style := CS_HREDRAW or CS_VREDRAW;
    wc.cbClsExtra := 0;
    wc.cbWndExtra := 0;
    wc.lpszClassName := 'Window';
    wc.hInstance := instance;
    wc.hbrBackground := GetStockObject(BLACK_BRUSH);
    wc.lpszMenuName := nil;
    wc.lpfnWndProc := @WndProc;
    wc.hCursor := LoadCursor(0, IDC_ARROW);
    wc.hIcon := LoadIcon(0, IDI_APPLICATION);

    RegisterClass(wc);

    hWindow := CreateWindow(
            wc.lpszClassName,                 // Class Name
            'Window',                         // Title
            WS_OVERLAPPEDWINDOW or WS_VISIBLE, // Style
            100, 100,                         // Position
            350, 250,                         // Size
            0,                                // Parent
            0,                                // No menu
            instance,                         // Instance
            nil);                             // No special parameters

    ShowWindow(hWindow, SW_SHOW);

    while (GetMessage(msg, 0, 0, 0)) do
    begin
        TranslateMessage(msg);
        DispatchMessage(msg);
    end;

    Result := 0;
end;

begin
    WinMain(hInstance, hPrevInst, CmdLine, CmdShow);
end.
er meint es würde bei ihm funktionieren..

Kann ich aber nicht bestätigen.
Man kann es auch so verwenden wenn man die Koordinaten des Aktiven Fensters nicht angeben will.

Delphi-Quellcode:
function DWM_ExtendFrameIntoAll(hWnd: hWnd): HRESULT;
var
  Margins: TMargins;
begin
  Margins.cyTopHeight := -1;
  Margins.cyBottomHeight := -1;
  Margins.cxLeftWidth := -1;
  Margins.cxRightWidth := -1;
  Result := S_FALSE;

  if IsDWMloaded then
    Result := DwmExtendFrameIntoClientArea(hWnd, @Margins);
end;
Schlägt leider auch fehl.
Ich möchte einen Bereich aussparen der nicht Transparent angezeigt werden darf.

gruss

Schokohase 13. Feb 2019 09:34

AW: DwmExtendFrameIntoClientArea Win10
 
Liste der Anhänge anzeigen (Anzahl: 1)
Ja, funktioniert
Anhang 50692

EWeiss 14. Feb 2019 05:02

AW: DwmExtendFrameIntoClientArea Win10
 
Zitat:

Zitat von Schokohase (Beitrag 1425411)
Ja, funktioniert
Anhang 50692

Hmmm.. Danke.
Verstehe ich nicht warum geht es dann bei mir nicht?

Der gelb umrandetet Bereich des OpenFileDialog (bereich.png) darf keinen Blur Effekt haben.
Seltsam das verhalten bei Win10, wiedermal..

gruss


Alle Zeitangaben in WEZ +1. Es ist jetzt 00:21 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz