Alaska Software Inc. - Printer Selection
Username: Password:
AuthorTopic: Printer Selection
Carlos A Beling Printer Selection
on Fri, 06 Nov 2015 13:00:53 -0200
Hello:
good afternoon.
I finally could solve the problems with the folder browsing without to 
use BAP and others.
In the function browsing folders is working fine
But it has problem when to select the name of a printer or a computer.

The configuration flags below indicates its behavior:

BIF_BROWSEFORCOMPUTER  0x1000   Browsing for Computers.
                                 Only return computers. If the user 
selects anything
                                 other than a computer, the OK button 
is grayed.

BIF_BROWSEFORPRINTER   0x2000   Browsing for Printers
                                 Only allow the selection of printers. 
If the user selects
                                 anything other than a printer, the OK 
button is grayed.
                                 In Windows XP and later systems, the 
best practice is
                                 to use a Windows XP-style dialog, 
setting the root of the
                                 dialog to the Printers and Faxes 
folder (CSIDL_PRINTERS).

I search in the Internet if it has an information about this and I did 
not find anything.

I attached a screen with the selection made.
After the indication of the printer's name the function crashes. This 
can be debugged set breaking points in lines 64 and 230.

Can anybody help me to solve this issue?

Fraternally
Beling

PS: if one think that this selection function is useful can use it 
without any my warranties.


SelectionMade.png
Test.zip
Andreas Gehrs-Pahl
Re: Printer Selection
on Fri, 06 Nov 2015 21:25:21 -0500
Carlos,

>After the indication of the printer's name the function crashes. This 
>can be debugged set breaking points in lines 64 and 230.

I would suggest you simply use the XbpPrintDialog() class for selecting 
Printers, as it would be more consistent SWB (Standard Windows Behavior). 

Anyway, as the error occurs within the Active-X object itself, this probably 
doesn't seem to be an Xbase++ issue, but more likely a problem with how the 
BrowseForFolder() function is called or how it was implemented in Active-X.

The Active-X error message that you get, does state: "Not implemented", 
which you would be able to see in your code, if you changed line 246 to:

   if .not. empty(e:description)

Have you ever seen an application that (successfully) implemented a Printer 
Selection through this Folder Browser Dialog? It probably isn't possible 
with Active-X at all, and you have to use the API function instead.

Andreas

Andreas Gehrs-Pahl
Absolute Software, LLC

phone: (989) 723-9927
email: Andreas.GP@Charter.net
web:   http://www.Aerospace-History.net
Carlos A Beling Re: Printer Selection
on Sat, 07 Nov 2015 12:39:55 -0200
Hello Andreas:
good afternoon.
Many thanks again.
The call to the method that I used is the same one as in 
XbpFolderDialog.prg (xbpPack3.zip) that does not implement the 
configuration neither for printer nor for computers. I think that it is 
not possible using
oShell := CreateObject("Shell.Application")
oFolder := oShell:BrowseForFolder(nHWND, cCaption, nFlags, xRootDir)
as XbpFileDialog() does.

Really using XbpPrinterDialog() will to be best.

Fraternally
Beling


On 7/11/2015 00:25, Andreas Gehrs-Pahl wrote:
> Carlos,
>
>> After the indication of the printer's name the function crashes. This
>> can be debugged set breaking points in lines 64 and 230.
>
> I would suggest you simply use the XbpPrintDialog() class for selecting
> Printers, as it would be more consistent SWB (Standard Windows Behavior).
>
> Anyway, as the error occurs within the Active-X object itself, this probably
> doesn't seem to be an Xbase++ issue, but more likely a problem with how the
> BrowseForFolder() function is called or how it was implemented in Active-X.
>
> The Active-X error message that you get, does state: "Not implemented",
> which you would be able to see in your code, if you changed line 246 to:
>
>     if .not. empty(e:description)
>
> Have you ever seen an application that (successfully) implemented a Printer
> Selection through this Folder Browser Dialog? It probably isn't possible
> with Active-X at all, and you have to use the API function instead.
>
> Andreas
>