Results 1 to 10 of 10

Thread: other process' text box

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 1999
    Posts
    79
    is there anyway i can change the value of another applications' text box? or gray it out?


    thanks


    mark

  2. #2
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    sure!

    Put this in a class module: (It's a class I wrote some time ago, download it along with the examples from: http://www.geocities.com/despotez/WH/ )

    Code:
    ' ********Jop's WindowHandler Class*********
    ' ********geocities.com/despotez/WH*********
    
    ' ********Special thanks to KEDAMAN*********
    ' ********   -(www.kedaman.com)-   *********
    
    'LEGAL STUFF:
    'You are allowed to use it in personal & commercial
    'programs as long as you:
    
    ' - Leave this header unmodified in the class.
    ' - Don't use it for any malicious (Illegal) actions.
    ' - And... Ah well, just enjoy it :)
    ' - Please email me if you like it or not.
    
    'To get full advantage of this class use the module.
    'To get some examples use the Example.frm
    
    'Here are the Properties and Functions, and what they do.
    
    'Dim win As New WindowHandler <  use this to initialize the class
    
    'AlwaysOnTop      > Sets the specified window (by hWnd) always on top or not.
    'Caption          > Sets or gets the caption of a specified window or control (by hWnd).
    'Click            > Click the specified window (by hWnd) at a specified point.
    'CloseWindow      > Closes the specified window (by hWnd).
    'Enabled          > Enable or Disable the specified window (by hWnd) or get it's status.
    'FindWin          > This gets the hWnd of a window by it's caption or classname.
    'FindWinEx        > This gets the hWnd of any child window or control by it's caption or classname.
    'FlashWin         > This flashes the specified window by a specified time.
    'GetAllWindows    > This gets all open windows in an array (pass it a variant).
    'GetMetrics       > This gets the Rectangle of the window (top, left, right, bottom) in a RECT.
    'GetMousePos      > This gets the coordinates of the mousecursor in a POINTAPI.
    'GetWinProperties > This gets the properties (left, top, width, height, classname, caption) from a window (by hWnd).
    'GetWndClassName  > This gets the classname from a window or control.
    'MouseDown        > This pushes down (and hold) the specified mousebutton on the point where the mouse is.
    'MouseUp          > This triggers the MouseUp event to release the MouseDown (MouseDown + MouseUp = Click)
    'Move             > This is used to move and/or resize a window or control.
    'Redraw           > This is used to Redraw (refresh) a specified window (it triggers the PAINT method for that form)
    'SetFocus         > This sets the focus (it's sets it to the foreground) to a specified window (by hWnd).
    'SetMousePos      > This sets the mousecursor to the specified coordinates.
    'ShowMouse        > This shows or hides the mousecursor.
    'SwapMouse        > This Swaps the mousebuttons or restores them.
    'Visible          > This makes the window visible/invisible or checks the state (visible or invisible).
    'WinFromPoint     > This gets the hWnd of the window or control currently under the mousepointer.
    
    
    'Api calls
    Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
    Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
    Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
    Private Declare Function SendMessageByString Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
    Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
    Private Declare Function SetWindowText Lib "user32.dll" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As Long
    Private Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As Long) As Long
    Private Declare Sub SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long)
    Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
    Private Declare Function MoveWindow Lib "user32" (ByVal hwnd As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal bRepaint As Long) As Long
    Private Declare Function FlashWindow Lib "user32" (ByVal hwnd As Long, ByVal bInvert As Long) As Long
    Private Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
    Private Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long
    Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
    Private Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) As Long
    Private Declare Function EnableWindow Lib "user32" (ByVal hwnd As Long, ByVal fEnable As Long) As Long
    Private Declare Function IsWindowEnabled Lib "user32" (ByVal hwnd As Long) As Long
    Private Declare Function IsWindowVisible Lib "user32" (ByVal hwnd As Long) As Long
    Private Declare Function SwapMouseButton Lib "user32" (ByVal bSwap As Long) As Long
    Private Declare Function ShowCursor Lib "user32" (ByVal bShow As Long) As Long
    Private Declare Function RedrawWindow Lib "user32" (ByVal hwnd As Long, lprcUpdate As Any, ByVal hrgnUpdate As Long, ByVal fuRedraw As Long) As Long
    Private Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd As Long) As Long
    Private Declare Function EnumChildWindows Lib "user32" (ByVal hWndParent As Long, ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
    Private Declare Function GetParent Lib "user32" (ByVal hwnd As Long) As Long
    Private Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long
    
    'Enums
    
    
    'Types
    Private Type RECT
            Left As Long
            Top As Long
            Right As Long
            Bottom As Long
    End Type
    
    Private Type POINTAPI
            x As Long
            y As Long
    End Type
    
    
    'Constants
    Private Const MOUSEEVENTF_LEFTDOWN = &H2
    Private Const MOUSEEVENTF_LEFTUP = &H4
    Private Const MOUSEEVENTF_MIDDLEDOWN = &H20
    Private Const MOUSEEVENTF_MIDDLEUP = &H40
    Private Const MOUSEEVENTF_MOVE = &H1
    Private Const MOUSEEVENTF_ABSOLUTE = &H8000
    Private Const MOUSEEVENTF_RIGHTDOWN = &H8
    Private Const MOUSEEVENTF_RIGHTUP = &H10
    
    Private Const SC_CLOSE = &HF060
    Private Const SC_CONTEXTHELP = &HF180
    Private Const SC_MAXIMIZE = &HF030
    Private Const SC_MINIMIZE = &HF020
    Private Const SC_MOVE = &HF010
    Private Const SC_RESTORE = &HF120
    Private Const SC_SIZE = &HF000
    
    Private Const MK_CONTROL = &H8
    Private Const MK_LBUTTON = &H1
    Private Const MK_MBUTTON = &H10
    Private Const MK_RBUTTON = &H2
    Private Const MK_SHIFT = &H4
    Private Const MK_XBUTTON1 = &H20
    Private Const MK_XBUTTON2 = &H40
    
    Private Const WM_RBUTTONDOWN = &H204
    Private Const WM_SYSCOMMAND = &H112
    Private Const WM_GETTEXTLENGTH = &HE
    Private Const WM_ACTIVATEAPP = &H1C
    Private Const WM_ACTIVATE = &H6
    Private Const WM_SETTEXT = &HC
    Private Const WM_GETTEXT = &HD
    
    Private Const HWND_TOPMOST = -1
    Private Const HWND_NOTOPMOST = -2
    
    Private Const RDW_INVALIDATE = &H1
    
    Private Const SWP_NOSIZE = &H1
    Private Const SWP_NOMOVE = &H2
    Private Const SWP_NOACTIVATE = &H10
    Private Const SWP_SHOWWINDOW = &H40
    
    Private Const GW_HWNDFIRST = 0
    Private Const GW_HWNDNEXT = 2
    
    Function GetAllWindows(starthwnd&)
    'THANKS TO KEDAMAN
    'For alot more cool stuff see http://www.kedaman.com!
    Dim cw&(), currwnd&: ReDim cw(0)
        currwnd = GetWindow(starthwnd, GW_HWNDFIRST)
        While currwnd <> 0
            cw(UBound(cw)) = currwnd
            ReDim Preserve cw(UBound(cw) + 1)
            currwnd = GetWindow(currwnd, GW_HWNDNEXT)
            DoEvents
        Wend
        If UBound(cw) Then ReDim Preserve cw(UBound(cw) - 1) Else Exit Function
        GetAllWindows = cw
    End Function
    
    
    Public Function FindWin(Class As String, Caption As String) As Long
    Dim x As Long
    If Class = "" Then Class = vbNullString
    If Caption = "" Then Caption = vbNullString
    FindWin = FindWindow(Class, Caption)
    End Function
    Public Function FindWinEx(ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal param1 As String, ByVal param2 As String) As Long
    FindWinEx = FindWindowEx(hWnd1, hWnd2, param1, param2)
    End Function
    Public Property Let Visible(WinhWnd As Long, flag As Boolean)
    ShowWindow WinhWnd, -flag * 5
    End Property
    Public Property Get Visible(WinhWnd As Long) As Boolean
    Visible = -(IsWindowVisible(WinhWnd))
    End Property
    Public Property Let Caption(WinhWnd As Long, Caption As String)
    SendMessage WinhWnd, WM_SETTEXT, ByVal CLng(0), ByVal Caption
    End Property
    
    Public Property Get Caption(WinhWnd As Long) As String
    Dim l%, Wintext$, retval&
    l = SendMessage(WinhWnd, WM_GETTEXTLENGTH, ByVal CLng(0), ByVal CLng(0)) + 1
    Wintext = Space(l)
    retval = SendMessage(WinhWnd, WM_GETTEXT, ByVal l, ByVal Wintext)
    Wintext = Left(Wintext, retval)
    Caption = Wintext
    End Property
    
    Public Function CloseWindow(WinhWnd As Long)
    SendMessage WinhWnd, WM_SYSCOMMAND, ByVal SC_CLOSE, ByVal 0&
    End Function
    
    Public Function SetFocus(WinhWnd As Long)
    SetForegroundWindow WinhWnd
    End Function
    
    Public Property Let AlwaysOnTop(WinhWnd As Long, flag As Boolean)
        SetWindowPos WinhWnd, -2 - flag, 0, 0, 0, 0, SWP_NOACTIVATE Or SWP_SHOWWINDOW Or SWP_NOMOVE Or SWP_NOSIZE
    End Property
    Friend Function GetMetrics(WinhWnd As Long) As RECT
    Dim win As RECT
    GetWindowRect WinhWnd, win
    GetMetrics = win
    End Function
    
    Public Function Move(WinhWnd As Long, x As Long, y As Long, Optional Width As Long, Optional Height As Long)
    Dim win As RECT
    GetWindowRect WinhWnd, win
    If Width = 0 Then Width = win.Right - win.Left
    If Height = 0 Then Height = win.Bottom - win.Top
    MoveWindow WinhWnd, x, y, Width, Height, 1
    End Function
    
    Public Sub FlashWin(WinhWnd As Long, Time As Integer)
    Dim x&, i%
    For i = 0 To Time * 2
        For x = 0 To 5000
        DoEvents
        Next x
    FlashWindow WinhWnd, 1
    Next i
    End Sub
    
    Public Sub Click(WinhWnd As Long, x As Long, y As Long, Optional Left As Boolean = True, Optional Right As Boolean, Optional Middle As Boolean, Optional DoubleClick As Boolean = False)
    Dim i%
    
    If DoubleClick Then
    MouseDown Left, Right, Middle, True, True, x, y
    MouseDown Left, Right, Middle, True, True, x, y
    Else
    MouseDown Left, Right, Middle, True, True, x, y
    End If
    End Sub
    Public Sub SetMousePos(x As Long, y As Long)
    SetCursorPos x, y
    End Sub
    
    Friend Function GetMousePos() As POINTAPI
    Dim pnt As POINTAPI
    GetCursorPos pnt
    GetMousePos = pnt
    End Function
    Public Sub MouseDown(Optional Left As Boolean = True, Optional Right As Boolean, Optional Middle As Boolean, Optional Click As Boolean, Optional MoveToPoint As Boolean, Optional x As Long, Optional y As Long)
    'Thanks to Kedaman for this:
    If MoveToPoint Then SetCursorPos x, y
        mouse_event -Left * 2 - Right * 8 - Middle * 32, 0, 0, 0&, 0&
        If Click Then mouse_event -Left * 4 - Right * 16 - Middle * 64, 0&, 0&, 0&, 0&
    End Sub
    Public Sub MouseUp(Optional Left As Boolean = True, Optional Right As Boolean, Optional Middle As Boolean, Optional MoveToPoint As Boolean, Optional x As Long, Optional y As Long)
    'Thanks to Kedaman for this:
    If MoveToPoint Then SetCursorPos x, y
        mouse_event -Left * 4 - Right * 16 - Middle * 64, 0, 0, 0&, 0&
    End Sub
    
    Public Function WinFromPoint(x, y) As Long
    WinFromPoint = WindowFromPoint(x, y)
    End Function
    
    Public Property Let Enabled(WinhWnd As Long, Enable As Boolean)
    EnableWindow WinhWnd, -Enable
    End Property
    
    Public Property Get Enabled(WinhWnd As Long) As Boolean
    Enabled = -(IsWindowEnabled(WinhWnd))
    End Property
    
    Public Sub SwapMouse(Swap As Boolean)
    SwapMouseButton -Swap
    End Sub
    
    Public Sub ShowMouse(Show As Boolean)
    ShowCursor -Show
    End Sub
    
    Public Sub Redraw(WinhWnd)
    RedrawWindow WinhWnd, ByVal 0&, ByVal 0&, RDW_INVALIDATE
    End Sub
    
    Public Function GetWndClassName(WinhWnd)
    'Thanks Keda!
       Dim temp As String * 255, l As Long
        l = GetClassName(WinhWnd, temp, 255)
        If l Then GetWndClassName = Left$(temp, l)
    End Function
    
    Friend Function GetWinProperties(Handle As Long) As wnd
    'This is just a function to get all the properties of a window at once.
    Dim wind As wnd, win As New WindowHandler, Rct As RECT
    wind.Caption = win.Caption(Handle)
    wind.ClassName = win.GetWndClassName(Handle)
    Rct = win.GetMetrics(Handle)
    wind.Left = Rct.Left
    wind.Top = Rct.Top
    wind.Width = Rct.Right - Rct.Left
    wind.Height = Rct.Bottom - Rct.Top
    GetWinProperties = wind
    End Function
    And this on your form:
    Code:
    'This is to disable the ICQ window, you can disable almost anything (textboxes, buttons etc.)
    
    Private Function DisableICQ(UIN As String)
    'This function disables ICQ window for a few secs.
    'Nothing cool, but you can use it for almost anything
    '(textboxes, buttons and more)
    'Oh, don't forget you can enable things too :) very handy
    'when a program vendor (trial) has disabled some functions :)
    Dim win As New WindowHandler, i&, ic&, il&, l&, x&
    i = win.FindWin("", UIN)
    ic = win.FindWinEx(i, ByVal 0&, "ICQ Contact List Window", "")
    il = win.FindWinEx(ic, ByVal 0&, "ICQ Lists Window", "")
    l = win.FindWinEx(il, ByVal 0&, "ListBox", "")
    win.Enabled(l) = False
    For x = 0 To 90000 'this is just to "wait"
    DoEvents
    Next
    win.Enabled(l) = True
    End Function
    Private Sub Swap()
    'This swaps the mousebutton for a few secs
    'just to confuse the user, use it wisely ;)
    Dim win As New WindowHandler, x&
    win.SwapMouse True
    For x = 0 To 90000 'this is just to "wait"
    DoEvents
    Next
    win.SwapMouse False
    End Sub
    
    
    'And use this to get the active URL from explorer:
    
    Private Function GetIEurl()
    'This get's the URL of the active  IE window.
    'You could throw it in a loop if you need to get all windows.
    Dim win As New WindowHandler, wind As RECT, i&, w&, r&, c&, c2&, e&
    i = win.FindWin("IEFrame", "")
    w = win.FindWinEx(i, ByVal 0&, "WorkerA", "")
    r = win.FindWinEx(w, ByVal 0&, "ReBarWindow32", "")
    c = win.FindWinEx(r, ByVal 0&, "ComboBoxEx32", "")
    c2 = win.FindWinEx(c, ByVal 0&, "ComboBox", "")
    e = win.FindWinEx(c2, ByVal 0&, "Edit", "")
    GetIEurl = win.Caption(e)
    End Function
    If you need more examples take a look here:
    http://www.geocities.com/despotez/WH/example.frm.txt

    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

  3. #3
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    Whooh ****, just realized that was a bit too much code for such a simple task , didn't mean to scare ya mate

    here are the API calls you need, just check in the Class how I did it.

    Code:
    Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
    Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
    Private Declare Function EnableWindow Lib "user32" (ByVal hwnd As Long, ByVal fEnable As Long) As Long
    Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
    
    
    Private Const WM_SETTEXT = &HC
    Private Const WM_GETTEXT = &HD
    Private Const WM_GETTEXTLENGTH = &HE
    
    Public Property Let Caption(WinhWnd As Long, Caption As String)
    SendMessage WinhWnd, WM_SETTEXT, ByVal CLng(0), ByVal Caption
    End Property
    
    Public Property Get Caption(WinhWnd As Long) As String
    Dim l%, Wintext$, retval&
    l = SendMessage(WinhWnd, WM_GETTEXTLENGTH, ByVal CLng(0), ByVal CLng(0)) + 1
    Wintext = Space(l)
    retval = SendMessage(WinhWnd, WM_GETTEXT, ByVal l, ByVal Wintext)
    Wintext = Left(Wintext, retval)
    Caption = Wintext
    End Property
    
    Public Property Let Enabled(WinhWnd As Long, Enable As Boolean)
    EnableWindow WinhWnd, -Enable
    End Property
    
    Public Property Get Enabled(WinhWnd As Long) As Boolean
    Enabled = -(IsWindowEnabled(WinhWnd))
    End Property
    Ok that's easier to reead huh

    If you need help just let me know ok?

    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Dec 1999
    Posts
    79
    Cheers dude, i'll give it a whirl a bit later


    Mark

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Dec 1999
    Posts
    79
    im just trying this now, and it seems great, but how do I find the name of a text box to disable it?


    thanks

  6. #6
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    You need an API Spy to check the Classnames of the EditBoxes (that's how textboxes are called in windows)

    Use FindWindowEx to get the handle of the EditBoxes,
    here's an example for notepad:

    I wrote it some time ago so you may need to adjust it to your needs, but it gives a general idea how to get the handle of an EditBox
    Code:
    Option Explicit
    Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
    Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
    Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Integer, ByVal lParam As Any) As Long
    Private Const WM_GETTEXTLENGTH = &HE
    Private Const WM_GETTEXT = &HD
    Private Const WM_SETTEXT = &HC
    
    Private Sub Form_Load()
    Dim lNoteP&, edit&
    lNoteP = FindWindow("Notepad", vbNullString) 'get the handle of the window
    edit = FindWindowEx(lNoteP, 0&, "Edit", "") 'get the handle of the EditBox
    
        SetText edit, "HEYYY IK BEN JOP" 
    End Sub
    
    Private Sub SetText(Wnd As Long, Text As String)
        SendMessage Wnd, WM_SETTEXT, ByVal CLng(0), ByVal Text 'set the text of the editbox
    End Sub
    
    Private Function GetText(Wnd As Long)
    Dim l%, Wintext$, retval&
        l = SendMessage(Wnd, WM_GETTEXTLENGTH, ByVal CLng(0), ByVal CLng(0)) + 1 'get the length of the text
        Wintext = Space(l) 'make room to put it in
        retval = SendMessage(Wnd, WM_GETTEXT, ByVal l, ByVal Wintext) 'get the text
    GetText = Left(Wintext, retval)
    End Function
    take a look at the examples on
    http://www.geocities.com/despotez/WH/
    it'll demonstrate how to disable a EditBox too.

    Hope it didn't confuse ya.
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Dec 1999
    Posts
    79
    Thanks so much for this help - I'm almost there.

    However, i'm not sure how to find one edit box when there is more than one in a window, and they both have no caption?

    thanks


    mark

  8. #8
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    Shouldn't be too hard too

    Lets say had 2 textboxes, we would do:

    Code:
    edit = FindWindowEx(lNoteP, 0&, "Edit", "") 'get the handle of the first EditBox
    edit = FindWindowEx(lNoteP, edit, "Edit", "") 'get the handle of the second EditBox
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

  9. #9

    Thread Starter
    Lively Member
    Join Date
    Dec 1999
    Posts
    79
    Cheers! Its nearly working. Just need to change the code to make it disable the box rather than change its text!


    Thanks a lot dude, your brill!


    Mark

  10. #10
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    Here's the code I scribbled for ya to disable the NotePad's editbox (this is without the class).

    Code:
    Option Explicit
    Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
    Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
    Private Declare Function EnableWindow Lib "user32" (ByVal hwnd As Long, ByVal fEnable As Long) As Long
    
    
    Private Sub Form_Load()
    Dim lNoteP&, edit&
    lNoteP = FindWindow("Notepad", vbNullString) 'get the handle of the window
    edit = FindWindowEx(lNoteP, 0&, "Edit", "") 'get the handle of the EditBox
    
    EnableWindow edit, 0 'disable it
    End Sub
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

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