View Single Post
Old 04-25-2012, 01:07 AM   #4
PeterT
Grand Sorcerer
PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.
 
Posts: 13,568
Karma: 79436716
Join Date: Nov 2007
Location: Toronto
Device: Libra H2O, Libra Colour
For what it's worth.... this worked for me. Sorry I am NOT a c++ programmer; just found some examples on the web and modified them.

Spoiler:

Code:
	STARTUPINFO si;
    PROCESS_INFORMATION pi;

	WCHAR pCalibre[] = L"\"C:\\Program Files (x86)\\Calibre2\\calibre-smtp.exe\" -e SSL -r smtp.qq.com -u myuserid -p mypassword --port 465 -v -s \"Email_title\" xx@qq.com yy@foxmail.com \"mailBody\"";

    ZeroMemory( &si, sizeof(si) );
    si.cb = sizeof(si);
    ZeroMemory( &pi, sizeof(pi) );

//    if( argc != 2 )
//    {
//        printf("Usage: %s [cmdline]\n", argv[0]);
//        return -1;
//    }

    // Start the child process. 
    if( !CreateProcess( NULL,   // No module name (use command line)
        pCalibre,       // Command line
        NULL,           // Process handle not inheritable
        NULL,           // Thread handle not inheritable
        FALSE,          // Set handle inheritance to FALSE
        0,              // No creation flags
        NULL,           // Use parent's environment block
        NULL,           // Use parent's starting directory 
        &si,            // Pointer to STARTUPINFO structure
        &pi )           // Pointer to PROCESS_INFORMATION structure
    ) 
    {
        printf( "CreateProcess failed (%d).\n", GetLastError() );
        return -1;
    }

    // Wait until child process exits.
    WaitForSingleObject( pi.hProcess, INFINITE );

    // Close process and thread handles. 
    CloseHandle( pi.hProcess );
    CloseHandle( pi.hThread );
	
	return 0;
PeterT is offline   Reply With Quote