Yes, this is exactly what I've done 
The problem is that I need to pass arguments to my application (title of the mail, for example, and destinary). I've seen that the Windows Registry can pass mailto arguments, and I'm trying to deal with...
In reality I've another strange problem : in order to test the arguments and to see if they are passed to my application, in write them in a file.
Here is my main :
#include <QApplication>
#include <QtGui>
#include <iostream>
#include <QString>
#include <fstream>
#include <iostream>
using namespace std;
#include "Mailto_Handler.h"
int main(int argc, char *argv[])
{
//Mailto_Handler * mon_gestionnaire = new Mailto_Handler();
ofstream mon_fichier ("parametres.txt");
if (mon_fichier.is_open())
{
mon_fichier << "Argument 1 : \t" << argument_1.toStdString() << endl;
mon_fichier << "Argument 2 : \t" << argument_2.toStdString() << endl;
mon_fichier << "Argument 3 : \t" << argument_3.toStdString() << endl;
mon_fichier << "Argument 4 : \t" << argument_4.toStdString() << endl;
mon_fichier << "Argument 5 : \t" << argument_5.toStdString() << endl;
mon_fichier.close();
}
//exit(0);
return app.exec();
}
#include <QApplication>
#include <QtGui>
#include <iostream>
#include <QString>
#include <fstream>
#include <iostream>
using namespace std;
#include "Mailto_Handler.h"
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
//Mailto_Handler * mon_gestionnaire = new Mailto_Handler();
QString argument_1 = argv[1];
QString argument_2 = argv[2];
QString argument_3 = argv[3];
QString argument_4 = argv[4];
QString argument_5 = argv[5];
ofstream mon_fichier ("parametres.txt");
if (mon_fichier.is_open())
{
mon_fichier << "Argument 1 : \t" << argument_1.toStdString() << endl;
mon_fichier << "Argument 2 : \t" << argument_2.toStdString() << endl;
mon_fichier << "Argument 3 : \t" << argument_3.toStdString() << endl;
mon_fichier << "Argument 4 : \t" << argument_4.toStdString() << endl;
mon_fichier << "Argument 5 : \t" << argument_5.toStdString() << endl;
mon_fichier.close();
}
//exit(0);
return app.exec();
}
To copy to clipboard, switch view to plain text mode
This works well if I call my application :
- by double-clicking it
- by calling it from a Batch file
- by calling it from MSYS command line
But if I call it from the registry, when I use a mailto link, I've a problem : the file is not written. The application is launched, that is sure : I see it in the task monitor. But the file is n't written...
Have you got an idea ?
Bookmarks