Einzelnen Beitrag anzeigen

EWeiss
(Gast)

n/a Beiträge
 
#1

DwmExtendFrameIntoClientArea Win10

  Alt 13. Feb 2019, 05:45
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
  Mit Zitat antworten Zitat