G
Guest
Hi al
I have an interesting question.... I am working witha Win API this is the Function
Public Declare Function EnumJobs Lib "winspool.drv" Alias "EnumJobsA" (ByVal hPrinter As Long, ByVal FirstJob As Long, ByVal NoJobs As Long, ByVal Level As Long, pJob As Byte, ByVal cdBuf As Long, pcbNeeded As Long, pcReturned As Long) As Lon
Which I got from the API viewer that comes with VB 6. I have tried to convert it to the following
[DllImport("winspool.drv")
public static extern long EnumJobs(long hPrinter,long FirstJob,long NoJobs,long Level,ref JOB_INFO_1 jInfo,long cdBuf,long pcbNeeded,long pcReturned )
however i think I may have gotten a few things wrong, which I am hoping someone will be able to correct me
1. In the Declare statement there is a parameter that is : pJob As Byte and I've even seen it as : pJob As An
Now my question is that can I pass my struct(JOB_INFO_1) in there? even though the datatype it wants is byte, can I still pass the struct in there? How do i get my struct popultaed from this call, when it accepts a byte? do i need to do anything with how I created my strcut, this is my sample code of the strcut declaration
[StructLayout(LayoutKind.Sequential)
public struct JOB_INFO_1
public long JobId
public string pPrinterName
public string pMachineName
public string pUserName;
public string pDocument;
public string pDatatype;
public string pStatus;
public long Status;
public long Priority
public long Position;
public long TotalPages;
public long PagesPrinted;
public SYSTEMTIME Submitted
[StructLayout(LayoutKind.Sequential)
public struct SYSTEMTIM
public int wYear
public int wMonth
public int wDayOfWeek
public int wDay
public int wHour
public int wMinute
public int wSecond
public int wMilliseconds
2. If ever I see another winAPI that accepts a datatype of "Any" what do I know what is "supposed to get there"
Thanks for any hel
Kevi
I have an interesting question.... I am working witha Win API this is the Function
Public Declare Function EnumJobs Lib "winspool.drv" Alias "EnumJobsA" (ByVal hPrinter As Long, ByVal FirstJob As Long, ByVal NoJobs As Long, ByVal Level As Long, pJob As Byte, ByVal cdBuf As Long, pcbNeeded As Long, pcReturned As Long) As Lon
Which I got from the API viewer that comes with VB 6. I have tried to convert it to the following
[DllImport("winspool.drv")
public static extern long EnumJobs(long hPrinter,long FirstJob,long NoJobs,long Level,ref JOB_INFO_1 jInfo,long cdBuf,long pcbNeeded,long pcReturned )
however i think I may have gotten a few things wrong, which I am hoping someone will be able to correct me
1. In the Declare statement there is a parameter that is : pJob As Byte and I've even seen it as : pJob As An
Now my question is that can I pass my struct(JOB_INFO_1) in there? even though the datatype it wants is byte, can I still pass the struct in there? How do i get my struct popultaed from this call, when it accepts a byte? do i need to do anything with how I created my strcut, this is my sample code of the strcut declaration
[StructLayout(LayoutKind.Sequential)
public struct JOB_INFO_1
public long JobId
public string pPrinterName
public string pMachineName
public string pUserName;
public string pDocument;
public string pDatatype;
public string pStatus;
public long Status;
public long Priority
public long Position;
public long TotalPages;
public long PagesPrinted;
public SYSTEMTIME Submitted
[StructLayout(LayoutKind.Sequential)
public struct SYSTEMTIM
public int wYear
public int wMonth
public int wDayOfWeek
public int wDay
public int wHour
public int wMinute
public int wSecond
public int wMilliseconds
2. If ever I see another winAPI that accepts a datatype of "Any" what do I know what is "supposed to get there"
Thanks for any hel
Kevi