Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Autosend email without annoying outlook message
Message
From
12/01/2003 11:32:59
 
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
00740746
Message ID:
00740791
Views:
20
>I am trying to setup a program to autosend email based upon event messages on my server. However, any automation to Outlook/MAPI I've tried kicks up the annoying message stating a potentially hostile program is trying to send a message and wants me to press "yes" - a far cry from automatic!
>
>Does anyone have a simple workaround to this that doesn't involve an expensive add-on control?
>
>Thanks in advance.

Steve,

In addition to the other solutions. This can always be used whether you get the popup window or not
local obj
obj = createobject('SendKeysIfForegroundwindowChanges', chr(0x0d) )
this.OleMessage.Send( FALSE )
release obj
#ifnDef TRUE
	#define	TRUE	.T.
	#define	FALSE	.F.
#endif

Define Class SendKeysIfForegroundwindowChanges as Timer
	Interval = 100
	Enabled = TRUE
	ForegroundWindow_Old = 0
	KeyStrokes = ''
	AllDownFirst = FALSE
*-------------------------------------------------------------------------------
hidden function Init(KeyStrokes, AllDownFirst )
	declare integer GetForegroundWindow in Win32API
	
	this.ForegroundWindow_Old = GetForegroundWindow()
	
	declare keybd_event in win32api integer, integer, integer, integer
	
	this.KeyStrokes = KeyStrokes
	this.AllDownFirst = AllDownFirst
endfunc
*-------------------------------------------------------------------------------
hidden function timer
	
	this.Enabled = FALSE
	
	do case
	case this.ForegroundWindow_Old <> GetForegroundWindow()
		local i, c
		do case
		case !this.AllDownFirst
			for i = 1 to len(this.KeyStrokes)
				c = asc(substr(this.KeyStrokes, i, 1))
				=keybd_event(c, 0, 0, 0)	&& key down
				=keybd_event(c, 0, 2, 0)	&& key up
			endfor
		otherwise
			for i = 1 to len(this.KeyStrokes)
				c = asc(substr(this.KeyStrokes, i, 1))
				=keybd_event(c, 0, 0, 0)	&& key down
			endfor
			for i = 1 to len(this.KeyStrokes)
				c = asc(substr(this.KeyStrokes, i, 1))
				=keybd_event(c, 0, 2, 0)	&& key up
			endfor
		endcase
	otherwise
		this.Enabled = TRUE
	endcase
endfunc
*-------------------------------------------------------------------------------
enddefine
Gregory
Previous
Reply
Map
View

Click here to load this message in the networking platform