How do you make an outlook reminder popup on top of other windows -


how make outlook reminder popup on top of other windows?

after looking online long while; wasn't able find satisfactory answer question.

using windows 7 , microsoft outlook 2007+; when reminder flashes up, no longer gives modal box grab attention. @ work additional plugins can problematic install (admin rights) , when using quiet system, meeting requests overlooked.

is there easier way implement using third party plugins/apps?

* latest macro please see update 3 *

after searching while found partial answer on website seemed give me majority of solution; https://superuser.com/questions/251963/how-to-make-outlook-calendar-reminders-stay-on-top-in-windows-7

however noted in comments, first reminder failed popup; while further reminders did. based on code assumed because window wasn't detected until had instantiated once

to around this, looked employ timer periodically test if window present , if was, bring front. taking code following website; outlook vba - run code every half hour

then melding 2 solutions gave working solution problem.

from trust centre, enabled use of macros opening visual basic editor outlook (alt+f11) added following code 'thisoutlooksession' module

private sub application_startup()     call activatetimer(5) 'set timer go off every 5 seconds end sub  private sub application_quit()   if timerid <> 0 call deactivatetimer 'turn off timer upon quitting  end sub 

then added module , added following code

declare function settimer lib "user32" (byval hwnd long, byval nidevent _ long, byval uelapse long, byval lptimerfunc long) long  declare function killtimer lib "user32" (byval hwnd long, byval nidevent _ long) long  private declare function findwindowa lib "user32" (byval lpclassname _ string, byval lpwindowname string) long  private declare function setwindowpos lib "user32" (byval hwnd long, byval _  hwndinsertafter long, byval x long, byval y long, byval cx long, _ byval cy long, byval wflags long) long  private const swp_nosize = &h1 private const swp_nomove = &h2 private const flags long = swp_nomove or swp_nosize private const hwnd_topmost = -1  public timerid long 'need timer id turn off timer.  ' if timer id <> 0 timer running  public sub activatetimer(byval nseconds long)     nseconds = nseconds * 1000      'the settimer call accepts milliseconds, convert seconds     if timerid <> 0 call deactivatetimer      'check see if timer running before call settimer     timerid = settimer(0, 0, nseconds, addressof triggertimer)     if timerid = 0 msgbox "the timer failed activate." end sub  public sub deactivatetimer()     dim lsuccess long     lsuccess = killtimer(0, timerid)     if lsuccess = 0         msgbox "the timer failed deactivate."     else         timerid = 0     end if end sub  public sub triggertimer(byval hwnd long, byval umsg long, _ byval idevent long, byval systime long)     call eventmacro end sub  public sub eventmacro()     dim reminderwindowhwnd variant     on error resume next     reminderwindowhwnd = findwindowa(vbnullstring, "1 reminder")     if reminderwindowhwnd <> 0 setwindowpos reminderwindowhwnd, _     hwnd_topmost, 0, 0, 0, 0, flags     reminderwindowhwnd = nothing end sub 

so that's it; every 5 seconds, timer checks whether window caption "1 reminder" exists bumps top...


update: after using while found real annoyance fact triggering timer removes focus current window. it's massive hassle you're writing e-mail.

as such upgraded code timer runs every 60 seconds upon finding first active reminder, timer stopped , secondary event function used forthwith activate window focus change.

update 2: having transitioned outlook 2013 - code stopped working me. have updated further function (findreminderwindow) looks range of popup reminder captions. works me in 2013 , should work versions below 2013.

the findreminderwindow function takes value number of iterations step through find window. if routinely have larger number of reminders 10 popup increase number in eventmacro sub...

updated code below: add following code 'thisoutlooksession' module

private sub application_startup()     call activatetimer(60) 'set timer go off every 60 seconds end sub  private sub application_quit()     if timerid <> 0 call deactivatetimer 'turn off timer upon quitting end sub  private sub application_reminder(byval item object)     call eventmacro end sub 

then updated module code...

