Browsing for Printers using SHBrowseForFolder Shell Function 
Author Message
 Browsing for Printers using SHBrowseForFolder Shell Function

I am not a low level windows programmer, i am but a poor simple VB/VBA
developer wanting to programmatically browse for a printer using VBA in
Access.
I use the SHBrowseForFolder function successfully to browse for folders with
the declaration
Const BIF_RETURNONLYFSDIRS = 1
in the Access module for use in the shellBrowseInfo structure object.

When I try to use the declaration
Const BIF_BROWSEFORPRINTER = ?? what should it be set to????
I have tried various values without success in viewing for printers.

Can some ingenious Shell programmer out there give me a little hint? or if
there is a REAL programmer who can tell me a better way to do browse for
printers from VBA (in Access)????

phew.....
Jeff



Wed, 01 Sep 2004 09:46:12 GMT  
 Browsing for Printers using SHBrowseForFolder Shell Function
Dont bother people....i have the answer from another NG!


Quote:
> I am not a low level windows programmer, i am but a poor simple VB/VBA
> developer wanting to programmatically browse for a printer using VBA in
> Access.
> I use the SHBrowseForFolder function successfully to browse for folders
with
> the declaration
> Const BIF_RETURNONLYFSDIRS = 1
> in the Access module for use in the shellBrowseInfo structure object.

> When I try to use the declaration
> Const BIF_BROWSEFORPRINTER = ?? what should it be set to????
> I have tried various values without success in viewing for printers.

> Can some ingenious Shell programmer out there give me a little hint? or if
> there is a REAL programmer who can tell me a better way to do browse for
> printers from VBA (in Access)????

> phew.....
> Jeff



Thu, 02 Sep 2004 20:59:00 GMT  
 Browsing for Printers using SHBrowseForFolder Shell Function
Why don't you post the answer in this thread? In this way, future Access
developers searching the NG's will find the answer easily.

Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


Quote:
> Dont bother people....i have the answer from another NG!



> > I am not a low level windows programmer, i am but a poor simple
VB/VBA
> > developer wanting to programmatically browse for a printer using VBA
in
> > Access.
> > I use the SHBrowseForFolder function successfully to browse for
folders
> with
> > the declaration
> > Const BIF_RETURNONLYFSDIRS = 1
> > in the Access module for use in the shellBrowseInfo structure
object.

> > When I try to use the declaration
> > Const BIF_BROWSEFORPRINTER = ?? what should it be set to????
> > I have tried various values without success in viewing for printers.

> > Can some ingenious Shell programmer out there give me a little hint?
or if
> > there is a REAL programmer who can tell me a better way to do browse
for
> > printers from VBA (in Access)????

> > phew.....
> > Jeff



Thu, 02 Sep 2004 21:49:22 GMT  
 Browsing for Printers using SHBrowseForFolder Shell Function
Stephen,
I didnt post it here because the answer was given in another forum and I
havent received any posts in ANY of the Access or Office related forums so I
assumed (incorrectly!) that people here would be interested. Below is the
message I received elsewhere:

Quote:
>Why don't you use Google or look in shlobj.h ?!
>First link given by Google :
>http://c85.cemi.rssi.ru/Access/TipDetail.idc?TipID=39

I have now developed a set of routines for calling the windows browser
(file, database, etc , folders, printers and so on...) if anyone is
interested I can post the complete source code...

Regards
Jeff


Quote:
> Why don't you post the answer in this thread? In this way, future Access
> developers searching the NG's will find the answer easily.

> Stephen Lebans
> http://www.lebans.com
> Access Code, Tips and Tricks
> Please respond only to the newsgroups so everyone can benefit.



> > Dont bother people....i have the answer from another NG!



> > > I am not a low level windows programmer, i am but a poor simple
> VB/VBA
> > > developer wanting to programmatically browse for a printer using VBA
> in
> > > Access.
> > > I use the SHBrowseForFolder function successfully to browse for
> folders
> > with
> > > the declaration
> > > Const BIF_RETURNONLYFSDIRS = 1
> > > in the Access module for use in the shellBrowseInfo structure
> object.

> > > When I try to use the declaration
> > > Const BIF_BROWSEFORPRINTER = ?? what should it be set to????
> > > I have tried various values without success in viewing for printers.

> > > Can some ingenious Shell programmer out there give me a little hint?
> or if
> > > there is a REAL programmer who can tell me a better way to do browse
> for
> > > printers from VBA (in Access)????

> > > phew.....
> > > Jeff



Sat, 04 Sep 2004 13:20:51 GMT  
 Browsing for Printers using SHBrowseForFolder Shell Function
Jeff why don't you create a simple sample MDB demonstrating the
functions. I'd be glad to post it on my Web site. That way any future
inquiries on this subject can be directed there.
:-)
--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


Quote:
> Stephen,
> I didnt post it here because the answer was given in another forum and
I
> havent received any posts in ANY of the Access or Office related
forums so I
> assumed (incorrectly!) that people here would be interested. Below is
the
> message I received elsewhere:

> >Why don't you use Google or look in shlobj.h ?!
> >First link given by Google :
> >http://c85.cemi.rssi.ru/Access/TipDetail.idc?TipID=39

> I have now developed a set of routines for calling the windows browser
> (file, database, etc , folders, printers and so on...) if anyone is
> interested I can post the complete source code...

> Regards
> Jeff



> > Why don't you post the answer in this thread? In this way, future
Access
> > developers searching the NG's will find the answer easily.

> > Stephen Lebans
> > http://www.lebans.com
> > Access Code, Tips and Tricks
> > Please respond only to the newsgroups so everyone can benefit.



> > > Dont bother people....i have the answer from another NG!



> > > > I am not a low level windows programmer, i am but a poor simple
> > VB/VBA
> > > > developer wanting to programmatically browse for a printer using
VBA
> > in
> > > > Access.
> > > > I use the SHBrowseForFolder function successfully to browse for
> > folders
> > > with
> > > > the declaration
> > > > Const BIF_RETURNONLYFSDIRS = 1
> > > > in the Access module for use in the shellBrowseInfo structure
> > object.

> > > > When I try to use the declaration
> > > > Const BIF_BROWSEFORPRINTER = ?? what should it be set to????
> > > > I have tried various values without success in viewing for
printers.

> > > > Can some ingenious Shell programmer out there give me a little
hint?
> > or if
> > > > there is a REAL programmer who can tell me a better way to do
browse
> > for
> > > > printers from VBA (in Access)????

> > > > phew.....
> > > > Jeff



Sat, 04 Sep 2004 14:27:09 GMT  
 Browsing for Printers using SHBrowseForFolder Shell Function
Ken Getz and I wrote up stuff for this over four years ago. :-)

(cf http://www.devx.com/premier/mgznarch/vbpj/1997/12dec97/GK1297.pdf)

--
MichKa

Michael Kaplan
Trigeminal Software, Inc.  -- http://www.trigeminal.com/

International VB? -- http://www.i18nWithVB.com/
C++? MSLU -- http://msdn.microsoft.com/msdnmag/issues/01/10/


Quote:
> Jeff why don't you create a simple sample MDB demonstrating the
> functions. I'd be glad to post it on my Web site. That way any future
> inquiries on this subject can be directed there.
> :-)
> --

> HTH
> Stephen Lebans
> http://www.lebans.com
> Access Code, Tips and Tricks
> Please respond only to the newsgroups so everyone can benefit.



