disable user moving application window?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ST Choong

    disable user moving application window?

    I am using the following code to disable user to move my application in C++.
    How to do it in C#?
    Thanks.
    void CMainFrame::OnS ysCommand( UINT nID, LPARAM lParam )

    {

    if( (nID & 0xfff0) == SC_MOVE || (nID & 0xfff0) == SC_SIZE || (nID & 0xfff0)
    == SC_RESTORE)

    return;

    CMDIFrameWnd::O nSysCommand(nID , lParam);

    }


  • Pauli

    #2
    Re: disable user moving application window?

    "ST Choong" <stchoong@srm.c om.my> wrote in
    news:ehEuHYyeDH A.2352@TK2MSFTN GP10.phx.gbl:
    [color=blue]
    > I am using the following code to disable user to move my application
    > in C++. How to do it in C#?
    > Thanks.
    > void CMainFrame::OnS ysCommand( UINT nID, LPARAM lParam )
    >
    > {
    >
    > if( (nID & 0xfff0) == SC_MOVE || (nID & 0xfff0) == SC_SIZE || (nID &
    > 0xfff0) == SC_RESTORE)
    >
    > return;
    >
    > CMDIFrameWnd::O nSysCommand(nID , lParam);
    >
    > }[/color]

    Override your WndProc() procedure, and tjeck for the Message.Msg id-number

    pseudo:

    protected override WndProc(ref Message m) {
    switch (m.Msg) {
    case: 1:

    return;
    break;
    }

    base.WndProc(m) ;
    }

    /Pauli

    Comment

    • timtos

      #3
      Re: disable user moving application window?

      "Pauli" <pauli-@-burningice-.-dk> wrote in message news:Xns93F7584 AA992Bpauliburn ingicedk@130.22 6.1.34...[color=blue]
      >
      > Override your WndProc() procedure, and tjeck for the Message.Msg id-number
      >[/color]

      To make it a little clearer:

      protected override void WndProc(ref Message message)
      {
      const int WM_SYSCOMMAND = 0x0112;
      const int SC_MOVE = 0xF010;

      switch(message. Msg)
      {
      case WM_SYSCOMMAND:
      int command = message.WParam. ToInt32() & 0xfff0;
      if (command == SC_MOVE)
      return;
      break;
      }

      base.WndProc(re f message);
      }

      Greetings,
      timtos.


      Comment

      • ST Choong

        #4
        Re: disable user moving application window?

        Thanks. I got it working.


        "timtos" <tirobu@gmx.d e> wrote in message
        news:bk3qc0$dog $1@news.uni-koblenz.de...[color=blue]
        > "Pauli" <pauli-@-burningice-.-dk> wrote in message[/color]
        news:Xns93F7584 AA992Bpauliburn ingicedk@130.22 6.1.34...[color=blue][color=green]
        > >
        > > Override your WndProc() procedure, and tjeck for the Message.Msg[/color][/color]
        id-number[color=blue][color=green]
        > >[/color]
        >
        > To make it a little clearer:
        >
        > protected override void WndProc(ref Message message)
        > {
        > const int WM_SYSCOMMAND = 0x0112;
        > const int SC_MOVE = 0xF010;
        >
        > switch(message. Msg)
        > {
        > case WM_SYSCOMMAND:
        > int command = message.WParam. ToInt32() & 0xfff0;
        > if (command == SC_MOVE)
        > return;
        > break;
        > }
        >
        > base.WndProc(re f message);
        > }
        >
        > Greetings,
        > timtos.
        >
        >[/color]


        Comment

        Working...