using system;
using system.collections.generic;
using system.linq;
using system.runtime.interopservices;
using system.text;
using system.threading;
using system.threading.tasks;
//[stathread]
[structlayout(layoutkind.sequential)]//定義與api相相容結構體,實際上是一種記憶體轉換
public struct pointapi
[dllimport("user32.dll", entrypoint = "getcursorpos")]//獲取滑鼠座標
public static extern int getcursorpos(
ref pointapi lppoint
);[dllimport("user32.dll", entrypoint = "windowfrompoint")]//指定座標處窗體控制代碼
public static extern int windowfrompoint(
int xpoint,
int ypoint
);[dllimport("user32.dll", entrypoint = "getwindowtext")]
public static extern int getwindowtext(
int hwnd,
stringbuilder lpstring,
int nmaxcount
);[dllimport("user32.dll", entrypoint = "getclassname")]
public static extern int getclassname(
int hwnd,
stringbuilder lpstring,
int nmaxcont
);///
/// 根據類名和視窗名獲取控制代碼
///
///
///
///
[dllimport("user32.dll")]
public static extern intptr findwindow(string lpclassname, string lpwindowname);
///
/// 給視窗傳送訊息
///
///
///
///
///
///
[dllimport("user32.dll", entrypoint = "sendmessage")]
private static extern int sendmessage(intptr hwnd, int wmsg, int wparam, int lparam);
[dllimport("user32.dll")]
public static extern int sendmessage(intptr hwnd, int msg, intptr wparam, [marshalas(unmanagedtype.lpstr)] string lparam);
//貼上
const int wm_paste = 0x0302;
const int wm_copy = 0x0301;
//鍵盤命令
const int wm_sethotkey = 0x0032;
//enter鍵
const int hotkeyf_ext = 0x08;
const int wm_keydown = 0x0100;
const int vk_return = 0x0d;
static void main()
//測試
}
JS 常用位置 和 尺寸 獲取 滑鼠的座標
innerwidth 文件顯示區域 寬 innerheight 文件顯示區域 高 outwidth 瀏覽器整個寬 outheight 瀏覽器整個高 screenx screenleft 瀏覽器裡螢幕左上角距離的x座標 screeny screentop 瀏覽器裡螢幕左上角距離的y座標 尺寸 elem...
JS獲取滑鼠的座標和滾動條的位置
1相對視窗,當然是以瀏覽器視窗為主了,即瀏覽器中可見部分 即包含文件部分 的左上角為座標原點。這是用clientx和clienty獲取的。2相對螢幕,當然是以你的顯示器為主了,顯示器的左上角為原點,用screenx和screeny可以獲取到 3相對文件的,即以文件body所顯示的左上角為原點,例如當...
MFC視窗位置和大小的獲取
最近在做乙個專案,需要控制項隨對話方塊大小的變化而變化,因此需要準確獲取對話方塊視窗 控制項的大小和位置。經過好一番查尋 測試,終於看到了希望。下面是一些獲取視窗位置和大小的函式,示例如下 1 獲取螢幕解析度 下邊兩個函式獲取的是顯示螢幕的大小,但不包括工作列等區域 int cx getsystem...