Results 1 to 11 of 11

Thread: [RESOLVED] How can i get rid of this anoying message ?

Hybrid View

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803

    Re: How can i get rid of this anoying message ?

    Quote Originally Posted by Fedhax
    If you are sending an email, it may be better to just pipe to email directly to the SMTP server, and not try to relay it through Outlook?
    Most of the times I need to reply/[reply to all] to e-mails that are already in Outlook, so I have no choice, I have to use Outlook.

    I try to see if I can make it work by finding the windows and SendKeys... Thanks for the idea, it's not very good, but it's better than nothing.

  2. #2

    Thread Starter
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803

    Re: How can i get rid of this anoying message ?

    OK, This is the dialog window using Spy++:


    I used this test code to try to select the options, and close the window, but for some reason, it does not press the "Yes" button...
    VB Code:
    1. Private Sub Form_Load()
    2.     'StartEnumWindows
    3.     tmrCheckOutlook.Interval = 150
    4.     tmrCheckOutlook.Enabled = True
    5. End Sub
    6.  
    7. Private Sub tmrCheckOutlook_Timer()
    8.     Dim hWnd As Long, Count As Long
    9.    
    10.     hWnd = FindWindow("#32770", "Microsoft Outlook")
    11.    
    12.     If hWnd <> -1 And hWnd <> 0 Then
    13.         'StartEnumChildWindows hWnd
    14.        
    15.         BringWindowToTop hWnd
    16.         SetForegroundWindow hWnd
    17.        
    18.         Pause 150
    19.        
    20.         SendKeys "{TAB 2}", True
    21.         SendKeys " ", True
    22.         SendKeys "{TAB}", True
    23.         SendKeys "{DOWN 3}", True
    24.         SendKeys "{TAB}", True
    25.         SendKeys "{ENTER}", True   ' < ---- this does not work !!!
    26.         SendKeys " ", True        ' < ---- pressing the space key does not work either...
    27.        
    28.         Debug.Print "tmrCheckOutlook_Timer"
    29.         tmrCheckOutlook.Enabled = False
    30.     End If
    31. End Sub
    32.  
    33. Private Sub Pause(ByVal Delay As Long)
    34.     Dim EndTime As Long
    35.    
    36.     EndTime = GetTickCount + Delay
    37.     Do
    38.         Sleep 10
    39.         DoEvents
    40.     Loop Until GetTickCount >= EndTime
    41. End Sub
    Attached Images Attached Images   

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803

    Re: How can i get rid of this anoying message ?

    I got it !!! this works !
    Yeeeyyy
    VB Code:
    1. Private Sub Form_Load()
    2.     tmrCheckOutlook.Interval = 150
    3.     tmrCheckOutlook.Enabled = True
    4. End Sub
    5.  
    6. Private Sub tmrCheckOutlook_Timer()
    7.     Dim hwnd As Long
    8.    
    9.     hwnd = FindWindow("#32770", "Microsoft Outlook")
    10.    
    11.     If hwnd <> -1 And hwnd <> 0 Then
    12.         BringWindowToTop hwnd
    13.         SetForegroundWindow hwnd
    14.        
    15.         Pause 150
    16.        
    17.         SendKeys "{TAB 2}", True  ' Go to the checkbox
    18.         SendKeys " ", True        ' Place the checkmark
    19.         SendKeys "{TAB}", True    ' Go to the drop down box
    20.         SendKeys "{DOWN 3}", True ' Select "10 Minutes"
    21.         SendKeys "{TAB}", True    ' Go to the "Yes" button
    22.        
    23.         ' Press Enter Key
    24.         keybd_event 13, 0, 0, 0
    25.         keybd_event 13, SC_RETURN, KEYEVENTF_KEYUP, 0
    26.        
    27.         tmrCheckOutlook.Enabled = False
    28.     End If
    29. End Sub
    30.  
    31. Private Sub Pause(ByVal Delay As Long)
    32.     Dim EndTime As Long
    33.    
    34.     EndTime = GetTickCount + Delay
    35.     Do
    36.         Sleep 10
    37.         DoEvents
    38.     Loop Until GetTickCount >= EndTime
    39. End Sub

  4. #4
    Hyperactive Member Fedhax's Avatar
    Join Date
    Aug 2006
    Posts
    293

    Re: How can i get rid of this anoying message ?

    Quote Originally Posted by CVMichael
    I got it !!! this works !
    Yeeeyyy
    Congrats. As I said, the only option you had was to simulate the end user's input and appease Outlook. It is kinda kludgy, but you gotta do what a VB programmer has gotta do.

  5. #5

    Thread Starter
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803

    Re: How can i get rid of this anoying message ?

    Here's something twisted !

    If I put that code in the same program that accesses the Outlook, the code won't run because Outlook freezes the program until the security window closes...
    So, probably have to put the code into an ActiveX EXE or a complectly separate program...

  6. #6
    Hyperactive Member Fedhax's Avatar
    Join Date
    Aug 2006
    Posts
    293

    Re: How can i get rid of this anoying message ?

    Quote Originally Posted by CVMichael
    Here's something twisted !

    If I put that code in the same program that accesses the Outlook, the code won't run because Outlook freezes the program until the security window closes...
    So, probably have to put the code into an ActiveX EXE or a complectly separate program...
    "Showing windows using vbModal is bad, m'kay?"

    After fighting my own battles with vbModal forms, I can sympathize greatly with your plight. I guess you are right that an ActiveX.EXE is your best way to go: Start it up, get Outlook to slow you down, have ActiveX.EXE kill the dialog window, and end the ActiveX.EXE--unless you just want it trolling for a window that may not be there much of the time?

  7. #7

    Thread Starter
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803

    Re: How can i get rid of this anoying message ?

    It works fine with an ActiveX EXE

    Problem solved !

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