Results 1 to 6 of 6

Thread: api function?

  1. #1

    Thread Starter
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    how do i use
    Code:
    Public Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
    also, i have microsoft spy++ so how do i find the handle of ie, then change its title? setwindowtext maybe???

  2. #2
    Addicted Member
    Join Date
    Aug 1999
    Location
    Hamilton, New Zealand
    Posts
    137
    Code:
    Dim Path as String, strSave as string
    'Create a buffer string
    strSave = String(200, Chr$(0))
    'Get the windows directory 
    Path = Left$(strSave, GetWindowsDirectory(strSave, Len(strSave)))
    'The left$ strips the trailing spaces
    Hope this helps
    Regards

    Matt Brown
    Hamilton, NZ
    VB6 C++ in Visual Studio 6sp4
    VB.net Beta 1

  3. #3
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>


    Code:
    'find the windows directory path
    'usefull in shell commands if you know something
    'is in the windows directory
    'example..instead of shell c:\windows\notepad.ext
    'you could use shell windir$ & /notepad.exe
    'if windows was stored in E:/Windows then you wouldn't get an error
    'if you used shell c:/windosw\notepad.exe, it couldn't be found '(error)
    '
    Option Explicit
    
    Private Declare Function GetWindowsDirectory _
    Lib "kernel32" Alias "GetWindowsDirectoryA" _
    (ByVal lpBuffer As String, ByVal nSize As Long) As Long
    '
    Private Sub Form_Load()
    '
        Dim strFindWinDir$, WinDir$
    '
            WinDir$ = Space(144)
            strFindWinDir$ = GetWindowsDirectory(WinDir$, 144)
            WinDir$ = Trim(WinDir$)
    '
            MsgBox "The Windows Directory Path is: " & WinDir$
    '
    End Sub
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  4. #4
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538
    http://www.vbapi.com/ref/g/getwindowsdirectory.html

    2 above are completely right, to read up more on it though, heck out the above.

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

  5. #5
    Guest
    Originally posted by da_silvy
    also, i have microsoft spy++ so how do i find the handle of ie, then change its title? setwindowtext maybe???
    Put the following into a Form with a CommandButton. When you click it, IE (if open) will have its title changed to "New Title For IE".
    Code:
    Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
    Private Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As Long
    
    Private Sub Command1_Click()
        Dim hApp As Integer
        Dim NewTitle As String
        
        NewTitle = "New Title for IE"
        hApp = FindWindow("IEFrame", vbNullString)
        If hApp <> 0 Then SetWindowText hApp, NewTitle
    End Sub

  6. #6

    Thread Starter
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    how do i find the name i.e "IEFRAME" to change the title of ie

    for example

    who do i find the name for other instances of ie or msn messenger or vb?

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