joepezt
asked on
Opening printer queus, managing printer queues
hi!
I am looking for a way to open my printer queue from delphi. same as opening the printer from explorer...
also looking for a way to manage printerqueu from my own application... i.e. see the queue.. and delete from a specified printer
I am looking for a way to open my printer queue from delphi. same as opening the printer from explorer...
also looking for a way to manage printerqueu from my own application... i.e. see the queue.. and delete from a specified printer
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
What do you mean ?
"how to also open my printer in explorer"
"how to also open my printer in explorer"
ASKER
in explorer, you can go to printers, there you see all the installed printers.. you double click on it, and can open the queue from there also..
I just want to open this programmically
I just want to open this programmically
Hi, call this function with the name on the printer...
And please give some more points. As you can see from other threads, a question like this gets at least 500 points....
Uses ShlObj, ActiveX, ShellAPI;
function TForm1.OpenThisPrinter(Pri nterName: String): Boolean;
var
Allocator: IMalloc;
PrinterItemIDList: pItemIDList;
ShellExecuteInfo : TShellExecuteInfo;
begin
Result := False;
if CoGetMalloc(MEMCTX_TASK, Allocator) = S_OK then
begin
PrinterItemIDList := GetThisPrinter(PrinterName , Allocator);
try
if PrinterItemIDList = nil then
Result := False
else
begin
ZeroMemory(@ShellExecuteIn fo, SizeOf(TShellExecuteInfo)) ;
with ShellExecuteInfo do
begin
cbSize := SizeOf(TShellExecuteInfo);
fMask := SEE_MASK_INVOKEIDLIST OR SEE_MASK_FLAG_NO_UI;
lpIDList := PrinterItemIDlist;
nShow := SW_SHOWDEFAULT;
end;
ShellExecuteEx(@ShellExecu teInfo);
Result := True;
end;
finally
Allocator.Free(PrinterItem IDList)
end;
end;
end;
And please give some more points. As you can see from other threads, a question like this gets at least 500 points....
Uses ShlObj, ActiveX, ShellAPI;
function TForm1.OpenThisPrinter(Pri
var
Allocator: IMalloc;
PrinterItemIDList: pItemIDList;
ShellExecuteInfo : TShellExecuteInfo;
begin
Result := False;
if CoGetMalloc(MEMCTX_TASK, Allocator) = S_OK then
begin
PrinterItemIDList := GetThisPrinter(PrinterName
try
if PrinterItemIDList = nil then
Result := False
else
begin
ZeroMemory(@ShellExecuteIn
with ShellExecuteInfo do
begin
cbSize := SizeOf(TShellExecuteInfo);
fMask := SEE_MASK_INVOKEIDLIST OR SEE_MASK_FLAG_NO_UI;
lpIDList := PrinterItemIDlist;
nShow := SW_SHOWDEFAULT;
end;
ShellExecuteEx(@ShellExecu
Result := True;
end;
finally
Allocator.Free(PrinterItem
end;
end;
end;
ASKER