Page 1 of 1

C++ SaveDialog still visible

Posted: Fri Apr 08, 2011 9:47 am
by DATAMED
Hi,

we want to automatically convert word-docs into pdf-files. It works, but the SaveAs-dialog is still visible, so the user must click the -Save-Button. What can we do?

Envrionment: Windows XP SP3 german, C++Builder5 Enterprise

Here's the code:


Variant obj = Variant::CreateObject("Bullzip.PDFPrinterSettings");
AnsiString printername = obj.OleFunction("GetPrinterName");

AnsiString output = "C:\\test_23523.pdf";

obj.OleFunction("Init");
obj.OleFunction("SetValue", "printerName", printername);
obj.OleFunction("SetValue", "Output", output );
obj.OleFunction("SetValue", "ShowSaveAS", "never"); //never
obj.OleFunction("SetValue", "ShowSettings", "never" ); //never
obj.OleFunction("SetValue", "ConfirmOverwrite", "no" );
obj.OleFunction("SetValue", "ShowPDF", "no" );
obj.OleFunction("SetValue", "WatermarkText", "Hallo" );
obj.OleFunction("SetValue", "ShowProgress", "no" );
obj.OleFunction("SetValue", "ShowProgressFinished", "no" );
obj.OleFunction("SetValue", "SuppressErrors", "yes" );
obj.OleFunction("SetValue", "ConfirmOverwrite", "no" );
obj.OleFunction("WriteSettings", "true");

AnsiString currentdir = ExtractFilePath(Application->ExeName);
AnsiString printfile = currentdir + "test2.doc";

AnsiString cmd = "\"" + printfile + "\"";// + " " + printername;

int Result = (int)ShellExecute( Handle,
"open",
AnsiString(currentdir + "printto.exe").c_str(),
cmd.c_str(),
currentdir.c_str(),
SW_SHOWNORMAL );

if(Result>32) Edit1->Text = "ok";
else Edit1->Text = "bad";

obj = Unassigned;

best regards,
DATAMED