> > Stephen,
> > I didnt post it here because the answer was given in another forum and
> I
> > havent received any posts in ANY of the Access or Office related
> forums so I
> > assumed (incorrectly!) that people here would be interested. Below is
> the
> > message I received elsewhere:

> > >Why don't you use Google or look in shlobj.h ?!
> > >First link given by Google :
> > >http://c85.cemi.rssi.ru/Access/TipDetail.idc?TipID=39

> > I have now developed a set of routines for calling the windows browser
> > (file, database, etc , folders, printers and so on...) if anyone is
> > interested I can post the complete source code...

> > Regards
> > Jeff



> > > Why don't you post the answer in this thread? In this way, future
> Access
> > > developers searching the NG's will find the answer easily.

> > > Stephen Lebans
> > > http://www.lebans.com
> > > Access Code, Tips and Tricks
> > > Please respond only to the newsgroups so everyone can benefit.



> > > > Dont bother people....i have the answer from another NG!



> > > > > I am not a low level windows programmer, i am but a poor simple
> > > VB/VBA
> > > > > developer wanting to programmatically browse for a printer using
> VBA
> > > in
> > > > > Access.
> > > > > I use the SHBrowseForFolder function successfully to browse for
> > > folders
> > > > with
> > > > > the declaration
> > > > > Const BIF_RETURNONLYFSDIRS = 1
> > > > > in the Access module for use in the shellBrowseInfo structure
> > > object.

> > > > > When I try to use the declaration
> > > > > Const BIF_BROWSEFORPRINTER = ?? what should it be set to????
> > > > > I have tried various values without success in viewing for
> printers.

> > > > > Can some ingenious Shell programmer out there give me a little
> hint?
> > > or if
> > > > > there is a REAL programmer who can tell me a better way to do
> browse
> > > for
> > > > > printers from VBA (in Access)????

> > > > > phew.....
> > > > > Jeff



Sat, 04 Sep 2004 15:07:33 GMT  
 Browsing for Printers using SHBrowseForFolder Shell Function
Thanks Michael, great article!
:-)

Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.



Quote:
> Ken Getz and I wrote up stuff for this over four years ago. :-)

> (cf http://www.devx.com/premier/mgznarch/vbpj/1997/12dec97/GK1297.pdf)

> --
> MichKa

> Michael Kaplan
> Trigeminal Software, Inc.  -- http://www.trigeminal.com/

> International VB? -- http://www.i18nWithVB.com/
> C++? MSLU -- http://msdn.microsoft.com/msdnmag/issues/01/10/



> > Jeff why don't you create a simple sample MDB demonstrating the
> > functions. I'd be glad to post it on my Web site. That way any
future
> > inquiries on this subject can be directed there.
> > :-)
> > --

> > HTH
> > Stephen Lebans
> > http://www.lebans.com
> > Access Code, Tips and Tricks
> > Please respond only to the newsgroups so everyone can benefit.



> > > Stephen,
> > > I didnt post it here because the answer was given in another forum
and
> > I
> > > havent received any posts in ANY of the Access or Office related
> > forums so I
> > > assumed (incorrectly!) that people here would be interested. Below
is
> > the
> > > message I received elsewhere:

> > > >Why don't you use Google or look in shlobj.h ?!
> > > >First link given by Google :
> > > >http://c85.cemi.rssi.ru/Access/TipDetail.idc?TipID=39

> > > I have now developed a set of routines for calling the windows
browser
> > > (file, database, etc , folders, printers and so on...) if anyone
is
> > > interested I can post the complete source code...

> > > Regards
> > > Jeff



> > > > Why don't you post the answer in this thread? In this way,
future
> > Access
> > > > developers searching the NG's will find the answer easily.

> > > > Stephen Lebans
> > > > http://www.lebans.com
> > > > Access Code, Tips and Tricks
> > > > Please respond only to the newsgroups so everyone can benefit.



> > > > > Dont bother people....i have the answer from another NG!



> > > > > > I am not a low level windows programmer, i am but a poor
simple
> > > > VB/VBA
> > > > > > developer wanting to programmatically browse for a printer
using
> > VBA
> > > > in
> > > > > > Access.
> > > > > > I use the SHBrowseForFolder function successfully to browse
for
> > > > folders
> > > > > with
> > > > > > the declaration
> > > > > > Const BIF_RETURNONLYFSDIRS = 1
> > > > > > in the Access module for use in the shellBrowseInfo
structure
> > > > object.

> > > > > > When I try to use the declaration
> > > > > > Const BIF_BROWSEFORPRINTER = ?? what should it be set to????
> > > > > > I have tried various values without success in viewing for
> > printers.

> > > > > > Can some ingenious Shell programmer out there give me a
little
> > hint?
> > > > or if
> > > > > > there is a REAL programmer who can tell me a better way to
do
> > browse
> > > > for
> > > > > > printers from VBA (in Access)????

> > > > > > phew.....
> > > > > > Jeff



Sat, 04 Sep 2004 21:04:17 GMT  
 Browsing for Printers using SHBrowseForFolder Shell Function
err....yeah....GREAT MATE...my only question is what took you so
long...lol..:) Excellent...
jeff



Quote:
> Ken Getz and I wrote up stuff for this over four years ago. :-)

> (cf http://www.devx.com/premier/mgznarch/vbpj/1997/12dec97/GK1297.pdf)

> --
> MichKa

> Michael Kaplan
> Trigeminal Software, Inc.  -- http://www.trigeminal.com/

> International VB? -- http://www.i18nWithVB.com/
> C++? MSLU -- http://msdn.microsoft.com/msdnmag/issues/01/10/



> > Jeff why don't you create a simple sample MDB demonstrating the
> > functions. I'd be glad to post it on my Web site. That way any future
> > inquiries on this subject can be directed there.
> > :-)
> > --

> > HTH
> > Stephen Lebans
> > http://www.lebans.com
> > Access Code, Tips and Tricks
> > Please respond only to the newsgroups so everyone can benefit.



> > > Stephen,
> > > I didnt post it here because the answer was given in another forum and
> > I
> > > havent received any posts in ANY of the Access or Office related
> > forums so I
> > > assumed (incorrectly!) that people here would be interested. Below is
> > the
> > > message I received elsewhere:

> > > >Why don't you use Google or look in shlobj.h ?!
> > > >First link given by Google :
> > > >http://c85.cemi.rssi.ru/Access/TipDetail.idc?TipID=39

> > > I have now developed a set of routines for calling the windows browser
> > > (file, database, etc , folders, printers and so on...) if anyone is
> > > interested I can post the complete source code...

> > > Regards
> > > Jeff



> > > > Why don't you post the answer in this thread? In this way, future
> > Access
> > > > developers searching the NG's will find the answer easily.

> > > > Stephen Lebans
> > > > http://www.lebans.com
> > > > Access Code, Tips and Tricks
> > > > Please respond only to the newsgroups so everyone can benefit.



> > > > > Dont bother people....i have the answer from another NG!



> > > > > > I am not a low level windows programmer, i am but a poor simple
> > > > VB/VBA
> > > > > > developer wanting to programmatically browse for a printer using
> > VBA
> > > > in
> > > > > > Access.
> > > > > > I use the SHBrowseForFolder function successfully to browse for
> > > > folders
> > > > > with
> > > > > > the declaration
> > > > > > Const BIF_RETURNONLYFSDIRS = 1
> > > > > > in the Access module for use in the shellBrowseInfo structure
> > > > object.