declare function settimer lib "user32" (byval hwnd long, byval nidevent _ long, byval uelapse long, byval lptimerfunc long) long  declare function killtimer lib "user32" (byval hwnd long, byval nidevent _ long) long  private declare function findwindowa lib "user32" (byval lpclassname _ string, byval lpwindowname string) long  private declare function setwindowpos lib "user32" (byval hwnd long, byval _  hwndinsertafter long, byval x long, byval y long, byval cx long, _ byval cy long, byval wflags long) long  private const swp_nosize = &h1 private const swp_nomove = &h2 private const flags long = swp_nomove or swp_nosize private const hwnd_topmost = -1  public timerid long 'need timer id turn off timer.  ' if timer id <> 0 timer running  public sub activatetimer(byval nseconds long)     nseconds = nseconds * 1000      'the settimer call accepts milliseconds, convert seconds     if timerid <> 0 call deactivatetimer      'check see if timer running before call settimer     timerid = settimer(0, 0, nseconds, addressof triggertimer)     if timerid = 0 msgbox "the timer failed activate." end sub  public sub deactivatetimer()     dim lsuccess long     lsuccess = killtimer(0, timerid)     if lsuccess = 0         msgbox "the timer failed deactivate."     else         timerid = 0     end if end sub  public sub triggertimer(byval hwnd long, byval umsg long, _ byval idevent long, byval systime long)     call eventmacro end sub  public sub eventmacro()     dim reminderwindowhwnd variant     on error resume next     reminderwindowhwnd = findreminderwindow(10)     if reminderwindowhwnd <> 0         setwindowpos reminderwindowhwnd, hwnd_topmost, 0, 0, 0, 0, flags         if timerid <> 0 call deactivatetimer     end if     reminderwindowhwnd = nothing end sub  private function findreminderwindow(iub integer) variant     dim integer: = 1     findreminderwindow = findwindowa(vbnullstring, "1 reminder")     while < iub , findreminderwindow = 0         findreminderwindow = findwindowa(vbnullstring, & " reminder(s)")         = + 1     loop end function 

update 3: having rethought approach , based on observation - redesigned code try , have minimal impact on working while outlook open; find timer still took focus away e-mails writing , possibly other issues windows losing focus might have been related.

instead - assumed reminders window once instantiated merely hidden , not destroyed when reminders shown; such keep global handle window should need once @ window titles , subsequently check if reminders window visible before making modal.

also - timer employed when reminders window triggered, turned off once function has run; stopping intrusive macro's running during working day.

see 1 works guess...

updated code below: add following code 'thisoutlooksession' module

private withevents myreminders outlook.reminders  private sub application_startup()     on error resume next     set myreminders = outlook.application.reminders end sub  private sub myreminders_reminderfire(byval reminderobject reminder)     on error resume next     call activatetimer(1) end sub 

then updated module code...

option explicit  private declare function settimer lib "user32" (byval hwnd long, byval nidevent long, _     byval uelapse long, byval lptimerfunc long) long private declare function killtimer lib "user32" (byval hwnd long, byval nidevent long) long  private declare function iswindowvisible lib "user32" (byval hwnd long) long  private declare function findwindow lib "user32" alias "findwindowa" (byval lpclassname _     string, byval lpwindowname string) long private declare function showwindow lib "user32" (byval hwnd long, byval ncmdshow long) long private declare function setwindowpos lib "user32" (byval hwnd long, byval hwndinsertafter long, _     byval x long, byval y long, byval cx long, byval cy long, byval wflags long) long  private const swp_nosize = &h1 private const swp_nomove = &h2 private const flags long = swp_nomove or swp_nosize private const hwnd_topmost = -1  public timerid long 'need timer id turn off timer. if timer id <> 0 timer running public hremwnd long 'store handle of reminder window  public sub activatetimer(byval seconds long) 'the settimer call accepts milliseconds     on error resume next     if timerid <> 0 call deactivatetimer   'check see if timer running before call settimer     if timerid = 0 timerid = settimer(0, 0, seconds * 1000, addressof triggerevent) end sub  public sub deactivatetimer()     on error resume next     dim success long: success = killtimer(0, timerid)     if success <> 0 timerid = 0 end sub  public sub triggerevent(byval hwnd long, byval umsg long, byval idevent long, byval systime long)     call eventfunction end sub  public function eventfunction()     on error resume next     if timerid <> 0 call deactivatetimer     if hremwnd = 0 hremwnd = findreminderwindow(100)     if iswindowvisible(hremwnd)         showwindow hremwnd, 1                                   ' activate window         setwindowpos hremwnd, hwnd_topmost, 0, 0, 0, 0, flags   ' set modal     end if end function  public function findreminderwindow(iub integer) long     on error resume next     dim integer: = 1     findreminderwindow = findwindow(vbnullstring, "1 reminder")     while < iub , findreminderwindow = 0         findreminderwindow = findwindow(vbnullstring, & " reminder(s)")         = + 1     loop     if findreminderwindow <> 0 showwindow findreminderwindow, 1 end function 

Comments

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -