-1

所以我使用 WinApi 的 CreateWindow 函数创建了一个窗口,但似乎无法使孔窗口透明,窗口显示为全黑或全白不透明我错过了什么?

begin
  case uMsg of
    WM_DESTROY:
      begin
        Cleanup;
        PostQuitMessage(0);
        Result := 0;
        Exit;
      end;

    WM_PAINT:
      begin
        ValidateRect(hWnd, nil);
        Result := 0;
        Exit;
      end;
  end;

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

    var
      wc: TWndClassEx = (cbSize: SizeOf(TWndClassEx); style: WS_EX_TRANSPARENT;
        lpfnWndProc: @MsgProc; cbClsExtra: 0; cbWndExtra: 0; hInstance: 0;
        hIcon: 0; hCursor: 0; hbrBackground: 0; lpszMenuName: nil;
        lpszClassName: 'Window'; hIconSm: 0);
    begin
      wc.hInstance := GetModuleHandle(nil);
      RegisterClassEx(wc);
    
      hWindow := CreateWindow('Window', '', 0, 0, 0, 300, 300,
        GetDesktopWindow, 0, wc.hInstance, nil);

  if SUCCEEDED(hWindow) then
  begin
    ShowWindow(hWindow, SW_SHOW);
    UpdateWindow(hWindow);

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

1 回答 1

-1

我已将图像用作组件的父级并将组件设置为使用父级

于 2020-10-05T10:21:22.123 回答