> > > > > > When I try to use the declaration
> > > > > > Const BIF_BROWSEFORPRINTER = ?? what should it be set to????
> > > > > > I have tried various values without success in viewing for
> > printers.

> > > > > > Can some ingenious Shell programmer out there give me a little
> > hint?
> > > > or if
> > > > > > there is a REAL programmer who can tell me a better way to do
> > browse
> > > > for
> > > > > > printers from VBA (in Access)????

> > > > > > phew.....
> > > > > > Jeff



Mon, 06 Sep 2004 14:37:29 GMT  
 Browsing for Printers using SHBrowseForFolder Shell Function
Oh...and my other point is that what I was originally asking for was the
constant values...your article doesnt cover them. I got them all from

http://c85.cemi.rssi.ru/Access/TipDetail.idc?TipID=39

'BROWSEINFO.ulFlags values:
Public Const BIF_RETURNONLYFSDIRS = &H1
Public Const BIF_DONTGOBELOWDOMAIN = &H2
Public Const BIF_STATUSTEXT = &H4
Public Const BIF_RETURNFSANCESTORS = &H8
Public Const BIF_BROWSEFORCOMPUTER = &H1000
Public Const BIF_BROWSEFORPRINTER = &H2000

Apart from the above evrything else i had working...thx anyway

Jeff



Quote:
> Ken Getz and I wrote up stuff for this over four years ago. :-)

> (cf http://www.devx.com/premier/mgznarch/vbpj/1997/12dec97/GK1297.pdf)

> --
> MichKa

> Michael Kaplan
> Trigeminal Software, Inc.  -- http://www.trigeminal.com/

> International VB? -- http://www.i18nWithVB.com/
> C++? MSLU -- http://msdn.microsoft.com/msdnmag/issues/01/10/



> > Jeff why don't you create a simple sample MDB demonstrating the
> > functions. I'd be glad to post it on my Web site. That way any future
> > inquiries on this subject can be directed there.
> > :-)
> > --

> > HTH
> > Stephen Lebans
> > http://www.lebans.com
> > Access Code, Tips and Tricks
> > Please respond only to the newsgroups so everyone can benefit.



> > > Stephen,
> > > I didnt post it here because the answer was given in another forum and
> > I
> > > havent received any posts in ANY of the Access or Office related
> > forums so I
> > > assumed (incorrectly!) that people here would be interested. Below is
> > the
> > > message I received elsewhere:

> > > >Why don't you use Google or look in shlobj.h ?!
> > > >First link given by Google :
> > > >http://c85.cemi.rssi.ru/Access/TipDetail.idc?TipID=39

> > > I have now developed a set of routines for calling the windows browser
> > > (file, database, etc , folders, printers and so on...) if anyone is
> > > interested I can post the complete source code...

> > > Regards
> > > Jeff



> > > > Why don't you post the answer in this thread? In this way, future
> > Access
> > > > developers searching the NG's will find the answer easily.

> > > > Stephen Lebans
> > > > http://www.lebans.com
> > > > Access Code, Tips and Tricks
> > > > Please respond only to the newsgroups so everyone can benefit.



> > > > > Dont bother people....i have the answer from another NG!



> > > > > > I am not a low level windows programmer, i am but a poor simple
> > > > VB/VBA
> > > > > > developer wanting to programmatically browse for a printer using
> > VBA
> > > > in
> > > > > > Access.
> > > > > > I use the SHBrowseForFolder function successfully to browse for
> > > > folders
> > > > > with
> > > > > > the declaration
> > > > > > Const BIF_RETURNONLYFSDIRS = 1
> > > > > > in the Access module for use in the shellBrowseInfo structure
> > > > object.

> > > > > > When I try to use the declaration
> > > > > > Const BIF_BROWSEFORPRINTER = ?? what should it be set to????
> > > > > > I have tried various values without success in viewing for
> > printers.

> > > > > > Can some ingenious Shell programmer out there give me a little
> > hint?
> > > > or if
> > > > > > there is a REAL programmer who can tell me a better way to do
> > browse
> > > > for
> > > > > > printers from VBA (in Access)????

> > > > > > phew.....
> > > > > > Jeff



Mon, 06 Sep 2004 14:52:07 GMT  
 Browsing for Printers using SHBrowseForFolder Shell Function
Ah, those I would just get from the header files? :-)

These ones are in shlobj.h, in the [freely available] Platform SDK.

--
MichKa

Michael Kaplan
Trigeminal Software, Inc.  -- http://www.trigeminal.com/

International VB? -- http://www.i18nWithVB.com/
C++? MSLU -- http://msdn.microsoft.com/msdnmag/issues/01/10/


Quote:
> Oh...and my other point is that what I was originally asking for was the
> constant values...your article doesnt cover them. I got them all from

> http://c85.cemi.rssi.ru/Access/TipDetail.idc?TipID=39

> 'BROWSEINFO.ulFlags values:
> Public Const BIF_RETURNONLYFSDIRS = &H1
> Public Const BIF_DONTGOBELOWDOMAIN = &H2
> Public Const BIF_STATUSTEXT = &H4
> Public Const BIF_RETURNFSANCESTORS = &H8
> Public Const BIF_BROWSEFORCOMPUTER = &H1000
> Public Const BIF_BROWSEFORPRINTER = &H2000

> Apart from the above evrything else i had working...thx anyway

> Jeff


wrote

> > Ken Getz and I wrote up stuff for this over four years ago. :-)

> > (cf http://www.devx.com/premier/mgznarch/vbpj/1997/12dec97/GK1297.pdf)

> > --
> > MichKa

> > Michael Kaplan
> > Trigeminal Software, Inc.  -- http://www.trigeminal.com/

> > International VB? -- http://www.i18nWithVB.com/
> > C++? MSLU -- http://msdn.microsoft.com/msdnmag/issues/01/10/



> > > Jeff why don't you create a simple sample MDB demonstrating the
> > > functions. I'd be glad to post it on my Web site. That way any future
> > > inquiries on this subject can be directed there.
> > > :-)
> > > --

> > > HTH
> > > Stephen Lebans
> > > http://www.lebans.com
> > > Access Code, Tips and Tricks
> > > Please respond only to the newsgroups so everyone can benefit.



> > > > Stephen,
> > > > I didnt post it here because the answer was given in another forum
and
> > > I
> > > > havent received any posts in ANY of the Access or Office related
> > > forums so I
> > > > assumed (incorrectly!) that people here would be interested. Below
is
> > > the
> > > > message I received elsewhere:

> > > > >Why don't you use Google or look in shlobj.h ?!
> > > > >First link given by Google :
> > > > >http://c85.cemi.rssi.ru/Access/TipDetail.idc?TipID=39

> > > > I have now developed a set of routines for calling the windows
browser
> > > > (file, database, etc , folders, printers and so on...) if anyone is
> > > > interested I can post the complete source code...

> > > > Regards
> > > > Jeff



> > > > > Why don't you post the answer in this thread? In this way, future
> > > Access
> > > > > developers searching the NG's will find the answer easily.

> > > > > Stephen Lebans
> > > > > http://www.lebans.com
> > > > > Access Code, Tips and Tricks
> > > > > Please respond only to the newsgroups so everyone can benefit.



> > > > > > Dont bother people....i have the answer from another NG!



