Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / COM / February 2005



Tip: Looking for answers? Try searching our database.

How to convert LPCByte and LPByte into a VB Data Type

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Lookie - 25 Feb 2005 12:19 GMT
Hi Guys, I need to use winscard.dll and hence am declaring the functions that
i need. However, i got stuck in trying to find suitable VB Data types for
LPByte and LPCByte used in SCardTransmit. Any help rendered very much
appreciated.
Ralph - 26 Feb 2005 19:31 GMT
> Hi Guys, I need to use winscard.dll and hence am declaring the functions that
> i need. However, i got stuck in trying to find suitable VB Data types for
> LPByte and LPCByte used in SCardTransmit. Any help rendered very much
> appreciated.

Are you using COM? Or creating an API (functions exported as
_stdcall/winapi)?
What have you tried so far? What errors/problems are you having? VB to C? C
to VB?

VB has a Byte type (unsigned char) which can be passed ByRef, a pointer to
type.

-ralph
Lookie - 26 Feb 2005 04:25 GMT
Hi Ralph. Well i'm declaring the winscard.DLL procedure in my VB project so
i guess that makes it C to VB. I was looking through MSDN's converting C
declarations to VB
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon98/html/vb
condeclaringdllprocedure.asp
)
but it didnt state the declarations i should use for the two data types
LCByte and LPByte. Any help in clearing this one up will really be
appreciated.

Thx

> > Hi Guys, I need to use winscard.dll and hence am declaring the functions
> that
[quoted text clipped - 11 lines]
>
> -ralph
Ralph - 27 Feb 2005 04:54 GMT
> Hi Ralph. Well i'm declaring the winscard.DLL procedure in my VB project so
> i guess that makes it C to VB. I was looking through MSDN's converting C
> declarations to VB

(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon98/ht
ml/vbcondeclaringdllprocedure.asp)
> but it didnt state the declarations i should use for the two data types
> LCByte and LPByte. Any help in clearing this one up will really be
> appreciated.
>
> Thx

Use "ByRef lpByte As Byte
Ralph - 27 Feb 2005 05:51 GMT
> Hi Ralph. Well i'm declaring the winscard.DLL procedure in my VB project so
> i guess that makes it C to VB. I was looking through MSDN's converting C
> declarations to VB

(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon98/ht
ml/vbcondeclaringdllprocedure.asp)
> but it didnt state the declarations i should use for the two data types
> LCByte and LPByte. Any help in clearing this one up will really be
> appreciated.
>
> Thx

I don't have access to wincard at the moment so I can't see the signatures,
but try
     ByRef lpByte As Byte  ' Byte is an 8-bit number
     ByRef lpcByte As Byte

"Constantance" is a concept only known to C, so lpc and lp are the same to
VB.

"ByRef" is the default. All VB variables are 'references' by default. So
ByRef passes a pointer to a 'container'. ByVal would pass the 'value'. So by
committing a bit of heresy...
A C signature of "unsigned char* lpByte;" is a VB signature of  "ByRef
lpByte As Byte".
A C signature of "char cByte;" is a VB signature of "ByVal cByte As Byte".

Note: VB only truly understands the parameter attributes of [in] and [in,
out]. (Well, also [in, retval], but that's another story.) It doesn't
understand [out] by value very well at all, but always gives it a good old
try.

If you don't mind ugly, you can always use ...
    ByRef lpByte As Any and in VB use...
    SomeVar = CByte(lpByte)
<g>

hth
-ralph
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.