Results 1 to 6 of 6

Thread: Change every windows caption to "hello world"

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Feb 2000
    Location
    none
    Posts
    19

    Question

    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,

  2. #2
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Code:
    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
    With this in a module you can use cursorX and cursorY properties for setting and getting mouse position
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  3. #3
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221

    And for the other part

    put this in a module:
    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
    And in the file you want to change all captions of all windows:
    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
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Feb 2000
    Location
    none
    Posts
    19

    Exclamation


    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?

  5. #5
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    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
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  6. #6

    Thread Starter
    Junior Member
    Join Date
    Feb 2000
    Location
    none
    Posts
    19

    Smile

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width