> > > > > > > I am not a low level windows programmer, i am but a poor
simple
> > > > > VB/VBA
> > > > > > > developer wanting to programmatically browse for a printer
using
> > > VBA
> > > > > in
> > > > > > > Access.
> > > > > > > I use the SHBrowseForFolder function successfully to browse
for
> > > > > folders
> > > > > > with
> > > > > > > the declaration
> > > > > > > Const BIF_RETURNONLYFSDIRS = 1
> > > > > > > in the Access module for use in the shellBrowseInfo structure
> > > > > object.

> > > > > > > When I try to use the declaration
> > > > > > > Const BIF_BROWSEFORPRINTER = ?? what should it be set to????
> > > > > > > I have tried various values without success in viewing for
> > > printers.

> > > > > > > Can some ingenious Shell programmer out there give me a little
> > > hint?
> > > > > or if
> > > > > > > there is a REAL programmer who can tell me a better way to do
> > > browse
> > > > > for
> > > > > > > printers from VBA (in Access)????

> > > > > > > phew.....
> > > > > > > Jeff



Mon, 06 Sep 2004 16:07:42 GMT  
 Browsing for Printers using SHBrowseForFolder Shell Function
Your pidlRoot member already tells the OS to limit the listing to the
PRINTERS Folder. Your ulFlags member just has to specify to list the
entries in this folder as normal.

.ulFlags = BIF_BROWSEINCLUDEFILES

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


Quote:
> HELP!

> I followed the VB Programmer Journals example and got the constants
from the
> SDK header file and all works ok for browsing for directories etc but
when
> browsing for Printers (following code snippet)

>   If SHGetSpecialFolderLocation(Frmhwnd, CSIDL_PRINTERS, lngIDList) =
0 Then

>     With bi
>       .hwndOwner = Frmhwnd
>       .pidlRoot = lngIDList
>       .strDisplayName = Space(conMaxPath)
>       .strTitle = strDlgTitle
>       .ulFlags = BIF_BROWSEFORPRINTER
>     End With

>     'Open the Browse dialog
>     lngIDList = SHBrowseForFolder(bi)

> the browse dialog opens at the list of connected printers for the
local
> computer (Great!) but when actually selecting a printer its icon
switches to
> an unknown type and  the OK button remains greyed out?????

> I have attached my Access 2000 module with all the declarations and
> functions....can someone tell me where i have gone wrong....I am out
of
> depth a little here only being an Access developer....any help would
be
> greatly appreciated!

> Jeff


wrote

> > Ah, those I would just get from the header files? :-)

> > These ones are in shlobj.h, in the [freely available] Platform SDK.

> > --
> > MichKa

> > Michael Kaplan
> > Trigeminal Software, Inc.  -- http://www.trigeminal.com/

> > International VB? -- http://www.i18nWithVB.com/
> > C++? MSLU -- http://msdn.microsoft.com/msdnmag/issues/01/10/



> > > Oh...and my other point is that what I was originally asking for
was the
> > > constant values...your article doesnt cover them. I got them all
from

> > > http://c85.cemi.rssi.ru/Access/TipDetail.idc?TipID=39

> > > 'BROWSEINFO.ulFlags values:
> > > Public Const BIF_RETURNONLYFSDIRS = &H1
> > > Public Const BIF_DONTGOBELOWDOMAIN = &H2
> > > Public Const BIF_STATUSTEXT = &H4
> > > Public Const BIF_RETURNFSANCESTORS = &H8
> > > Public Const BIF_BROWSEFORCOMPUTER = &H1000
> > > Public Const BIF_BROWSEFORPRINTER = &H2000

> > > Apart from the above evrything else i had working...thx anyway

> > > Jeff

> > > "Michael (michka) Kaplan"


Quote:
> > wrote

> > > > Ken Getz and I wrote up stuff for this over four years ago. :-)

> > > > (cf

http://www.devx.com/premier/mgznarch/vbpj/1997/12dec97/GK1297.pdf)

- Show quoted text -

Quote:

> > > > --
> > > > MichKa

> > > > Michael Kaplan
> > > > Trigeminal Software, Inc.  -- http://www.trigeminal.com/

> > > > International VB? -- http://www.i18nWithVB.com/
> > > > C++? MSLU -- http://msdn.microsoft.com/msdnmag/issues/01/10/



> > > > > Jeff why don't you create a simple sample MDB demonstrating
the
> > > > > functions. I'd be glad to post it on my Web site. That way any
> future
> > > > > inquiries on this subject can be directed there.
> > > > > :-)
> > > > > --

> > > > > HTH
> > > > > Stephen Lebans
> > > > > http://www.lebans.com
> > > > > Access Code, Tips and Tricks
> > > > > Please respond only to the newsgroups so everyone can benefit.



> > > > > > Stephen,
> > > > > > I didnt post it here because the answer was given in another
forum
> > and
> > > > > I
> > > > > > havent received any posts in ANY of the Access or Office
related
> > > > > forums so I
> > > > > > assumed (incorrectly!) that people here would be interested.
Below
> > is
> > > > > the
> > > > > > message I received elsewhere:

> > > > > > >Why don't you use Google or look in shlobj.h ?!
> > > > > > >First link given by Google :
> > > > > > >http://c85.cemi.rssi.ru/Access/TipDetail.idc?TipID=39

> > > > > > I have now developed a set of routines for calling the
windows
> > browser
> > > > > > (file, database, etc , folders, printers and so on...) if
anyone
> is
> > > > > > interested I can post the complete source code...

> > > > > > Regards
> > > > > > Jeff



> > > > > > > Why don't you post the answer in this thread? In this way,
> future
> > > > > Access
> > > > > > > developers searching the NG's will find the answer easily.

> > > > > > > Stephen Lebans
> > > > > > > http://www.lebans.com
> > > > > > > Access Code, Tips and Tricks
> > > > > > > Please respond only to the newsgroups so everyone can
benefit.



> > > > > > > > Dont bother people....i have the answer from another NG!



> > > > > > > > > I am not a low level windows programmer, i am but a
poor
> > simple
> > > > > > > VB/VBA
> > > > > > > > > developer wanting to programmatically browse for a
printer
> > using
> > > > > VBA
> > > > > > > in
> > > > > > > > > Access.
> > > > > > > > > I use the SHBrowseForFolder function successfully to
browse
> > for
> > > > > > > folders
> > > > > > > > with
> > > > > > > > > the declaration
> > > > > > > > > Const BIF_RETURNONLYFSDIRS = 1
> > > > > > > > > in the Access module for use in the shellBrowseInfo
> structure
> > > > > > > object.

> > > > > > > > > When I try to use the declaration
> > > > > > > > > Const BIF_BROWSEFORPRINTER = ?? what should it be set
to????
> > > > > > > > > I have tried various values without success in viewing
for
> > > > > printers.

> > > > > > > > > Can some ingenious Shell programmer out there give me
a
> little
> > > > > hint?
> > > > > > > or if
> > > > > > > > > there is a REAL programmer who can tell me a better
way to
> do
> > > > > browse
> > > > > > > for
> > > > > > > > > printers from VBA (in Access)????

> > > > > > > > > phew.....
> > > > > > > > > Jeff



Wed, 08 Sep 2004 07:19:15 GMT  
 Browsing for Printers using SHBrowseForFolder Shell Function
Thx for that Stephen the OK button is now always enabled even when i select
the Printers folder?, but i have still have the following problems:

the icon for the printer changes to an unknown image when it is highlighted
and when selecting OK the value returned is unable to be resolved by:

      If CBool(SHGetPathFromIDList(lngIDList, strReturn)) Then

