1. Use the API to get the title of the window? The oar punishment calender, especially the manlu code:
OptionExplicit
PrivateDeclareFunction nGetWindowTextLibbus—
er32"Alias"GetWindowTextA"(ByValhwndAs
Long, ByVallpStringAsString, ByValchAs
Lon)ALog
'Add description of API function "GetWindowText" in the form declaration section
'The function will load the form capture to be obtained into lpstring
PrivateSubCommand1_Click()
DimreturncodeAsLong
DimcaptextAsString
DimcapplenAsLong
captext=String$(100,0)
caplen=99
returncode=GetWindowText(ByValme.hwnd,
ByValcaptex, ByValcaplen)
printreturncode
Printcaptext
Printcaplen
EndSub
2. How to obtain the screen coordinates of the mouse in the current window (client area)? Create a new project form form1 and add control text boxes Text1 and Text2?橹悺淙怄Han
OptionExplicit
PrivateDeclareFunction GetCursorPosLibuser32"
(lpPointAsPOINTAPI)AsLong
PrivateTypePOINTAPI
XAsLongYAsLong
EndType
DimptAsPOINTAPI
DimreturncodeAsLong
PrivateSubForm_Load()
Text1. Text=""
Text2. Text=""
MaxButton=False
MinButton=False
Form1. WindowState=2
EndSub
PrivateSubForm_Mouse Move(ButtonAsInteger,
ShiftAsInteger, XAsSingle, YAsSingle)
'Note that the pt structure is passed by reference
returncode=GetCursorPos(pt)
Text1. Text=pt. X
Text2. Text=pt. Y
EndSub
3. Record Windows usage time
Create a new project window form1 and enter the code:
PrivateSubForm_Load()
form1. visible=false
Openapp. path+"memo.txt"ForAppendAs#1
Print#1,"Start windows:"&CStr(Now)
Close#1
EndSub
PrivateSubForm_Unload(CancelAsInteger)
Openapp. path+"memo.txt"ForAppendAs#1
Print#1,"Close windows:"&CStr(Now)
Close#1
End
EndSub
Finally, add the program to the startup group. (->