PDA

View Full Version : passing parameters to Active-x in hash does not work



yazwas
26th February 2010, 11:53
Hello Everyone

I'm writing a simple Active-x program, and I have this problem
if I hard code the values like this the program works



QAxWidget * activeX;
activeX = new QAxWidget(this);
activeX->setControl("{DE625294-70E6-45ED-B895-CFFA13AEB044}" );

activeX->setProperty("AutoStart", "1");
activeX->setProperty("NetworkTimeout", "25000");
activeX->setProperty("EnableReconnect", "true");
activeX->setProperty("EnableContextMenu", "true");
activeX->setProperty("ToolbarConfiguration", "default,-mute,-volume");
activeX->setProperty("MediaType", "auto-sense");
activeX->setProperty("MediaURL", "http://www.dyndns.org:8101/mjpg/1/video.mjpg?camera=1&resolution=320x240&compression=30&des_fps=30");
activeX->setProperty("UIMode", "none");
activeX->setProperty("ToolbarConfiguration", "default,-mute,-volume");
activeX->setProperty("StretchToFit", "1");


The above code works fine, but if I do it like this, it wont



QHash<QString, QString> hash;

hash.insert("AutoStart", "1");
hash.insert("NetworkTimeout", "25000");
hash.insert("DisplayMessages", "true");
hash.insert("EnableReconnect", "true");
hash.insert("EnableContextMenu", "true");
hash.insert("ToolbarConfiguration", "default,-mute,-volume");
hash.insert("MediaType", "auto-sense");
hash.insert("MediaURL", "http://www.dyndns.org:8101/mjpg/1/video.mjpg?camera=1&resolution=320x240&compression=30&des_fps=30");
hash.insert("UIMode", "none");
hash.insert("ToolbarConfiguration", "default,-mute,-volume");
hash.insert("StretchToFit", "1");

QHash<QString, QString>::const_iterator i = hash.constBegin();

QAxWidget * activeX;
activeX = new QAxWidget(this);
activeX->setControl("{DE625294-70E6-45ED-B895-CFFA13AEB044}" );

while ( i != hash.constEnd() )
{
QString str = i.key();
const char* cstr = str.toStdString().c_str();
QString value = i.value();

activeX->setProperty(cstr, value );
++i;
}


I need the 2nd way because I will be inserting different parameters at different times

please let me know what you think what could the problem be?