PictureBox and cards.dll 
Author Message
 PictureBox and cards.dll

I'm using VB.NET and want to use cards.dll (32-bit version) to render cards
onto various PictureBox controls.

I'm having a{*filter*}ens of a time getting a device context from a PictureBox in
order to make the DLL call work. I tried to use the API call GetDC using the
PictureBox .Handle property, but that didn't work.

Any advice as to how to get a DC for a PictureBox would be greatly
appreciated!
Declare Function GetDC Lib "user32" (ByVal hwnd As IntPtr) As Long

Declare Function cdtDraw Lib "Cards32.Dll" (ByVal hdc As Long, ByVal X As
Long, ByVal Y As Long, ByVal cardValue As Long, ByVal cardSuit As Long,
ByVal rgbColor As Long) As Boolean

...

cdtDraw(GetDC(pbxCPUCard1.Handle), 0, 0, CardBack, CPU.Hand(0).Suit, 0) <-
does nothing



Fri, 25 Feb 2005 05:07:05 GMT  
 PictureBox and cards.dll
Hello Adam,

    The long data in VB6 is equivalent to integer in VB.NET.

In VB6 was:
    Public Declare Function GetDC Lib "user32" Alias "GetDC" (ByVal hwnd As
Long) As Long

In VB.NET I think it could:
    Public Declare Function GetDC Lib "user32" Alias "GetDC" (ByVal hwnd As
integer) As integer

In the cdtDraw you have to do the same operation....change then long type
for integer type.

Regards,



Quote:
> I'm using VB.NET and want to use cards.dll (32-bit version) to render
cards
> onto various PictureBox controls.

> I'm having a{*filter*}ens of a time getting a device context from a PictureBox
in
> order to make the DLL call work. I tried to use the API call GetDC using
the
> PictureBox .Handle property, but that didn't work.

> Any advice as to how to get a DC for a PictureBox would be greatly
> appreciated!
> Declare Function GetDC Lib "user32" (ByVal hwnd As IntPtr) As Long

> Declare Function cdtDraw Lib "Cards32.Dll" (ByVal hdc As Long, ByVal X As
> Long, ByVal Y As Long, ByVal cardValue As Long, ByVal cardSuit As Long,
> ByVal rgbColor As Long) As Boolean

> ...

> cdtDraw(GetDC(pbxCPUCard1.Handle), 0, 0, CardBack, CPU.Hand(0).Suit, 0) <-
> does nothing



Fri, 25 Feb 2005 05:38:56 GMT  
 PictureBox and cards.dll

Would that be IntPtr as opposed to Integer?

Quote:
>     The long data in VB6 is equivalent to integer in VB.NET.

> In VB6 was:
>     Public Declare Function GetDC Lib "user32" Alias "GetDC" (ByVal hwnd
As
> Long) As Long

> In VB.NET I think it could:
>     Public Declare Function GetDC Lib "user32" Alias "GetDC" (ByVal hwnd
As
> integer) As integer

> In the cdtDraw you have to do the same operation....change then long type
> for integer type.



Fri, 25 Feb 2005 07:32:46 GMT  
 PictureBox and cards.dll

    I see more clear use Integer but you can use IntPtr too....Did you fix
your problem?

Regards,



Quote:

> Would that be IntPtr as opposed to Integer?

> >     The long data in VB6 is equivalent to integer in VB.NET.

> > In VB6 was:
> >     Public Declare Function GetDC Lib "user32" Alias "GetDC" (ByVal hwnd
> As
> > Long) As Long

> > In VB.NET I think it could:
> >     Public Declare Function GetDC Lib "user32" Alias "GetDC" (ByVal hwnd
> As
> > integer) As integer

> > In the cdtDraw you have to do the same operation....change then long
type
> > for integer type.



Sat, 26 Feb 2005 01:47:22 GMT  
 PictureBox and cards.dll

Yes, thank you. I am able to draw onto the PictureBox controls.

Now what I have to do is figure out a way to selectively override the
Paint() event such that if the user minimizes or covers over the form, the
cards redraw themselves. This is proving difficult, as the Paint() events
are called at startup when none of the variables in the rest of the program
are defined, leaving me with NullReferenceExceptions all over the place.



Sat, 26 Feb 2005 07:28:25 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. VB.NET, cards.dll, PictureBox

2. VB.NET, cards.dll, PictureBox

3. Drawing cards from cards.dll?

4. CARDS.BAS - VB Declares for CARDS.DLL

5. Access Playing Cards Images (CARDS.DLL)

6. How can I get access to a DLL file, for example CARDS.DLL

7. Cards.dll

8. cards.dll

9. Cards.dll

10. REQ: Need a 32bit DLL or OCX for Playing cards

11. Does anybody know the dll used for useing the cards like in solitare

12. Cards.dll

 

 
Powered by phpBB® Forum Software