请问如何正确选择记事本中的指定行?
如果没有双字节字符,执行结果是正确
PUBLIC oform1
oform1=NEWOBJECT("form1")
oform1.Show
RETURN
DEFINE CLASS form1 AS form
Height = 110
Width = 193
ShowWindow = 2
DoCreate = .T.
AutoCenter = .T.
Caption = "Form1"
AlwaysOnTop = .T.
Name = "Form1"
ADD OBJECT command1 AS commandbutton WITH ;
Top = 60, ;
Left = 48, ;
Height = 25, ;
Width = 60, ;
Caption = "执行", ;
Name = "Command1"
ADD OBJECT text1 AS textbox WITH ;
Alignment = 3, ;
Value = 1, ;
Height = 25, ;
InputMask = "999", ;
Left = 72, ;
Top = 24, ;
Width = 40, ;
Name = "Text1"
ADD OBJECT label1 AS label WITH ;
Caption = "选择第:", ;
Height = 16, ;
Left = 24, ;
Top = 29, ;
Width = 46, ;
Name = "Label1"
ADD OBJECT label2 AS label WITH ;
Caption = "行", ;
Height = 16, ;
Left = 116, ;
Top = 29, ;
Width = 46, ;
Name = "Label2"
PROCEDURE command1.Click
#Define EM_SETSEL 0xb1
#Define EM_LINEINDEX 0xbb
TEXT TO prgprg noshow
2343432435
34454t4365t43
ddffergter
rwew阿德顺丰到付归属感
谁丰东股份23424递四方速递
23424535
水电费45235
3424
endtext
DECLARE Long FindWindowEx IN WIN32API Long, Long, String, String
Declare Integer SendMessage In WIN32API as SendMessages Integer,Integer,Integer,String
Declare Integer SendMessage In WIN32API as SendMessagen Integer,Integer,Integer,Integer
Declare Integer WinExec in kernel32 string, integer
winexec("NOTEPAD.EXE",1)
hWnd = FindWindowEx( 0, 0, "Notepad", NULL )
SendMessages(m.Hwnd,274,61488,null)
lnSendHwnd=FindWindowEx(m.hwnd,0,"Edit",Null)
SendMessages(lnSendHwnd,12,LEN(prgprg)+1,prgprg)
i=thisform.text1.value
SendMessagen(lnSendHwnd,EM_SETSEL,SendMessagen(lnSendHwnd,EM_LINEINDEX,i-1,0),SendMessagen(lnSendHwnd,EM_LINEINDEX,i,0))
ENDPROC
ENDDEFINE
[此贴子已经被作者于2024-11-10 14:42编辑过]