Im just wondering how I would be able to change every windows caption running in windows except WINDOWS EXPLORER to "hello world!"
I also would like to learn the Mousemove effect.
thanks,
Printable View
Im just wondering how I would be able to change every windows caption running in windows except WINDOWS EXPLORER to "hello world!"
I also would like to learn the Mousemove effect.
thanks,
With this in a module you can use cursorX and cursorY properties for setting and getting mouse positionCode:Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Declare Function SetCursorPos Lib "user32" (ByVal X As Long, ByVal Y As Long) As Long
Type POINTAPI
X As Long
Y As Long
End Type
Property Get cursorX() As Integer
Dim pnt As POINTAPI
temp = GetCursorPos(pnt)
cursorX = pnt.X
End Property
Property Let cursorX(newvalue%)
temp = SetCursorPos(newvalue, cursorY)
End Property
Property Get cursorY() As Integer
Dim pnt As POINTAPI
temp = GetCursorPos(pnt)
cursorY = pnt.Y
End Property
Property Let cursorY(newvalue%)
temp = SetCursorPos(cursorX, newvalue)
End Property
put this in a module:
And in the file you want to change all captions of all windows:Code:Private Declare Function EnumWindows Lib "user32" (ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
Private handles&(), counter&
Private Function EnmWinProc(ByVal hWnd As Long, ByVal lParam As Long) As Long
Dim sCaption As String * 255
ReDim Preserve handles(counter)
handles(counter) = hWnd
counter = counter + 1
EnumWindowsProc = hWnd
End Function
Public Function GetWindows()
ReDim handles(0)
counter = 0
Call EnumWindows(AddressOf EnmWinProc, 0&)
ListWindows = handles
End Function
Code:'In declarations
Private Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hWnd As Long, ByVal lpString As String) As Long
'In code
Dim n As Long
For Each n In GetWindows
SetWindowText n, "hello world!"
Next n
there is one problam with the hello world,
the code. says it "for each control variable must be Variant or object"
--------
'In code
Dim n As Long
For Each n In GetWindows
SetWindowText n, "hello world!"
Next n
--------
I looked at the help, nothing much, how can you solve this?
Sorry about that, i couldn't test it since it would change all my important windows...
Code:'Change
Dim n As Long
'To
Dim n As Variant
Thank you kedaman, I am starting to see how to use the AddressOf property and how API functions with the handles.
Thank you very much.
MR MO WHA