Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Tue Nov 12, 2019 9:04 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 12 posts ] 
Author Message
 Post subject: Help!: Cards.dll Works with RB2010r1, Not with RB2010r5
PostPosted: Tue Feb 08, 2011 10:12 am 
Offline

Joined: Fri Sep 30, 2005 1:53 pm
Posts: 914
Location: Philadelphia, PA
Cards.dll works fine with RB2010r1. I can run Aaron Ballman's "War" game program and my "CardTrick" program (which I wrote based on his article) with NO problems.

NEITHER of them, however, works with RB2010r5, which presumably means that Cards.dll does not work with RB2010r5 (or vice versa).

Since Aaron's "War" game program and my "CardTrick" program have NOT changed, apparently something in REALbasic HAS changed between RB2010r1 and RB2010r5.

Has anyone here found a way to use Cards.dll with RB2010r5? Is a"fix" available?

Barry Traver


Top
 Profile  
Reply with quote  
 Post subject: Re: Help!: Cards.dll Works with RB2010r1, Not with RB2010r5
PostPosted: Wed Feb 09, 2011 6:33 am 
Offline

Joined: Fri Sep 30, 2005 1:53 pm
Posts: 914
Location: Philadelphia, PA
I did more testing (I installed more versions of REALbasic), and I found that Cards.dll works with RB2010r4-1 but not RB2010r5.

So it looks like the reason why Cards.dll no longer works with RB lies in changes made between RB2010r4-1 and RB2010r5.

Does anyone have any advice on whether the problem can be fixed (and how to fix it?)?

Barry Traver


Top
 Profile  
Reply with quote  
 Post subject: Re: Help!: Cards.dll Works with RB2010r1, Not with RB2010r5
PostPosted: Wed Feb 09, 2011 12:18 pm 
Offline

Joined: Fri Jan 06, 2006 3:21 pm
Posts: 12388
Location: Portland, OR USA
Can you post some simple code that demonstrates the issue? Can you narrow it down? Is the problem in the declare call or somewhere else, like converting the results to a picture?


Top
 Profile  
Reply with quote  
 Post subject: Re: Help!: Cards.dll Works with RB2010r1, Not with RB2010r5
PostPosted: Thu Feb 10, 2011 2:51 am 
Offline

Joined: Fri Sep 30, 2005 1:53 pm
Posts: 914
Location: Philadelphia, PA
Aaron Ballman's "War" card game program can be found here:

http://www.aaronballman.com/programming/REALbasic/Cards.rbp

Here's what happens if you load it into RB2010r51 and try to run it:

You get a message titled "Resolve Project Issues."

Under "Name," you have WarWindow.OpponentScore, WarWindow.PlayerScore, and WarWindow.WhoWon.

Under "Type" you have ControlSuper.

You have the message "This control is based on a deprecated class. It is recommended that you update this.

I clicked on "Check All," "Resolve," and "Close." Then I tried to run the program and got this message titled "Error":

"An error has occurred while compiling this project.
Message: Declares directly into the runtime via lib "" no longer are allowed.
File: Office
Location: Hacks.HDCFromGraphics
Code:" [No code given.]

I hope this makes more sense to others here than it does to me.

Barry Traver


Top
 Profile  
Reply with quote  
 Post subject: Re: Help!: Cards.dll Works with RB2010r1, Not with RB2010r5
PostPosted: Thu Feb 10, 2011 3:03 am 
Offline

Joined: Fri Jan 06, 2006 3:21 pm
Posts: 12388
Location: Portland, OR USA
OK, that has nothing to do with Cards.dll. You used to be able to "declare" into the RB framework itself and get access directly into the framework code. That is no longer legal. I haven't looked at the code in your link to see what he was using, but there should be another way to do the same thing without the bad declare.


Top
 Profile  
Reply with quote  
 Post subject: Re: Help!: Cards.dll Works with RB2010r1, Not with RB2010r5
PostPosted: Thu Feb 10, 2011 3:19 am 
Offline

Joined: Fri Jan 06, 2006 3:21 pm
Posts: 12388
Location: Portland, OR USA
The offending code is in an encrypted module named "Hacks". It appears to be trying to convert a graphics object into an HDC. I don't know what the best replacement for that code would be.


Top
 Profile  
Reply with quote  
 Post subject: Re: Help!: Cards.dll Works with RB2010r1, Not with RB2010r5
PostPosted: Thu Feb 10, 2011 3:35 am 
Offline

Joined: Fri Sep 30, 2005 1:53 pm
Posts: 914
Location: Philadelphia, PA
Here, in case they're of help, are Aaron's comments:

