GetCaretPos, 判断插入符的当前位置procedure TForm1.Timer1Timer(Sender: TObject); var cursor_postion:tpoint; handle:hwnd; class_name:pchar; intResult:integer; strClassName:string; begin Timer1.Enabled :=false; GetCaretPos(cursor_postion); handle:=windowfrompoint(cursor_postion); if handle<>0 then begin GetMem(class_name,256); intResult:=getclassname(handle,class_name,256); //showmessage(inttostr(intResult));//判断是否得到类型 form1.Memo1.Lines.Add(Trim(string(class_name))); FreeMem(Class_Name); end; timer1.Enabled :=true; end;改一下函数名就可以了,
to ghyghost(爱国人士) : 程序好象不大对,我要得到的是数据库中字段的名字__________________________________________________________________________________ procedure TForm1.Timer1Timer(Sender: TObject); var cursor_postion:tpoint; handle:hwnd; class_name:pchar; intResult:integer; strClassName:string; begin Timer1.Enabled :=false; getcursorpos(cursor_postion); handle:=windowfrompoint(cursor_postion); if handle<>0 then begin GetMem(class_name,256); intResult:=getclassname(handle,class_name,256); //showmessage(inttostr(intResult));//判断是否得到类型 form1.Memo1.Lines.Add(Trim(string(class_name))); FreeMem(Class_Name); end; timer1.Enabled :=true; end;
The GetCursorPos function retrieves the cursor's position, in screen coordinates. BOOL GetCursorPos( LPPOINT lpPoint // address of structure for cursor position ); ParameterslpPointPoints to a POINT structure that receives the screen coordinates of the cursor. Return ValuesIf the function succeeds, the return value is nonzero. If the function fails, the return value is zero. To get extended error information, call GetLastError.ResThe cursor position is always given in screen coordinates and is not affected by the mapping mode of the window that contains the cursor. The calling process must have WINSTA_READATTRIBUTES access to the window station. See Also
GetCursorPos
GetCaretPos
GetCursorPos(&point);
vc里面
hkbarton(宁静至远||淡泊明志) :晕,把分给我! ceocio是骗子!! hoho~~~~
var
cursor_postion:tpoint;
handle:hwnd;
class_name:pchar;
intResult:integer;
strClassName:string;
begin
Timer1.Enabled :=false;
getcursorpos(cursor_postion);
handle:=windowfrompoint(cursor_postion);
if handle<>0 then
begin
GetMem(class_name,256);
intResult:=getclassname(handle,class_name,256);
//showmessage(inttostr(intResult));//判断是否得到类型
form1.Memo1.Lines.Add(Trim(string(class_name)));
FreeMem(Class_Name);
end;
timer1.Enabled :=true;
end;
GetCursorPos
GetCaretPos
var
cursor_postion:tpoint;
handle:hwnd;
class_name:pchar;
intResult:integer;
strClassName:string;
begin
Timer1.Enabled :=false;
GetCaretPos(cursor_postion);
handle:=windowfrompoint(cursor_postion);
if handle<>0 then
begin
GetMem(class_name,256);
intResult:=getclassname(handle,class_name,256);
//showmessage(inttostr(intResult));//判断是否得到类型
form1.Memo1.Lines.Add(Trim(string(class_name)));
FreeMem(Class_Name);
end;
timer1.Enabled :=true;
end;改一下函数名就可以了,
procedure TForm1.Timer1Timer(Sender: TObject);
var
cursor_postion:tpoint;
handle:hwnd;
class_name:pchar;
intResult:integer;
strClassName:string;
begin
Timer1.Enabled :=false;
getcursorpos(cursor_postion);
handle:=windowfrompoint(cursor_postion);
if handle<>0 then
begin
GetMem(class_name,256);
intResult:=getclassname(handle,class_name,256);
//showmessage(inttostr(intResult));//判断是否得到类型
form1.Memo1.Lines.Add(Trim(string(class_name)));
FreeMem(Class_Name);
end;
timer1.Enabled :=true;
end;
);
ParameterslpPointPoints to a POINT structure that receives the screen coordinates of the cursor. Return ValuesIf the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.ResThe cursor position is always given in screen coordinates and is not affected by the mapping mode of the window that contains the cursor.
The calling process must have WINSTA_READATTRIBUTES access to the window station. See Also
用 OnMouseMove 事件不就行了
用 OnMouseMove 事件不就行了谢谢您~!我的字段是用DBGrid显示的 您能帮我把代码写出来吗?
例如: 将电视的价格提高100元。
将掌上电脑的型号改变。2:增加一个“高级设置”按钮,用来添加数据项。(改成“添加”按纽了)
增加一个新的可选物品,包括名字,价格等数据。
在随即选取的时候,可以选择到这个物品。
Y: Integer);
var
RowIndex,ColumnIndex:Integer;
begin
RowIndex:=DBGrid1.MouseCoord(X,Y).Y-1;
ColumnIndex:=DBGrid1.MouseCoord(X,Y).X-1;//根据 ColumnIndex 可得知字段名:Columns[ColumnIndex].FieldName
end;
知道了字段名,你可以自己做了
呵呵,那是上一行的注释内容,CSDN 帮我换行了。
知道了字段名,你可以自己做了
p:tpoint;
getcursorpos(p);