Q&A

  • MessageDrain Property 아시는분....
MessageDrain Property (IVideoWindow Object)
IVideoWindow Object
Retrieves or sets the window handle of the window that receives posted messages for the video window.

objVideoWindow.MessageDrain [= handle]


Parts
objVideoWindow
Object expression that evaluates to an IVideoWindow object.
handle
New value for the window handle.

상기의 함수에 대해서 아시는분 계시면 꼭좀 답변 부탁드립니다.
어떻게 사용하는건지 알수가 없네요..도움말에도 안나오고 자료도 없고.ㅜㅜ
아시는분 있으시면 꼭좀 ^^
즐거운 하루 되세요.
1  COMMENTS
  • Profile
    이광수 2002.07.01 22:05
    말그대로 message drain입니다.
    즉 videowindow의 마우스 이벤트를 받기 원하는 원도우 핸들을
    넣어주시면 됩니다.

    그러면 video window에서 발생하는 마우스 메시지가
    설정된 윈도우로 postmessage됩니다.

    보통은 판낼 같은 것을 만들고, 메시지를 잡도록 한다음 처리하지요.
    메시지를 직접 잡을지 델파이가 내부처리를 할지 모르겠군요.

    참고로 저는 다음과 같이 합니다만... ^^;

            procedure TDSVideoWindow.DrainWndProc(var Msg: TMessage);
            var
            nLeft, nTop, nWidth, nHeight: integer;
                    xPos, yPos: WORD;
                    bRet : boolean;
            begin
              with Msg do
                    case msg of
                            // Non Mouse Pos
                            WM_KEYDOWN, WM_KEYUP:
                            begin
                                    PostMessage(handle, msg, wParam, lParam);
                            end;
                            // Mouse event
                            WM_LBUTTONDBLCLK, WM_LBUTTONDOWN, WM_LBUTTONUP,
                            WM_MBUTTONDBLCLK, WM_MBUTTONDOWN, WM_MBUTTONUP,
                            WM_RBUTTONDBLCLK, WM_RBUTTONDOWN, WM_RBUTTONUP,
                            WM_MOUSEMOVE :
                            begin
                                    // Translate cursor position
                                    xPos := LOWORD(lParam) + FRendererLeft;
                                    yPos := HIWORD(lParam) + FRendererTop;

                                    lParam := MakeLong(xPos, yPos);

                                    SendMessage(handle, msg, wParam, lParam);
                            end;
                            // nonclient event
                            WM_NCLBUTTONDBLCLK, WM_NCLBUTTONDOWN, WM_NCLBUTTONUP,
                            WM_NCMBUTTONDBLCLK, WM_NCMBUTTONDOWN, WM_NCMBUTTONUP,
                            WM_NCRBUTTONDBLCLK, WM_NCRBUTTONDOWN, WM_NCRBUTTONUP,
                            WM_NCMOUSEMOVE, WM_MOUSEACTIVATE :
                            begin
    //                                PostMessage(handle, msg, wParam, lParam);
                            end;
                    else
                      Result := DefWindowProc(FWindowHandle, Msg, wParam, lParam);
              end;
            end;



      constructor TDSVideoWindow.Create(AOwner: TComponent);
      begin
            inherited Create(AOwner);
    {        ControlStyle := [csAcceptsControls, csCaptureMouse, csClickEvents,
            csDoubleClicks, csReflector]; } // lks
            
            ControlStyle := [csAcceptsControls, csClickEvents,
            csDoubleClicks, csReflector]; // lks : 마우스 capture를 직접 제어해야 하므로 빼버린다.

            self.TabStop := true;
        self.Height := 120;
        self.Width  := 160;
        self.color  := $00100010;
        canvas.OnChanging := CaptureCanvas;
            canvas.OnChange   := ReleaseCanvas;

            FWindowHandle := AllocateHWnd(DrainWndProc); // lks : drain Window
      end;

      destructor TDSVideoWindow.Destroy;
      begin
            DeallocateHWnd(FWindowHandle); // LKS : dealloc drain window
            
        inherited destroy;
      end;

      procedure TDSVideoWindow.SetGraph(grf: TDSGraph);
      var
              nLeft, nTop, nWidth, nHeight: integer; // position, size: lks
      begin
            if assigned(FGraph) then FGraph.FVW := nil;
            FGraph := grf;
            if assigned(FGraph) then
            begin
              FGraph.FVW := self;
              if VideoAvailable then
              begin
                    with FGraph.VideoWindow do
                    begin
                      put_Owner(self.parent.Handle);
                      put_Caption(Name);
                      put_WindowStyle(FWindowInfo.dwStyle or WS_CHILD or WS_CLIPSIBLINGS);
                      put_WindowStyleEx(FWindowInfo.dwExStyle);

                      CalcVideoPosition; // lks
                      SetWindowPosition(FRendererLeft, FRendererTop, FRendererWidth, FRendererHeight); // lks
              put_MessageDrain(FWindowHandle); // lks

                      // SetWindowPosition(self.Left,self.Top,self.Width,self.Height);
              // put_MessageDrain(Self.Handle);
            end;
          end;
        end;
      end;