and so no path is returned.

there must be something simple missing in my earlier attached code?

Regards
Jeff


Quote:
> Your pidlRoot member already tells the OS to limit the listing to the
> PRINTERS Folder. Your ulFlags member just has to specify to list the
> entries in this folder as normal.

> .ulFlags = BIF_BROWSEINCLUDEFILES

> HTH
> Stephen Lebans
> http://www.lebans.com
> Access Code, Tips and Tricks
> Please respond only to the newsgroups so everyone can benefit.



> > HELP!

> > I followed the VB Programmer Journals example and got the constants
> from the
> > SDK header file and all works ok for browsing for directories etc but
> when
> > browsing for Printers (following code snippet)

> >   If SHGetSpecialFolderLocation(Frmhwnd, CSIDL_PRINTERS, lngIDList) =
> 0 Then

> >     With bi
> >       .hwndOwner = Frmhwnd
> >       .pidlRoot = lngIDList
> >       .strDisplayName = Space(conMaxPath)
> >       .strTitle = strDlgTitle
> >       .ulFlags = BIF_BROWSEFORPRINTER
> >     End With

> >     'Open the Browse dialog
> >     lngIDList = SHBrowseForFolder(bi)

> > the browse dialog opens at the list of connected printers for the
> local
> > computer (Great!) but when actually selecting a printer its icon
> switches to
> > an unknown type and  the OK button remains greyed out?????

> > I have attached my Access 2000 module with all the declarations and
> > functions....can someone tell me where i have gone wrong....I am out
> of
> > depth a little here only being an Access developer....any help would
> be
> > greatly appreciated!

> > Jeff


> wrote

> > > Ah, those I would just get from the header files? :-)

> > > These ones are in shlobj.h, in the [freely available] Platform SDK.

> > > --
> > > MichKa

> > > Michael Kaplan
> > > Trigeminal Software, Inc.  -- http://www.trigeminal.com/

> > > International VB? -- http://www.i18nWithVB.com/
> > > C++? MSLU -- http://msdn.microsoft.com/msdnmag/issues/01/10/



> > > > Oh...and my other point is that what I was originally asking for
> was the
> > > > constant values...your article doesnt cover them. I got them all
> from

> > > > http://c85.cemi.rssi.ru/Access/TipDetail.idc?TipID=39

> > > > 'BROWSEINFO.ulFlags values:
> > > > Public Const BIF_RETURNONLYFSDIRS = &H1
> > > > Public Const BIF_DONTGOBELOWDOMAIN = &H2
> > > > Public Const BIF_STATUSTEXT = &H4
> > > > Public Const BIF_RETURNFSANCESTORS = &H8
> > > > Public Const BIF_BROWSEFORCOMPUTER = &H1000
> > > > Public Const BIF_BROWSEFORPRINTER = &H2000

> > > > Apart from the above evrything else i had working...thx anyway

> > > > Jeff

> > > > "Michael (michka) Kaplan"

> > > wrote

> > > > > Ken Getz and I wrote up stuff for this over four years ago. :-)

> > > > > (cf
> http://www.devx.com/premier/mgznarch/vbpj/1997/12dec97/GK1297.pdf)

> > > > > --
> > > > > MichKa

> > > > > Michael Kaplan
> > > > > Trigeminal Software, Inc.  -- http://www.trigeminal.com/

> > > > > International VB? -- http://www.i18nWithVB.com/
> > > > > C++? MSLU -- http://msdn.microsoft.com/msdnmag/issues/01/10/



> > > > > > Jeff why don't you create a simple sample MDB demonstrating
> the
> > > > > > functions. I'd be glad to post it on my Web site. That way any
> > future
> > > > > > inquiries on this subject can be directed there.
> > > > > > :-)
> > > > > > --

> > > > > > HTH
> > > > > > Stephen Lebans
> > > > > > http://www.lebans.com
> > > > > > Access Code, Tips and Tricks
> > > > > > Please respond only to the newsgroups so everyone can benefit.



> > > > > > > Stephen,
> > > > > > > I didnt post it here because the answer was given in another
> forum
> > > and
> > > > > > I
> > > > > > > havent received any posts in ANY of the Access or Office
> related
> > > > > > forums so I
> > > > > > > assumed (incorrectly!) that people here would be interested.
> Below
> > > is
> > > > > > the
> > > > > > > message I received elsewhere:

> > > > > > > >Why don't you use Google or look in shlobj.h ?!
> > > > > > > >First link given by Google :
> > > > > > > >http://c85.cemi.rssi.ru/Access/TipDetail.idc?TipID=39

> > > > > > > I have now developed a set of routines for calling the
> windows
> > > browser
> > > > > > > (file, database, etc , folders, printers and so on...) if
> anyone
> > is
> > > > > > > interested I can post the complete source code...

> > > > > > > Regards
> > > > > > > Jeff



> > > > > > > > Why don't you post the answer in this thread? In this way,
> > future
> > > > > > Access
> > > > > > > > developers searching the NG's will find the answer easily.

> > > > > > > > Stephen Lebans
> > > > > > > > http://www.lebans.com
> > > > > > > > Access Code, Tips and Tricks
> > > > > > > > Please respond only to the newsgroups so everyone can
> benefit.



> > > > > > > > > Dont bother people....i have the answer from another NG!



> > > > > > > > > > I am not a low level windows programmer, i am but a
> poor
> > > simple
> > > > > > > > VB/VBA
> > > > > > > > > > developer wanting to programmatically browse for a
> printer
> > > using
> > > > > > VBA
> > > > > > > > in
> > > > > > > > > > Access.
> > > > > > > > > > I use the SHBrowseForFolder function successfully to
> browse
> > > for
> > > > > > > > folders
> > > > > > > > > with
> > > > > > > > > > the declaration
> > > > > > > > > > Const BIF_RETURNONLYFSDIRS = 1
> > > > > > > > > > in the Access module for use in the shellBrowseInfo
> > structure
> > > > > > > > object.

> > > > > > > > > > When I try to use the declaration
> > > > > > > > > > Const BIF_BROWSEFORPRINTER = ?? what should it be set
> to????
> > > > > > > > > > I have tried various values without success in viewing
> for
> > > > > > printers.

> > > > > > > > > > Can some ingenious Shell programmer out there give me
> a
> > little
> > > > > > hint?
> > > > > > > > or if
> > > > > > > > > > there is a REAL programmer who can tell me a better
> way to
> > do
> > > > > > browse
> > > > > > > > for
> > > > > > > > > > printers from VBA (in Access)????

> > > > > > > > > > phew.....
> > > > > > > > > > Jeff



Wed, 08 Sep 2004 08:57:31 GMT  
 Browsing for Printers using SHBrowseForFolder Shell Function
Its interesting to note that the problem is for network printers on the
local computer but works ok for browsing to shared printers on a server, ie
the path for the server printer IS retrieved.

jeff


Quote:
> Your pidlRoot member already tells the OS to limit the listing to the
> PRINTERS Folder. Your ulFlags member just has to specify to list the
> entries in this folder as normal.

> .ulFlags = BIF_BROWSEINCLUDEFILES

> HTH
> Stephen Lebans
> http://www.lebans.com
> Access Code, Tips and Tricks
> Please respond only to the newsgroups so everyone can benefit.



> > HELP!

> > I followed the VB Programmer Journals example and got the constants
> from the
> > SDK header file and all works ok for browsing for directories etc but
> when
> > browsing for Printers (following code snippet)

