Results 1 to 4 of 4

Thread: hWnd handle of an active email object

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2001
    Location
    Australia
    Posts
    8

    Angry hWnd handle of an active email object

    Is there anyone there who knows how to extract the window handle of an opened email object using VB6 and was created by VB6 in the 1st place. The e-mail object is in the background obviously. Can the body or subject object of an email has its own object window handle?

  2. #2
    Hyperactive Member SoftwareMaker's Avatar
    Join Date
    Mar 2001
    Location
    Elbonia with Dilbert and Wally
    Posts
    322
    Win32 API provides quite a few functions to find out the Handle of a Window. It all depends on how you want to find THAT handle of the window

    Below are 2 ways :

    1 - Finds the Window Handle by your app sending in the Windows Caption of the Window you want and hWndWindow will return THAT window's Handle

    2 - Returns the Handle of the Window which your Mouse Pointer happends to be on.

    ///////////////////////////////////////////////////////////////////////////

    1) Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long

    Dim strTitle As String
    strTitle = InputBox$("Enter the Title of the Window you want to change")
    hWndWindow = FindWindow(vbNullString, strTitle)
    MsgBox "Handle is " & hWndWindow

    2) Public Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) As Long

    'Get Position of the Mouse
    GetCursorPos Point

    'WindowsFromPoint Returns the Handle of the Window Under the Mouse
    WinhWnd = WindowFromPoint(Point.X, Point.Y)
    txtHandle = WinhWnd
    William T
    Software Architect / Chief Software Developer
    Softwaremaker.Net Pte Ltd
    http://www.Softwaremaker.net

    *** Things are always the darkest before they go pitch black ***

  3. #3

    Thread Starter
    New Member
    Join Date
    Aug 2001
    Location
    Australia
    Posts
    8
    Thank you for replying but there is a problem:

    Solution 2 will not work:

    The word document runs in the background. The email object is also created in the background. The population of the word bookmarks is done with VB6. It the same for when an e-mail is created.

    For solution 1:

    How do you send the window caption? Use GetWindow?

    Can this API call be used to get the window handle of the EMAIL body? If it is then what is the class name of the email body? Can you suggest a good site that explains a lot about Outlook objects? I guess MSDN is a good start.

    Thank you heaps.

  4. #4
    Hyperactive Member SoftwareMaker's Avatar
    Join Date
    Mar 2001
    Location
    Elbonia with Dilbert and Wally
    Posts
    322
    Hi I dont know much about Outlook Objects...Outlook Express objects, however, belong to that of the Internet Browser.

    As of Solution 1, you just have to enter the Caption of the Window to get the Handle...etc "Microsoft Outlook". You do not need to know the classname...just send in a vbnullstring

    Let me know your email address...and I will send you a copy of a project of mine that I created to mess around with Win Handles. Take a look at the source codes and see if it helps
    William T
    Software Architect / Chief Software Developer
    Softwaremaker.Net Pte Ltd
    http://www.Softwaremaker.net

    *** Things are always the darkest before they go pitch black ***

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