469,082 Members | 1,119 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,082 developers. It's quick & easy.

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::OnSysCommand( UINT nID, LPARAM lParam )

{

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

return;

CMDIFrameWnd::OnSysCommand(nID, lParam);

}
Nov 15 '05 #1
3 13388
"ST Choong" <st******@srm.com.my> wrote in
news:eh**************@TK2MSFTNGP10.phx.gbl:
I am using the following code to disable user to move my application
in C++. How to do it in C#?
Thanks.
void CMainFrame::OnSysCommand( UINT nID, LPARAM lParam )

{

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

return;

CMDIFrameWnd::OnSysCommand(nID, lParam);

}


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
Nov 15 '05 #2
"Pauli" <pauli-@-burningice-.-dk> wrote in message news:Xn*******************************@130.226.1.3 4...

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


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(ref message);
}

Greetings,
timtos.
Nov 15 '05 #3
Thanks. I got it working.
"timtos" <ti****@gmx.de> wrote in message
news:bk**********@news.uni-koblenz.de...
"Pauli" <pauli-@-burningice-.-dk> wrote in message

news:Xn*******************************@130.226.1.3 4...

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


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(ref message);
}

Greetings,
timtos.

Nov 15 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Bob | last post: by
4 posts views Thread by Alexander Muylaert | last post: by
1 post views Thread by CARIGAR | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.