Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to avoid the security patch check of Outlook XP

COM and Automation

How to avoid the security patch check of Outlook XP

by  Mike Gagnon  Posted    (Edited  )
[ol][li]With the suggestions in FAQ184-1768, you will not see the security path from Outlook XP (2002) [/li]

[li]There is a fix written by Dmitry Streblechenko (an Outlook MVP) that can be found at this link:

http://www.dimastr.com/redemption/[/li]

[li] A third open was written by Yuri Rubinov:
Code:
*--------------------------
* YFORCEOL.EXE
*ForceOl to Work
*Yuri Rubinov, 2002

LPARAMETER pcFlFlagNAme

IF VERSION(2)=0
   _SCREEN.LEFT=-5000
ENDIF

LOCAL plFlagFileEndMode
* File Flag removed or TimeOut
plFlagFileEndMode = (TYPE("pcFlFlagNAme")="C")
pnTimeOut=120000 && 2 min

IF plFlagFileEndMode
   ERASE (pcFlFlagNAme)
   =STRTOFILE(" ",pcFlFlagNAme)
ENDIF

PRIVATE oShell, LtimerOL, Starttime

Starttime=SECONDS()

oShell = CREATEOBJECT("WScript.Shell")
LtimerOL=CREATEOBJECT("ForceOL",pnTimeOut,pcFlFlagNAme)

READ EVENTS

LtimerOL=.NULL.
oShell=.NULL.

RETURN
*----------------------------------------
DEFINE CLASS ForceOL AS TIMER
   INTERVAL = 1000
   NAME = "ForceOL"
   timeoutdef = 60000
   FlagName=""
   PROCEDURE INIT
      LPARAMETER pnTimeOut, pcFlFlagNAme
      IF TYPE("pnTimeOut")="N"
         THIS.timeoutdef=pnTimeOut
      ENDIF
      IF TYPE("pcFlFlagNAme")="C"
         THIS.FlagName=pcFlFlagNAme
      ENDIF
   ENDPROC
   PROCEDURE TIMER
      IF oShell.AppActivate("Microsoft Outlook")
         oShell.SendKeys("Y")
      ENDIF
      DO CASE
         CASE SECONDS()-Starttime>=THIS.timeoutdef/1000 CLEAR EVENTS
         CASE NOT EMPTY(THIS.FlagName) AND NOT FILE(THIS.FlagName)
            CLEAR EVENTS
      ENDCASE
   ENDPROC
ENDDEFINE
*--------------------------

*You should RUN THIS PROGRAM AS EXE BEFORE calling email *PROCEDURE IN your PROGRAM.
DECLARE INTEGER ShellExecute ;
   IN SHELL32.DLL ;
   INTEGER nWinHandle,;
   STRING cOperation,;
   STRING cFileName,;
   STRING cParameters,;
   STRING cDirectory,;
   INTEGER nShowWindow

lcflag=SYS(5)+CURDIR()+"flag.fff"
= ShellExecute(0,"open",FULLPATH("yforceol.exe"),lcflag,"",0)
* send email here
[/li]

[li] Here is another way, in the style of the "Click Yes" VB application, which makes use of a COM server, API calls, Window scripting (Requires Windows scriptin 5.6 to be installed )and Automation.
a) Create a empty project (call it security) and in the project create a timer class (Timer2)and set it to OLE Public, making sure that the library is set to main. Create the following methods (Pseudo-Code):
Code:
DEFINE CLASS timer2 AS timer OLEPUBLIC
	Height = 23
	Width = 23
	Interval = 10000
	Name = "timer2"
	PROCEDURE pushbuttons
		PARAMETERS lnHWND
		    LOCAL nForeThread, nAppThread
		    nForeThread = GetWindowThreadProcessId(GetForegroundWindow(), 0)
		    nAppThread = GetCurrentThreadId()
		    IF nForeThread != nAppThread
		        AttachThreadInput(nForeThread, nAppThread, .T.)
		        BringWindowToTop(lnHWND)
		        ShowWindow(lnHWND,0)
		        AttachThreadInput(nForeThread, nAppThread, .F.)
		    ELSE
		        BringWindowToTop(lnHWND)
		        ShowWindow(lnHWND,0)
		    ENDIF
		 WshShell = CreateObject("WScript.Shell")
		  WshShell.SendKeys("{TAB}")  
		  Sleep(1000)
		  WshShell.SendKeys("{TAB}") 
		  Sleep(1000)
		  WshShell.SendKeys("{Enter}")
		  Sleep(1000)
	ENDPROC
	PROCEDURE Timer
		nHWND = FindWindow(Null,"Microsoft Outlook")
		If nHWND >0
		    =THIS.PUSHBUTTONS(nHWND)
		ENDIF
	ENDPROC
	PROCEDURE Init
		DECLARE Sleep IN Win32API INTEGER nMilliseconds
		Declare Long FindWindow In Win32API String, String
		Declare Long BringWindowToTop In Win32API Long

		Declare Long ShowWindow In Win32API Long, Long

		Declare Integer GetCurrentThreadId;
			IN kernel32

		Declare Integer GetWindowThreadProcessId In user32;
			INTEGER   HWnd,;
			INTEGER @ lpdwProcId

		Declare Integer GetCurrentThreadId;
			IN kernel32

		Declare Integer AttachThreadInput In user32 ;
			INTEGER idAttach, ;
			INTEGER idAttachTo, ;
			INTEGER fAttach

		Declare Integer GetForegroundWindow In user32
	ENDPROC


ENDDEFINE

b)Once you timer is done compile the project as COM Server. And in a separate program use the following (Which will send any e-mails sitting in your Outlook outbox.:
Code:
oTimer = CREATEOBJECT("security.timer2") && Call the COM server
oOutlook = Createobject("Outlook.application")
ns = oOutlook.getnamespace("mapi")
df = ns.getdefaultfolder(olFolderOutbox)
nCount = df.items.Count
For i = nCount To 1 Step -1
    df.items(i).send()
Endfor
[/li][/ol]


Mike Gagnon




Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top