J'ai avancé un peu dans la recherche de la cause du problème, mais ça ne m'aide pas trop, je suis toujours bloqué.
Lorsque je test l'accès à un fichier voir ci-dessous(Attachment comprend le chemin de celui ci)
Le programme ne rentre pas dans le if alors que le fichier est accessible, (j'ai fait d'autre test)
if
((_access( Attachment, 4 )) != -1 ) { AfxMessageBox("rentrer dans le if");
try{ CComPtr<IMail> objMail;
HRESULT hr;
// make sure the DLL is registered hr = objMail.CoCreateInstance(CLSID_Mail);
if(SUCCEEDED(hr)) {
if(hr== S_OK) {
// profile name is compulsory, this is the outlook profile, // i used "outlook express" as configuring it is easier than "MS outlook" // make sure to specify the correct email sender's address for this profile // and make sure that outlook express or outlook is the default email client. // by default, it's TestProfile, assumes that a profile with this name exists in outlook hr= objMail->put_strProfileName((_bstr_t)Profile);
AfxMessageBox("profil marche");
hr = objMail->put_strSubject((_bstr_t)Subject);
AfxMessageBox("Subject");
// this is the email or set of email addresses (separated by ;) // which is actually used to send email hr = objMail->put_strEmailAddress((_bstr_t)To);
AfxMessageBox("to email adresse");
// recipient is just to show the display name hr= objMail->put_strRecipient((_bstr_t)To);
AfxMessageBox("profil recipient");
hr = objMail->put_strAttachmentFilePath((_bstr_t)Attachment);
//hr = objMail->put_strMessage((_bstr_t)Message); hr= objMail->Send();
AfxMessageBox("send");
if(hr!=S_OK) AfxMessageBox("Error, make sure the information you are passing is correct");
}
}
}
// try catch(...) {
AfxMessageBox("Erreur, dans le fichier c:\\envoimail\\init.txt");
pasEnvoye +="piece jointe : \"" + Attachment + "\" n'a pas été envoyée à : \"" + To + "\", objet : \"" + Subject + "\"\n";
}
}
//if acces au fichier... else //pièce jointe non accessible en lecture {
AfxMessageBox("fichier a envoyer non accessible");
}
Je rapel que tous ce que je fait marche sous XP (test sur différentes machine XP) et que lorsque je test l'éxécutable sur 98 c la que les problème commence.
Je n'y comprend rien, alors merci de votre aide, A+