"The hdc as Integer parameter is going to be explained away with a lot of hand-waving. REALbasic does not expose a way for you to get a device context (also know as an HDC) from a Graphics object, even though it internally has a reference to one. Plugin authors have a way to get access to this information, and so it's entirely feasible to get it via a plugin. I've abstracted this functionality away in a protected Module called Hacks. You don't need to concern yourself with how I wrangle the HDC out of a Graphics object -- I just wanted to make sure this project relied on no third party plugins."

But maybe there IS a need to concern ourselves with how he "wrangles" the HDC out of a Graphics object....

Barry Traver


Top
 Profile  
Reply with quote  
 Post subject: Re: Help!: Cards.dll Works with RB2010r1, Not with RB2010r5
PostPosted: Thu Feb 10, 2011 3:48 am 
Offline

Joined: Fri Sep 30, 2005 1:53 pm
Posts: 914
Location: Philadelphia, PA
Here's where you can find Aaron's comments:

http://www.aaronballman.com/programming/REALbasic/Cards.php

Barry Traver


Top
 Profile  
Reply with quote  
 Post subject: Re: Help!: Cards.dll Works with RB2010r1, Not with RB2010r5
PostPosted: Thu Feb 10, 2011 11:24 am 
Offline

Joined: Fri Sep 30, 2005 1:53 pm
Posts: 914
Location: Philadelphia, PA
The following is from a note to me from Aaron Ballman (thanks, Aaron!):

"On Thu, Feb 10, 2011 at 2:46 AM, Barry Traver <barrytraver@gmail.com> wrote:
> But maybe there IS a need to concern ourselves with how you "wrangle" the
> HDC out of a Graphics object....
>
> That's where the error occurs, according to the error message:
>
> "ERROR....
> "File: Office
> Location: Hacks.HDCFromGraphics"
>
> But, if the Hacks module needs to be changed, how can we get to look at the
> Hacks module? Can RS help with that??

They can't, but you could look in the code for HDCFromGraphics and
replace it with a call to .Handle on your graphics object (there's an
enumeration member to pass in as well, but I forget what it is. That
should solve the problem for you.

Good catch!

~Aaron"

Can anyone here help me take it from there? (Things like .Handle, enumeration number, etc. are beyond my knowledge at the present time.)

Barry Traver


Top
 Profile  
Reply with quote  
 Post subject: Re: Help!: Cards.dll Works with RB2010r1, Not with RB2010r5
PostPosted: Thu Feb 10, 2011 1:21 pm 
Offline

Joined: Fri Jan 06, 2006 3:21 pm
Posts: 12388
Location: Portland, OR USA
Ah, ok. Replace the calls to Hacks.HDCFromGraphics to <graphicsobject>.Handle(Graphics.HandleTypeHDC). Eg.,
Draw( Hacks.HDCFromGraphics( g ), x, y, CardNumber, kDrawModeFaceUp )

becomes
Draw(g.Handle(Graphics.HandleTypeHDC), x, y, CardNumber, kDrawModeFaceUp)


Top
 Profile  
Reply with quote  
 Post subject: Re: Help!: Cards.dll Works with RB2010r1, Not with RB2010r5
PostPosted: Sat Feb 12, 2011 1:24 am 
Offline

Joined: Fri Sep 30, 2005 1:53 pm
Posts: 914
Location: Philadelphia, PA
Tim,

I think I've gone as far as I can go. I tried to do what you said, but I think I've come to the limits of what I know how to do. I'm not sure of exactly what changes I should be making in Aaron's "War" program. (Or maybe it's just late and my brain is not working up to par.)

Here's where Aaron's "War" program can be downloaded for anyone who wants to take it from here:

http://aaronballman.com/programming/REALbasic/Cards.rbp

And here are his comments on Cards.dll:

http://aaronballman.com/programming/REALbasic/Cards.php

I think at this point I'll let someone with more knowledge than I have finish up the job. (I would hope that I'm not the only person here who has an interest in using Cards.dll. If, however, no one volunteers to take things any further, there is still one option open for card game programs: use RB2010r41 rather than RB2010r5 or later. (Or maybe just use RB2010r1, where there is still access to the Language Reference in PDF format.)

Barry Traver


Top
 Profile  
Reply with quote  
 Post subject: Re: Help!: Cards.dll Works with RB2010r1, Not with RB2010r5
PostPosted: Sat Feb 12, 2011 4:13 am 
Offline

Joined: Fri Jan 06, 2006 3:21 pm
Posts: 12388
Location: Portland, OR USA
I removed the Hacks module and replaced it with a new Hacks module where I added a single method:
Function HDCFromGraphics(g as graphics) As integer
return g.handle(Graphics.HandleTypeHDC)
End Function


It ran fine on my windows XP box. On my 64 bit windows 7 box, it did not show any card graphics.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group