Thema: Delphi Automatisierung

Einzelnen Beitrag anzeigen

EWeiss
(Gast)

n/a Beiträge
 
#3

AW: Automatisierung

  Alt 5. Sep 2017, 09:04
Zeig doch mal die Stelle, wo du CreateMyPopupMenu aufrufst.
Ich nehme an, dass geschieht in der Botschaftsbehandlung für WM_RBUTTONDOWN bzw -UP?
Nicht ganz.

Main WinProc.
Delphi-Quellcode:
    WM_NCRBUTTONDOWN:
      begin
          if gPMenu.bPopupMenu then
          begin
            gPMenu.bPopupMenu := false;
            PopUpMenu.DestroyWindow;
          end;

          CreatePopupMenu(Prop.MainHandle);

          GetCursorPos(P);
          GetWindowRect(gPMenu.PopUpMenu, rc);
          ClientToScreen(gPMenu.PopUpMenu, P);

          PopUpMenu.MoveWindow(gPMenu.PopUpMenu, P.X, (P.Y - rc.Bottom), rc.Right,
            rc.Bottom);

          PopupMenu.Show;

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

          if OnExit then
            PostMessage(WinHandle, WM_DESTROY, 0, 0);
      end;
Delphi-Quellcode:
    WM_NCLBUTTONDOWN:
      begin
        IsMoving := true;
        if gPMenu.bPopupMenu then
        begin
          PopUpMenu.DestroyWindow;
          gPMenu.bPopupMenu := false;
        end;
      end;
MovieProc
Delphi-Quellcode:
    WM_RBUTTONDOWN:
      SendMessageW(Prop.MainHandle, WM_NCRBUTTONDOWN, wP, LP);

    WM_LBUTTONDOWN:
      SendMessageW(Prop.MainHandle, WM_NCLBUTTONDOWN, wP, LP);
Zitat:
(Ist es eigentlich gewollt, dass zwar WinHandle übergeben, aber auf das globale MainHandle zugegriffen wird?)
Wo siehst du das?


gruss