> >   If SHGetSpecialFolderLocation(Frmhwnd, CSIDL_PRINTERS, lngIDList) =
> 0 Then

> >     With bi
> >       .hwndOwner = Frmhwnd
> >       .pidlRoot = lngIDList
> >       .strDisplayName = Space(conMaxPath)
> >       .strTitle = strDlgTitle
> >       .ulFlags = BIF_BROWSEFORPRINTER
> >     End With

> >     'Open the Browse dialog
> >     lngIDList = SHBrowseForFolder(bi)

> > the browse dialog opens at the list of connected printers for the
> local
> > computer (Great!) but when actually selecting a printer its icon
> switches to
> > an unknown type and  the OK button remains greyed out?????

> > I have attached my Access 2000 module with all the declarations and
> > functions....can someone tell me where i have gone wrong....I am out
> of
> > depth a little here only being an Access developer....any help would
> be
> > greatly appreciated!

> > Jeff


> wrote

> > > Ah, those I would just get from the header files? :-)

> > > These ones are in shlobj.h, in the [freely available] Platform SDK.

> > > --
> > > MichKa

> > > Michael Kaplan
> > > Trigeminal Software, Inc.  -- http://www.trigeminal.com/

> > > International VB? -- http://www.i18nWithVB.com/
> > > C++? MSLU -- http://msdn.microsoft.com/msdnmag/issues/01/10/



> > > > Oh...and my other point is that what I was originally asking for
> was the
> > > > constant values...your article doesnt cover them. I got them all
> from

> > > > http://c85.cemi.rssi.ru/Access/TipDetail.idc?TipID=39

> > > > 'BROWSEINFO.ulFlags values:
> > > > Public Const BIF_RETURNONLYFSDIRS = &H1
> > > > Public Const BIF_DONTGOBELOWDOMAIN = &H2
> > > > Public Const BIF_STATUSTEXT = &H4
> > > > Public Const BIF_RETURNFSANCESTORS = &H8
> > > > Public Const BIF_BROWSEFORCOMPUTER = &H1000
> > > > Public Const BIF_BROWSEFORPRINTER = &H2000

> > > > Apart from the above evrything else i had working...thx anyway

> > > > Jeff

> > > > "Michael (michka) Kaplan"

> > > wrote

> > > > > Ken Getz and I wrote up stuff for this over four years ago. :-)

> > > > > (cf
> http://www.devx.com/premier/mgznarch/vbpj/1997/12dec97/GK1297.pdf)

> > > > > --
> > > > > MichKa

> > > > > Michael Kaplan
> > > > > Trigeminal Software, Inc.  -- http://www.trigeminal.com/

> > > > > International VB? -- http://www.i18nWithVB.com/
> > > > > C++? MSLU -- http://msdn.microsoft.com/msdnmag/issues/01/10/



> > > > > > Jeff why don't you create a simple sample MDB demonstrating
> the
> > > > > > functions. I'd be glad to post it on my Web site. That way any
> > future
> > > > > > inquiries on this subject can be directed there.
> > > > > > :-)
> > > > > > --

> > > > > > HTH
> > > > > > Stephen Lebans
> > > > > > http://www.lebans.com
> > > > > > Access Code, Tips and Tricks
> > > > > > Please respond only to the newsgroups so everyone can benefit.



> > > > > > > Stephen,
> > > > > > > I didnt post it here because the answer was given in another
> forum
> > > and
> > > > > > I
> > > > > > > havent received any posts in ANY of the Access or Office
> related
> > > > > > forums so I
> > > > > > > assumed (incorrectly!) that people here would be interested.
> Below
> > > is
> > > > > > the
> > > > > > > message I received elsewhere:

> > > > > > > >Why don't you use Google or look in shlobj.h ?!
> > > > > > > >First link given by Google :
> > > > > > > >http://c85.cemi.rssi.ru/Access/TipDetail.idc?TipID=39

> > > > > > > I have now developed a set of routines for calling the
> windows
> > > browser
> > > > > > > (file, database, etc , folders, printers and so on...) if
> anyone
> > is
> > > > > > > interested I can post the complete source code...

> > > > > > > Regards
> > > > > > > Jeff



> > > > > > > > Why don't you post the answer in this thread? In this way,
> > future
> > > > > > Access
> > > > > > > > developers searching the NG's will find the answer easily.

> > > > > > > > Stephen Lebans
> > > > > > > > http://www.lebans.com
> > > > > > > > Access Code, Tips and Tricks
> > > > > > > > Please respond only to the newsgroups so everyone can
> benefit.



> > > > > > > > > Dont bother people....i have the answer from another NG!



> > > > > > > > > > I am not a low level windows programmer, i am but a
> poor
> > > simple
> > > > > > > > VB/VBA
> > > > > > > > > > developer wanting to programmatically browse for a
> printer
> > > using
> > > > > > VBA
> > > > > > > > in
> > > > > > > > > > Access.
> > > > > > > > > > I use the SHBrowseForFolder function successfully to
> browse
> > > for
> > > > > > > > folders
> > > > > > > > > with
> > > > > > > > > > the declaration
> > > > > > > > > > Const BIF_RETURNONLYFSDIRS = 1
> > > > > > > > > > in the Access module for use in the shellBrowseInfo
> > structure
> > > > > > > > object.

> > > > > > > > > > When I try to use the declaration
> > > > > > > > > > Const BIF_BROWSEFORPRINTER = ?? what should it be set
> to????
> > > > > > > > > > I have tried various values without success in viewing
> for
> > > > > > printers.

> > > > > > > > > > Can some ingenious Shell programmer out there give me
> a
> > little
> > > > > > hint?
> > > > > > > > or if
> > > > > > > > > > there is a REAL programmer who can tell me a better
> way to
> > do
> > > > > > browse
> > > > > > > > for
> > > > > > > > > > printers from VBA (in Access)????

> > > > > > > > > > phew.....
> > > > > > > > > > Jeff



Wed, 08 Sep 2004 10:49:00 GMT  
 Browsing for Printers using SHBrowseForFolder Shell Function
Jeff you need to read the docs for this group of API's. No path is
returned for "Virtual" folders as obviously the Printers folder is a
virtual folder. Just use the strDisplayName member to get the Printer
selected by the user. If the strDisplayName contains the text "Printers"
then they have selected the Folder and not a specific printer.

If you want the user to find a Network printer than you do use the
BIF_BROWSEFORPRINTER value with the CSIDL_NETWORK value. This will
return a valid path.

Finally, I have only used these API's for the first time tonight so I
may be misunderstanding their logical usage.

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.


Quote:
> Thx for that Stephen the OK button is now always enabled even when i
select
> the Printers folder?, but i have still have the following problems:

> the icon for the printer changes to an unknown image when it is
highlighted
> and when selecting OK the value returned is unable to be resolved by:

>       If CBool(SHGetPathFromIDList(lngIDList, strReturn)) Then

> and so no path is returned.

> there must be something simple missing in my earlier attached code?

> Regards
> Jeff



> > Your pidlRoot member already tells the OS to limit the listing to
the
> > PRINTERS Folder. Your ulFlags member just has to specify to list the
> > entries in this folder as normal.

> > .ulFlags = BIF_BROWSEINCLUDEFILES

> > HTH
> > Stephen Lebans
> > http://www.lebans.com
> > Access Code, Tips and Tricks
> > Please respond only to the newsgroups so everyone can benefit.



