Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

Call the EnumJobs Windows API function

3 posts in Powerscript Last posting was on 2010-02-24 17:17:59.0Z
Sudheer Chonate Posted on 2010-02-24 14:55:03.0Z
Sender: 5c8.4b853af7.1804289383@sybase.com
From: Sudheer Chonate
Newsgroups: sybase.public.powerbuilder.powerscript
Subject: Call the EnumJobs Windows API function
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <4b853dc7.63b.1681692777@sybase.com>
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 24 Feb 2010 06:55:03 -0800
X-Trace: forums-1-dub 1267023303 10.22.241.41 (24 Feb 2010 06:55:03 -0800)
X-Original-Trace: 24 Feb 2010 06:55:03 -0800, 10.22.241.41
Lines: 21
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.powerscript:27319
Article PK: 793687

I have downloaded the sample code from sybase site which
demonstrates how to call the EnumJobs Windows API function.
It involves the use of the following API functions:

OpenPrinter, ClosePrinter, RtlMoveMemory, lstrlen, lstrcpy

But in my machine the code is always return zero value for
the below call.

Local External functions
-------------------------
function integer OpenPrinter ( string pPrinterName, ref
ulong phPrinter, long pDefault ) Library "winspool.drv"
ALIAS FOR "OpenPrinterA"

//Open a handle to the printer
li_rc = OpenPrinter ( DeviceName, hPrinter, 0 )
IF li_rc = 0 THEN Return -1

Is there any way to identify the error message for this
failure?


Scott Morris Posted on 2010-02-24 15:43:16.0Z
From: "Scott Morris" <bogus@bogus.com>
Newsgroups: sybase.public.powerbuilder.powerscript
References: <4b853dc7.63b.1681692777@sybase.com>
Subject: Re: Call the EnumJobs Windows API function
Lines: 17
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5843
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <4b854914$1@forums-1-dub>
Date: 24 Feb 2010 07:43:16 -0800
X-Trace: forums-1-dub 1267026196 10.22.241.152 (24 Feb 2010 07:43:16 -0800)
X-Original-Trace: 24 Feb 2010 07:43:16 -0800, vip152.sybase.com
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.powerscript:27321
Article PK: 761810


> -------------------------
> function integer OpenPrinter ( string pPrinterName, ref
> ulong phPrinter, long pDefault ) Library "winspool.drv"
> ALIAS FOR "OpenPrinterA"
>
> //Open a handle to the printer
> li_rc = OpenPrinter ( DeviceName, hPrinter, 0 )
> IF li_rc = 0 THEN Return -1
>
> Is there any way to identify the error message for this
> failure?

Yes - refer to MSDN for documentation about the function, its usage, and
error handling. Specifically, use GetLastError and FormatMessage API
functions.


"Jerry Siegel [TeamSybase]" <jNOsSPAMsiegel Posted on 2010-02-24 17:17:59.0Z
From: "Jerry Siegel [TeamSybase]" <jNOsSPAMsiegel@yahoo!.com>
Newsgroups: sybase.public.powerbuilder.powerscript
References: <4b853dc7.63b.1681692777@sybase.com>
Subject: Re: Call the EnumJobs Windows API function
Lines: 36
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5843
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <4b855f47$1@forums-1-dub>
Date: 24 Feb 2010 09:17:59 -0800
X-Trace: forums-1-dub 1267031879 10.22.241.152 (24 Feb 2010 09:17:59 -0800)
X-Original-Trace: 24 Feb 2010 09:17:59 -0800, vip152.sybase.com
X-Authenticated-User: TeamSybase
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.powerscript:27323
Article PK: 793680

I notice you have the OpenPrinterA function. The A indicates the Ansi
version. If your PB is version 10 or higher, you want the Unicode
OpenPrinterW name, or use the ;Ansi modifier in the declaration.
http://msdn.microsoft.com/en-us/library/dd162751%28VS.85%29.aspx

--
Report Bugs to Sybase: http://case-express.sybase.com/cx/welcome.do
Product Enhancement Requests:
http://my.isug.com/cgi-bin/1/c/submit_enhancement

<Sudheer Chonate> wrote in message
news:4b853dc7.63b.1681692777@sybase.com...
>I have downloaded the sample code from sybase site which
> demonstrates how to call the EnumJobs Windows API function.
> It involves the use of the following API functions:
>
> OpenPrinter, ClosePrinter, RtlMoveMemory, lstrlen, lstrcpy
>
> But in my machine the code is always return zero value for
> the below call.
>
> Local External functions
> -------------------------
> function integer OpenPrinter ( string pPrinterName, ref
> ulong phPrinter, long pDefault ) Library "winspool.drv"
> ALIAS FOR "OpenPrinterA"
>
> //Open a handle to the printer
> li_rc = OpenPrinter ( DeviceName, hPrinter, 0 )
> IF li_rc = 0 THEN Return -1
>
> Is there any way to identify the error message for this
> failure?