這篇是回應網友問題便測試看看,語言是用C#,有興趣的朋友可以參考看看
- using System.Runtime.InteropServices;
-
- namespace WindowsApplication1
- {
- public partial class Form1 : Form
- {
- const int WM_SYSCOMMAND = 0x112;
- const int SC_MOVE = 0xF012;
-
- [DllImport("user32",EntryPoint="ReleaseCapture",CharSet=CharSet.Ansi)]
- private extern static int ReleaseCapture ();
-
- [DllImport("user32",EntryPoint="SendMessageA",CharSet=CharSet.Ansi)]
- private extern static int SendMessage (IntPtr hwnd , int wMsg , int wParam, int lParam ) ;
-
- public Form1()
- {
- InitializeComponent();
- }
-
- private void Form1_Load(object sender, EventArgs e)
- {
-
- }
-
- private void Form1_MouseDown(object sender, MouseEventArgs e)
- {
- int i ;
- i = ReleaseCapture();
- i = SendMessage(this.Handle , WM_SYSCOMMAND, SC_MOVE, 0);
- }
- }
- }