> > > HELP!

> > > I followed the VB Programmer Journals example and got the
constants
> > from the
> > > SDK header file and all works ok for browsing for directories etc
but
> > when
> > > browsing for Printers (following code snippet)

> > >   If SHGetSpecialFolderLocation(Frmhwnd, CSIDL_PRINTERS,
lngIDList) =
> > 0 Then

> > >     With bi
> > >       .hwndOwner = Frmhwnd
> > >       .pidlRoot = lngIDList
> > >       .strDisplayName = Space(conMaxPath)
> > >       .strTitle = strDlgTitle
> > >       .ulFlags = BIF_BROWSEFORPRINTER
> > >     End With

> > >     'Open the Browse dialog
> > >     lngIDList = SHBrowseForFolder(bi)

> > > the browse dialog opens at the list of connected printers for the
> > local
> > > computer (Great!) but when actually selecting a printer its icon
> > switches to
> > > an unknown type and  the OK button remains greyed out?????

> > > I have attached my Access 2000 module with all the declarations
and
> > > functions....can someone tell me where i have gone wrong....I am
out
> > of
> > > depth a little here only being an Access developer....any help
would
> > be
> > > greatly appreciated!

> > > Jeff

> > > "Michael (michka) Kaplan"


- Show quoted text -

Quote:
> > wrote

> > > > Ah, those I would just get from the header files? :-)

> > > > These ones are in shlobj.h, in the [freely available] Platform
SDK.

> > > > --
> > > > MichKa

> > > > Michael Kaplan
> > > > Trigeminal Software, Inc.  -- http://www.trigeminal.com/

> > > > International VB? -- http://www.i18nWithVB.com/
> > > > C++? MSLU -- http://msdn.microsoft.com/msdnmag/issues/01/10/



> > > > > Oh...and my other point is that what I was originally asking
for
> > was the
> > > > > constant values...your article doesnt cover them. I got them
all
> > from

> > > > > http://c85.cemi.rssi.ru/Access/TipDetail.idc?TipID=39

> > > > > 'BROWSEINFO.ulFlags values:
> > > > > Public Const BIF_RETURNONLYFSDIRS = &H1
> > > > > Public Const BIF_DONTGOBELOWDOMAIN = &H2
> > > > > Public Const BIF_STATUSTEXT = &H4
> > > > > Public Const BIF_RETURNFSANCESTORS = &H8
> > > > > Public Const BIF_BROWSEFORCOMPUTER = &H1000
> > > > > Public Const BIF_BROWSEFORPRINTER = &H2000

> > > > > Apart from the above evrything else i had working...thx anyway

> > > > > Jeff

> > > > > "Michael (michka) Kaplan"

> > > > wrote

> > > > > > Ken Getz and I wrote up stuff for this over four years ago.
:-)

> > > > > > (cf
> > http://www.devx.com/premier/mgznarch/vbpj/1997/12dec97/GK1297.pdf)

> > > > > > --
> > > > > > MichKa

> > > > > > Michael Kaplan
> > > > > > Trigeminal Software, Inc.  -- http://www.trigeminal.com/

> > > > > > International VB? -- http://www.i18nWithVB.com/
> > > > > > C++? MSLU -- http://msdn.microsoft.com/msdnmag/issues/01/10/



> > > > > > > Jeff why don't you create a simple sample MDB
demonstrating
> > the
> > > > > > > functions. I'd be glad to post it on my Web site. That way
any
> > > future
> > > > > > > inquiries on this subject can be directed there.
> > > > > > > :-)
> > > > > > > --

> > > > > > > HTH
> > > > > > > Stephen Lebans
> > > > > > > http://www.lebans.com
> > > > > > > Access Code, Tips and Tricks
> > > > > > > Please respond only to the newsgroups so everyone can
benefit.



> > > > > > > > Stephen,
> > > > > > > > I didnt post it here because the answer was given in
another
> > forum
> > > > and
> > > > > > > I
> > > > > > > > havent received any posts in ANY of the Access or Office
> > related
> > > > > > > forums so I
> > > > > > > > assumed (incorrectly!) that people here would be
interested.
> > Below
> > > > is
> > > > > > > the
> > > > > > > > message I received elsewhere:

> > > > > > > > >Why don't you use Google or look in shlobj.h ?!
> > > > > > > > >First link given by Google :
> > > > > > > > >http://c85.cemi.rssi.ru/Access/TipDetail.idc?TipID=39

> > > > > > > > I have now developed a set of routines for calling the
> > windows
> > > > browser
> > > > > > > > (file, database, etc , folders, printers and so on...)
if
> > anyone
> > > is
> > > > > > > > interested I can post the complete source code...

> > > > > > > > Regards
> > > > > > > > Jeff



> > > > > > > > > Why don't you post the answer in this thread? In this
way,
> > > future
> > > > > > > Access
> > > > > > > > > developers searching the NG's will find the answer
easily.

> > > > > > > > > Stephen Lebans
> > > > > > > > > http://www.lebans.com
> > > > > > > > > Access Code, Tips and Tricks
> > > > > > > > > Please respond only to the newsgroups so everyone can
> > benefit.



> > > > > > > > > > Dont bother people....i have the answer from another
NG!



> > > > > > > > > > > I am not a low level windows programmer, i am but
a
> > poor
> > > > simple
> > > > > > > > > VB/VBA
> > > > > > > > > > > developer wanting to programmatically browse for a
> > printer
> > > > using
> > > > > > > VBA
> > > > > > > > > in
> > > > > > > > > > > Access.
> > > > > > > > > > > I use the SHBrowseForFolder function successfully
to
> > browse
> > > > for
> > > > > > > > > folders
> > > > > > > > > > with
> > > > > > > > > > > the declaration
> > > > > > > > > > > Const BIF_RETURNONLYFSDIRS = 1
> > > > > > > > > > > in the Access module for use in the
shellBrowseInfo
> > > structure
> > > > > > > > > object.

> > > > > > > > > > > When I try to use the declaration
> > > > > > > > > > > Const BIF_BROWSEFORPRINTER = ?? what should it be
set
> > to????
> > > > > > > > > > > I have tried various values without success in
viewing
> > for
> > > > > > > printers.

> > > > > > > > > > > Can some ingenious Shell programmer out there give
me
> > a
> > > little
> > > > > > > hint?
> > > > > > > > > or if
> > > > > > > > > > > there is a REAL programmer who can tell me a
better
> > way to
> > > do
> > > > > > > browse
> > > > > > > > > for
> > > > > > > > > > > printers from VBA (in Access)????

> > > > > > > > > > > phew.....
> > > > > > > > > > > Jeff



Wed, 08 Sep 2004 11:01:48 GMT  
 Browsing for Printers using SHBrowseForFolder Shell Function
Its a virtual path for local printers, Jeff.

--
MichKa

Michael Kaplan
Trigeminal Software, Inc.  -- http://www.trigeminal.com/

International VB? -- http://www.i18nWithVB.com/
C++? MSLU -- http://msdn.microsoft.com/msdnmag/issues/01/10/


Quote:
> Its interesting to note that the problem is for network printers on the
> local computer but works ok for browsing to shared printers on a server,
ie
> the path for the server printer IS retrieved.

> jeff



> > Your pidlRoot member already tells the OS to limit the listing to the
> > PRINTERS Folder. Your ulFlags member just has to specify to list the
> > entries in this folder as normal.

