Article View: be.comp.programming
Article #4262Re: VB.NET & EnumJobs()
From: SLE
Date: Thu, 04 Sep 2003 07:07
Date: Thu, 04 Sep 2003 07:07
72 lines
4186 bytes
4186 bytes
"Pieter Philippaerts" <Pieter@nospam.mentalis.org> wrote...
> "SLE" <info@NOSPAMproit.be> wrote in message
> > Ik probeer Q202480 te vertalen
> > naar VB.NET maar geraak in de knoei, onder meer wanneer het op
marshalling
> > etc. aankomt.
>
> Kan je je declaraties eens posten?
>
Ik heb intussen van Microsoft PSS een "officieuze" vertaling van Q202480
naar VB.NET ontvangen. Let wel, copy/paste van de volledige code in een
nieuw VB.NET project werkt niet, had ik ook niet onmiddellijk verwacht.
Volledige code posten is net iets tīŋŊ, dus hier volgen de declaraties (indien
ik er niet uit geraak zal ik een url posten naar het volledige projectje):
Public Class WINAPI
Public Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory"
(<MarshalAsAttribute(UnmanagedType.AsAny)> ByVal o1 As Object,
<MarshalAsAttribute(UnmanagedType.AsAny)> ByVal o2 As Object, ByVal Length
As Integer)
Declare Auto Function GetPrinter Lib "winspool.drv" (ByVal hPrinter As
IntPtr, ByVal Level As Integer, ByRef pPrinter As Byte, ByVal cbBuf As
Integer, ByRef pcbNeeded As Integer) As Boolean
<DllImport("winspool.drv", EntryPoint:="EnumPrintersA", SetLastError:=True,
CharSet:=CharSet.Unicode, ExactSpelling:=True,
CallingConvention:=CallingConvention.StdCall)> Public Shared Function
EnumPrinters(ByVal flags As Long, ByVal name As String, ByVal Level As Long,
ByVal pPrinterEnum As Byte, ByVal cdBuf As Long, ByVal pcbNeeded As Long,
ByVal pcReturned As Long) As Long
End Function
<DllImport("kernel32", EntryPoint:="lstrcpyA", SetLastError:=True,
CharSet:=CharSet.Unicode, ExactSpelling:=True,
CallingConvention:=CallingConvention.StdCall)> Public Shared Function
lstrcpy(ByVal lpString1 As String, ByVal lpString2 As String) As Long
End Function
<DllImport("winspool.drv", EntryPoint:="ClosePrinter", SetLastError:=True,
CharSet:=CharSet.Unicode, ExactSpelling:=True,
CallingConvention:=CallingConvention.StdCall)> Public Shared Function
ClosePrinter(ByVal hPrinter As IntPtr) As Long
End Function
<DllImport("winspool.drv", EntryPoint:="EnumJobsA", SetLastError:=True,
CharSet:=CharSet.Unicode, ExactSpelling:=True,
CallingConvention:=CallingConvention.StdCall)> Public Shared Function
EnumJobs(ByVal hPrinter As IntPtr, ByRef FirstJob As Long, ByVal NoJobs As
Long, ByVal Level As Long, ByRef pJob As Byte, ByRef cdBuf As Long, ByVal
pcbNeeded As Long, ByVal pcReturned As Long) As Long
End Function
Declare Function OpenPrinter Lib "winspool.drv" Alias "OpenPrinterA" (ByVal
pPrinterName As String, ByRef phPrinter As IntPtr,
<MarshalAsAttribute(UnmanagedType.AsAny)> ByVal o1 As Object) As Long
End Class
Wat me al onmiddellijk opvalt, is dat er nog "Long" declaraties zijn ... ik
dacht dat dit in .NET sowieso "Integer" aka "Int32" moest zijn?
O ja, ter info: de aanleiding van dit probleem is een ander probleem (zie
andere thread), nl. het feit dat de win32_printer noch win32_printjob WMI
classes niet cluster-aware (MSCS) zijn :-(
Thanks,
--
SLE
Technical Details
Message-ID:
<3xB5b.18770$cb3.818313@phobos.telenet-ops.be>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-08!supernews.com!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!aotearoa.belnet.be!news.belnet.be!ossa.telenet-ops.be!phobos.telenet-ops.be.POSTED!not-for-mailReferences:
<_hn5b.17396$Cq2.685084@phobos.telenet-ops.be> <1062621693.257394@seven.kulnet.kuleuven.ac.be>Show Full Headers
Complete Article Headers
X-Google-Language: DUTCH,ASCII X-Google-Thread: fcea4,4b159b75c9d6aa36 X-Google-Attributes: gidfcea4,public X-Google-ArrivalTime: 2003-09-04 00:07:46 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-08!supernews.com!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!aotearoa.belnet.be!news.belnet.be!ossa.telenet-ops.be!phobos.telenet-ops.be.POSTED!not-for-mail From: "SLE" <info@NOSPAMproit.be> Newsgroups: be.comp.programming References: <_hn5b.17396$Cq2.685084@phobos.telenet-ops.be> <1062621693.257394@seven.kulnet.kuleuven.ac.be> Subject: Re: VB.NET & EnumJobs() Lines: 74 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Message-ID: <3xB5b.18770$cb3.818313@phobos.telenet-ops.be> Date: Thu, 04 Sep 2003 07:07:43 GMT NNTP-Posting-Host: 213.224.120.142 X-Complaints-To: abuse@telenet.be X-Trace: phobos.telenet-ops.be 1062659263 213.224.120.142 (Thu, 04 Sep 2003 09:07:43 MEST) NNTP-Posting-Date: Thu, 04 Sep 2003 09:07:43 MEST Organization: Telenet Internet