1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| public partial class Form1 : Form
{
[DllImport("User32.dll")]
public static extern int FindWindow(string lpClassName, string lpWindowName);
public Form1()
{
InitializeComponent();
MyNativWindow mnw = new MyNativWindow();
mnw.AssignHandle((IntPtr)FindWindow(null, "Calculatrice"));
}
}
public class MyNativWindow : NativeWindow
{
const int WM_WINDOWPOSCHANGING = 0x0046;
protected override void WndProc(ref Message m)
{
base.WndProc(ref m);
if (m.Msg == WM_WINDOWPOSCHANGING)
{
// Code qui empêche le déplacement
}
}
} |
Partager