combobox1.Items.Clear ; //1
combobox1.Items.Assign(printer.Printers); //2
if combobox1.Items.CommaText='' then //3这3句是检查当前是否安装了打印机。
begin //如果没有安装就调用打印机安装向导
ShellExecute (0, 'open', 'rundll','shell32.dll,SHHelpShortcuts_RunDLL AddPrinter', '', SW_SHOWNORMAL);
end else //否则显示当前打印机信息
PrinterSetupDialog1.Execute ;
end;可是 ShellExecute (0, 'open', 'rundll','shell32.dll,SHHelpShortcuts_RunDLL AddPrinter', '', SW_SHOWNORMAL);并不能够使打印机安装向导显示出来啊?
combobox1.Items.Assign(printer.Printers); //2
if combobox1.Items.CommaText='' then //3这3句是检查当前是否安装了打印机。
begin //如果没有安装就调用打印机安装向导
ShellExecute (0, 'open', 'rundll','shell32.dll,SHHelpShortcuts_RunDLL AddPrinter', '', SW_SHOWNORMAL);
end else //否则显示当前打印机信息
PrinterSetupDialog1.Execute ;
end;可是 ShellExecute (0, 'open', 'rundll','shell32.dll,SHHelpShortcuts_RunDLL AddPrinter', '', SW_SHOWNORMAL);并不能够使打印机安装向导显示出来啊?
解决方案 »
- delph中DBLookupComboboxEh数据清空的问题
- 有关实数问题?急!!!!!
- 有关SocketConnection的问题
- QuickReport问题
- 100分寻找vss for D7软件Visual SourceSafeConnection for Delphi7!可下即结贴!
- 怪事。在2000SERVER上删除COM+组件时出现了错误----(无法访问WINDOWS安装服务,请与技术人员联系,确认windows安装服务是否注册正确)。
- 北京的朋友看过来!
- 如何理解buffer,谢谢,50分送上
- 这个自定义函数是什么意思
- 有关VFP数据表Pack命令问题求教。
- 如何生成另外一个exe程序(愿以木马原代码做酬谢)
- memo的打印问题
var
X:LongInt;
begin
X:=winexec('rundll32.exe shell32.dll,SHHelpShortcuts_RunDLL AddPrinter',9);
end;
begin
Printer.Refresh ;
Main_Form.ComboBox1.Items.Clear ;
Main_Form.combobox1.Items.Assign(printer.Printers);
if Main_Form.combobox1.Items.CommaText='' then
begin
MessageDlg('您的计算机没有安装打印机,请安装打印机器!',mtInformation, [mbYes], 0);
ShellExecute(Handle, 'open', 'rundll32.exe','shell32.dll,SHHelpShortcuts_RunDLL AddPrinter', '', SW_SHOWNORMAL);
printer.Refresh ;
end ;
end;多谢,我现在又遇到新问题,假如用户按打印时候,开始是没有装打印机的,我现在通过这个向导安装打印机了,用户如果这个时候不退出程序,在按这个按钮,又提示没有安装打印机,我试图刷新
printer但好象没有用啊?
begin
Main_Form.ComboBox1.Items.Clear ;
Main_Form.combobox1.Items.Assign(printer.Printers);
if Main_Form.combobox1.Items.CommaText='' then
begin
MessageDlg('您的计算机没有安装打印机,请安装打印机器!',mtInformation, [mbYes], 0);
ShellExecute(Handle, 'open', 'rundll32.exe','shell32.dll,SHHelpShortcuts_RunDLL AddPrinter', '', SW_SHOWNORMAL);
end ;
showmessage('aaa');
end;还有就是我想是先判断是否有打印机存在,如果没有就安装,安装完了后继续执行我要的操作比如
showmessage('aaa');
但是我实验了一下,好象这两个是一起弹出来的啊?怎么可以控制只有添加完后才执行后面的任务呢?