> > .ulFlags = BIF_BROWSEINCLUDEFILES

> > HTH
> > Stephen Lebans
> > http://www.lebans.com
> > Access Code, Tips and Tricks
> > Please respond only to the newsgroups so everyone can benefit.



> > > HELP!

> > > I followed the VB Programmer Journals example and got the constants
> > from the
> > > SDK header file and all works ok for browsing for directories etc but
> > when
> > > browsing for Printers (following code snippet)

> > >   If SHGetSpecialFolderLocation(Frmhwnd, CSIDL_PRINTERS, lngIDList) =
> > 0 Then

> > >     With bi
> > >       .hwndOwner = Frmhwnd
> > >       .pidlRoot = lngIDList
> > >       .strDisplayName = Space(conMaxPath)
> > >       .strTitle = strDlgTitle
> > >       .ulFlags = BIF_BROWSEFORPRINTER
> > >     End With

> > >     'Open the Browse dialog
> > >     lngIDList = SHBrowseForFolder(bi)

> > > the browse dialog opens at the list of connected printers for the
> > local
> > > computer (Great!) but when actually selecting a printer its icon
> > switches to
> > > an unknown type and  the OK button remains greyed out?????

> > > I have attached my Access 2000 module with all the declarations and
> > > functions....can someone tell me where i have gone wrong....I am out
> > of
> > > depth a little here only being an Access developer....any help would
> > be
> > > greatly appreciated!

> > > Jeff


> > wrote

> > > > Ah, those I would just get from the header files? :-)

> > > > These ones are in shlobj.h, in the [freely available] Platform SDK.

> > > > --
> > > > MichKa

> > > > Michael Kaplan
> > > > Trigeminal Software, Inc.  -- http://www.trigeminal.com/

> > > > International VB? -- http://www.i18nWithVB.com/
> > > > C++? MSLU -- http://msdn.microsoft.com/msdnmag/issues/01/10/



> > > > > Oh...and my other point is that what I was originally asking for
> > was the
> > > > > constant values...your article doesnt cover them. I got them all
> > from

> > > > > http://c85.cemi.rssi.ru/Access/TipDetail.idc?TipID=39

> > > > > 'BROWSEINFO.ulFlags values:
> > > > > Public Const BIF_RETURNONLYFSDIRS = &H1
> > > > > Public Const BIF_DONTGOBELOWDOMAIN = &H2
> > > > > Public Const BIF_STATUSTEXT = &H4
> > > > > Public Const BIF_RETURNFSANCESTORS = &H8
> > > > > Public Const BIF_BROWSEFORCOMPUTER = &H1000
> > > > > Public Const BIF_BROWSEFORPRINTER = &H2000

> > > > > Apart from the above evrything else i had working...thx anyway

> > > > > Jeff

> > > > > "Michael (michka) Kaplan"

> > > > wrote

> > > > > > Ken Getz and I wrote up stuff for this over four years ago. :-)

> > > > > > (cf
> > http://www.devx.com/premier/mgznarch/vbpj/1997/12dec97/GK1297.pdf)

> > > > > > --
> > > > > > MichKa

> > > > > > Michael Kaplan
> > > > > > Trigeminal Software, Inc.  -- http://www.trigeminal.com/

> > > > > > International VB? -- http://www.i18nWithVB.com/
> > > > > > C++? MSLU -- http://msdn.microsoft.com/msdnmag/issues/01/10/



> > > > > > > Jeff why don't you create a simple sample MDB demonstrating
> > the
> > > > > > > functions. I'd be glad to post it on my Web site. That way any
> > > future
> > > > > > > inquiries on this subject can be directed there.
> > > > > > > :-)
> > > > > > > --

> > > > > > > HTH
> > > > > > > Stephen Lebans
> > > > > > > http://www.lebans.com
> > > > > > > Access Code, Tips and Tricks
> > > > > > > Please respond only to the newsgroups so everyone can benefit.



> > > > > > > > Stephen,
> > > > > > > > I didnt post it here because the answer was given in another
> > forum
> > > > and
> > > > > > > I
> > > > > > > > havent received any posts in ANY of the Access or Office
> > related
> > > > > > > forums so I
> > > > > > > > assumed (incorrectly!) that people here would be interested.
> > Below
> > > > is
> > > > > > > the
> > > > > > > > message I received elsewhere:

> > > > > > > > >Why don't you use Google or look in shlobj.h ?!
> > > > > > > > >First link given by Google :
> > > > > > > > >http://c85.cemi.rssi.ru/Access/TipDetail.idc?TipID=39

> > > > > > > > I have now developed a set of routines for calling the
> > windows
> > > > browser
> > > > > > > > (file, database, etc , folders, printers and so on...) if
> > anyone
> > > is
> > > > > > > > interested I can post the complete source code...

> > > > > > > > Regards
> > > > > > > > Jeff



> > > > > > > > > Why don't you post the answer in this thread? In this way,
> > > future
> > > > > > > Access
> > > > > > > > > developers searching the NG's will find the answer easily.

> > > > > > > > > Stephen Lebans
> > > > > > > > > http://www.lebans.com
> > > > > > > > > Access Code, Tips and Tricks
> > > > > > > > > Please respond only to the newsgroups so everyone can
> > benefit.



> > > > > > > > > > Dont bother people....i have the answer from another NG!



> > > > > > > > > > > I am not a low level windows programmer, i am but a
> > poor
> > > > simple
> > > > > > > > > VB/VBA
> > > > > > > > > > > developer wanting to programmatically browse for a
> > printer
> > > > using
> > > > > > > VBA
> > > > > > > > > in
> > > > > > > > > > > Access.
> > > > > > > > > > > I use the SHBrowseForFolder function successfully to
> > browse
> > > > for
> > > > > > > > > folders
> > > > > > > > > > with
> > > > > > > > > > > the declaration
> > > > > > > > > > > Const BIF_RETURNONLYFSDIRS = 1
> > > > > > > > > > > in the Access module for use in the shellBrowseInfo
> > > structure
> > > > > > > > > object.

> > > > > > > > > > > When I try to use the declaration
> > > > > > > > > > > Const BIF_BROWSEFORPRINTER = ?? what should it be set
> > to????
> > > > > > > > > > > I have tried various values without success in viewing
> > for
> > > > > > > printers.

> > > > > > > > > > > Can some ingenious Shell programmer out there give me
> > a
> > > little
> > > > > > > hint?
> > > > > > > > > or if
> > > > > > > > > > > there is a REAL programmer who can tell me a better
> > way to
> > > do
> > > > > > > browse
> > > > > > > > > for
> > > > > > > > > > > printers from VBA (in Access)????

> > > > > > > > > > > phew.....
> > > > > > > > > > > Jeff



Wed, 08 Sep 2004 14:04:17 GMT  
 
 [ 17 post ]  Go to page: [1] [2]

 Relevant Pages 

1. Using the SHBrowseForFolder DLL function

2. SHBrowseForFolder and Browse for Computer

3. Customising the Browse For Folder - SHBrowseForFolder

4. SHBrowseForFolder and Browse for Computer

5. browse for folder - SHBrowseForFolder

6. How to use SHBrowseForFolder to browse for computer

7. SHBrowseForFolder and Browse for Computer

8. Using VB Shell to send Doc to printer

9. Problem using Shell Function with MS Wordpad

10. Using Shell function

11. Using variable command with Shell function

12. Using the Shell Function

 

 
Powered by phpBB® Forum Software