2013年1月10日 星期四

Windows -- how to send mail in the application

There is a good document to help us about this -- http://zabkat.com/blog/send-emails-with-CDOSYS.htm.  You can get first view about this.  And there is some sample code in the
http://www.experts-exchange.com/Programming/System/Windows__Programming/A_1820-Sending-Email-with-MAPI.html.

The easiest way is mailto..You can check http://msdn.microsoft.com/en-us/library/aa767737(VS.85).aspx.

The common way is Microsoft MAPI..http://msdn.microsoft.com/en-us/library/windows/desktop/dd296734(v=vs.85).aspx

Anyway..From the MS document..It say..[The use of Simple MAPI is discouraged. It may be altered or unavailable in subsequent versions of Windows.]

Anyway, the MAPI still work in the Win 7/Win 8.  But sometime, it will return MAPI_E_FAILURE.  Then you can check your application UAC setting.  You can check here (http://social.msdn.microsoft.com/Forums/en-US/outlookdev/thread/63e9f5b2-f5f2-4cf8-bdc2-ca1fad88ebe5).

2013年1月7日 星期一

PHP run executable file in the xampp of Windows

There is the document talk about this -- http://php.net/manual/en/function.exec.php
<?php function execInBackground($cmd) {
    if (
substr(php_uname(), 07) == "Windows"){
        
pclose(popen("start /B "$cmd"r")); 
    }
    else {
        
exec($cmd " > /dev/null &");  
    }
?> 

And there is also another document talk about this -- http://www.somacon.com/p395.php.  In this document , it provide many methods to do this.  And after my try,   pclose(popen("start /B ". " c:\\new\\New2.bat", "r")); is workable.


For more information, you can check http://php.net/manual/en/function.popen.php.