Results 1 to 2 of 2

Thread: Windows API to check if currently selected object is of the outlook data type
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    Board Regular
    Join Date
    Feb 2015
    Posts
    512
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Windows API to check if currently selected object is of the outlook data type

    Is there a windows api function to check the data type of the last item focused on or clicked down on (this includes a dragged object) is of the outlook object type? For instance, if you clicked on your desktop icon to drag it highlights to show its been selected and when you select an email in outlook it highlights and unhighlights the desktop icon since its no longer in focus. Is there a way to check that the current focus selection is outlook related or even better a mailitem in the outlook object model?

    Thanks!
    Last edited by bradyboyy88; Aug 7th, 2019 at 10:28 AM.

  2. #2
    Board Regular
    Join Date
    Feb 2015
    Posts
    512
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Windows API to check if currently selected object is of the outlook data type

    Currently I found this code which tells the active program window on the screen. Unfortunately, if outlook is put in front and you see the file explorer on the screen. You can select a file and drag it without making the file explorer the active window. Any ideas. I have included the code for reference. I want to get the active window for the actively selected object.

    Code:
    ublicDeclareFunction GetForegroundWindow Lib"user32" _
        Alias"GetForegroundWindow"()AsLong
    PublicDeclareFunction GetWindowText Lib"user32" _
        Alias"GetWindowTextA"(ByVal hwnd AsLong, _
        ByVal lpString AsString,ByVal cch AsLong)AsLong
    
    Sub AAA()
        Dim WinText AsString
        Dim HWnd AsLong
        Dim L AsLong
        HWnd = GetForegroundWindow()
        WinText =String(255, vbNullChar)
        L = GetWindowText(HWnd, WinText,255)
        WinText = Left(WinText, InStr(1, WinText, vbNullChar)-1)
        Debug.Print L, WinText
    EndSub
    
    
    Last edited by bradyboyy88; Aug 7th, 2019 at 11:52 AM.

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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