Home > Archive > Clipper > June 2004 > Sharing Printers Question
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Sharing Printers Question
|
|
| Mel Smith 2004-06-14, 8:55 pm |
| Dear ClipperLites,
From within my Clipper app, I will be trying to issue the following command
(probably using SWPRUNCMD(....) )
"NET USE LPT2 \\COMPNAME\PRINTNAME /PERSISTENT:YES"
Is there any programmatic way to determine 'COMPNAME' and 'PRINTNAME' so I
can issue this command *for* the user rather than my trying to teach them by
phone and have them get all mixed up.
That is, can I somehow investigate some system file and dewtermine the
values for 'compname' and 'printname' ??
TIA,
-Mel Smith
| |
| Klas Engwall 2004-06-14, 8:55 pm |
| Mel,
> From within my Clipper app, I will be trying to issue the following command
>(probably using SWPRUNCMD(....) )
>
> "NET USE LPT2 \\COMPNAME\PRINTNAME /PERSISTENT:YES"
Or from inside your Clipper app you can do the same thing with
LM_Redirect() from my LanMan Library. That gives you the added benefit
of knowing if the redirection attempt succeeded or failed. You can
download it from <http://www.engwall.com/clipper/lanmanlib.htm>
> Is there any programmatic way to determine 'COMPNAME' and 'PRINTNAME' so I
>can issue this command *for* the user rather than my trying to teach them by
>phone and have them get all mixed up.
>
> That is, can I somehow investigate some system file and dewtermine the
>values for 'compname' and 'printname' ??
Unfortunately there is no DOS service that will let you do that.
Theoretically you could issue NET VIEW \\COMPNAME on the command line,
redirect the output to a file and parse that file. But you would still
have to know \\COMPNAME from the start, and the output of NET VIEW is
not entirely consistent between Windows versions.
In the Win32 environment you can use the WNetOpenEnum and
WNetEnumResource functions from the Platform SDK to enumerate network
resources. I wonder if Pritpal's Vouch32 library can help you with
that...
HTH,
Klas
-------
klas dot engwall at engwall dot com
Spammers, please use this address :-) mailto:postmaster@[127.0.0.1]
| |
| Stephen Quinn 2004-06-15, 3:55 am |
| Mell
In addition to what Klas says
Try using a windows installer (Eg InnoSetup) and ask the question in a dialog when your install the
program (not much good for existing users but you can always do it in an update)
ie you should be able to query the printers under windows from there
You can create a .bat file from within the the installer then.
--
HTH
Steve Quinn
| |
| Mel Smith 2004-06-15, 3:55 am |
| Klas & Steve,
Thanks very much for both of your useful ideas.
| |
| Luc Mulier 2004-06-15, 8:55 am |
| You could try tis
make a showprt.bat file
@echo off
net use >showprt.txt
notepad showprt.txt (other editor is as good)
Call this showprt.bat with swpruncmd...
Works fine to me.
--
"Mel Smith" <medsyntel@aol.comnocrud> wrote in message
news:20040614173400.02485.00001066@mb-m01.aol.com...
Dear ClipperLites,
From within my Clipper app, I will be trying to issue the following
command
(probably using SWPRUNCMD(....) )
"NET USE LPT2 \\COMPNAME\PRINTNAME /PERSISTENT:YES"
Is there any programmatic way to determine 'COMPNAME' and 'PRINTNAME' so
I
can issue this command *for* the user rather than my trying to teach them by
phone and have them get all mixed up.
That is, can I somehow investigate some system file and dewtermine the
values for 'compname' and 'printname' ??
TIA,
-Mel Smith
| |
| Ian Boys 2004-06-15, 3:55 pm |
| Surely that only shows you what you've got, not what's available on the
network
"Luc Mulier" <luc.mulier@cvvooruit.be> wrote in message
news:40cee0f5$0$8403$a0ced6e1@news.skynet.be...
> You could try tis
>
> make a showprt.bat file
> @echo off
> net use >showprt.txt
> notepad showprt.txt (other editor is as good)
>
> Call this showprt.bat with swpruncmd...
>
> Works fine to me.
>
>
>
> --
>
> "Mel Smith" <medsyntel@aol.comnocrud> wrote in message
> news:20040614173400.02485.00001066@mb-m01.aol.com...
> Dear ClipperLites,
>
> From within my Clipper app, I will be trying to issue the following
> command
> (probably using SWPRUNCMD(....) )
>
> "NET USE LPT2 \\COMPNAME\PRINTNAME /PERSISTENT:YES"
>
> Is there any programmatic way to determine 'COMPNAME' and 'PRINTNAME'
so
> I
> can issue this command *for* the user rather than my trying to teach them
by
> phone and have them get all mixed up.
>
> That is, can I somehow investigate some system file and dewtermine the
> values for 'compname' and 'printname' ??
>
> TIA,
>
> -Mel Smith
>
>
>
| |
| Luc Mulier 2004-06-15, 3:55 pm |
| First post was in error (x-cuse me)
You could try tis
make a shownet.bat file
@echo off
net view >shownet.txt
Swpruncmd("shownet.bat")
Open shownet.txt in clipper program.
For each enrty in the shownet.txt create a bat file ShowShar.bat
@echo off
net view \\%1 >showshar.txt
swpruncmd("showshar.bat "+computername)
result: a lot of files with all shared disks and printers.
|
|
|
|
|