C 中獲取文字框中游標所在位置

2021-05-17 22:10:41 字數 719 閱讀 3996

在c#中獲取文字框中游標所在位置,首先定義api函式

const int em_getsel = 0xb0;

const int em_linefromchar = 0xc9;

const int em_lineindex = 0xbb;

[dllimport("user32.dll", entrypoint = "sendmessage")]

public static extern int sendmessage(

int hwnd,

int wmsg,

int wparam,

ref int lparam

); 獲取位置的函式

private point getcursorpos(int texthwnd)

完整**如下:

using system;

using system.collections.generic;

using system.componentmodel;

using system.data;

using system.drawing;

using system.runtime.interopservices;   //

using system.text;

using system.windows.forms;

namespace cswin

public form1()

在C 中獲取文字框中游標所在位置

首先定義api函式 const intem getsel 0xb0 const intem linefromchar 0xc9 const intem lineindex 0xbb dllimport user32.dll entrypoint sendmessage public static e...

動態獲取當前螢幕中游標所在位置的顏色

using system using system.drawing using system.collections using system.componentmodel using system.windows.forms using system.data using system.drawi...

動態獲取當前螢幕中游標所在位置的顏色

using system using system.drawing using system.collections using system.componentmodel using system.windows.forms using system.data using system.drawi...