Excel and DecodeIR.dll

If you're not a JP1 user, but would like help from the JP1 experts, post your question here.

Moderator: Moderators

Mr Mod
Posts: 19
Joined: Wed Oct 27, 2004 8:23 am

Excel and DecodeIR.dll

Post by Mr Mod »

I am looking at using the DecodeIR dll with excel, has anyone had any experience of using these 2 together to decode a pronto long hex code in a cell and giving the result into another cell.
I know there will most likely be some VBA code to do this.
And help would be appreciated.
The Robman
Site Owner
Posts: 21886
Joined: Fri Aug 01, 2003 9:37 am
Location: Chicago, IL
Contact:

Post by The Robman »

I don't know how to link the two together, but if all you want to do is decode some pronto hex, you can use IR.exe to do that now. You can also use IRTool as well.
Rob
www.hifi-remote.com
Please don't PM me with remote questions, post them in the forums so all the experts can help!
Mr Mod
Posts: 19
Joined: Wed Oct 27, 2004 8:23 am

Post by Mr Mod »

What i am trying to achieve is to update the master list of Sony codes to include the Sony PC programmable remote codes and their CIS controller codes.
If i can get the result from decode IR it would be an easy way to create them in the right format.
This was a thought i had last night, if it cant be done then its not a real problem.

The master list of Sony codes appears on remote central but has not been updated in years, and with the codes that are on this site i wanted to create just a single place with all the conversions all ready done.
vickyg2003
Site Admin
Posts: 7104
Joined: Sat Mar 20, 2004 12:19 pm
Location: Florida
Contact:

Post by vickyg2003 »

Mr Mod wrote:What i am trying to achieve is to update the master list of Sony codes to include the Sony PC programmable remote codes and their CIS controller codes.
If i can get the result from decode IR it would be an easy way to create them in the right format.
This was a thought i had last night, if it cant be done then its not a real problem.

The master list of Sony codes appears on remote central but has not been updated in years, and with the codes that are on this site i wanted to create just a single place with all the conversions all ready done.
I don't really understand what you are trying to do here. However, before Graham did added all those wonderful features to IRSCope, ElizabethD and I were both working on ways to call decodeIR from our own apps. Elizabeth was calling it from Excel, so hopefully she'll see this post and chime in.

You might want to look at some of the other tools we have here too.
Remember to provide feedback to let us know how the problem was solved and share your upgrades.

Tip: When creating an upgrade, always include ALL functions from the oem remote, even if you never plan on assigning them to a button. Complete function lists makes an upgrade more helpful to others.
mdavej
Expert
Posts: 4631
Joined: Wed Oct 08, 2003 7:08 am

Post by mdavej »

Are you aware of THIS list of sony codes hosted right here? I don't know if it has the codes you need or not.
Mr Mod
Posts: 19
Joined: Wed Oct 27, 2004 8:23 am

Post by Mr Mod »

I am aware of those codes, i have been over the past few years been keeping "the Keeper" with regular updates to them. I have another heap of them to send to Rob at the moment.
This is just something i had been meaning to look at for some time never having time.
I have been past few weeks trying to learn VBA and VB6 as i have plenty of time on my hands at the moment to learn some things.
mdavej
Expert
Posts: 4631
Joined: Wed Oct 08, 2003 7:08 am

Post by mdavej »

I'm not having any luck adding DecodeIR as a reference in VBA. Anybody know if it's even possible?
3FG
Expert
Posts: 3434
Joined: Mon May 18, 2009 11:48 pm

Post by 3FG »

DLLs which are written in C or C++ push arguments onto the stack in a different order than VBA expects, and cleans up the stack after the call differently. I was able to use jp12serial.dll with Excel by writing a wrapper dll in C/C++ and explicitly set the wrapper function calls to use the Pascal calling convention.

If Mr. Mod hasn't found a solution in the next couple of days, I'll endeavor to write a wrapper for DecodeIR.dll

Edited to Add:
But don't you really want ExchangeIR.dll? I don't think DecodeIR.dll does anything with Pronto Hex without preprocessing it into burst pairs.
mathdon
Expert
Posts: 4726
Joined: Tue Jul 22, 2008 8:53 am
Location: Cambridge, UK

Post by mathdon »

3FG wrote:But don't you really want ExchangeIR.dll? I don't think DecodeIR.dll does anything with Pronto Hex without preprocessing it into burst pairs.
You are right. He needs both. ExchangeIR can convert the Pronto to burst pairs that can then serve as input to DecodeIR. If he also needs a DLL wrapper to change the calling convention, it would make sense to have that wrapper combine ExchangeIR.dll and DecodeIR.dll calls to give the functionality he needs.
Graham
The Robman
Site Owner
Posts: 21886
Joined: Fri Aug 01, 2003 9:37 am
Location: Chicago, IL
Contact:

Post by The Robman »

Mr Mod wrote:What i am trying to achieve is to update the master list of Sony codes to include the Sony PC programmable remote codes and their CIS controller codes.
If i can get the result from decode IR it would be an easy way to create them in the right format.
This was a thought i had last night, if it cant be done then its not a real problem.

The master list of Sony codes appears on remote central but has not been updated in years, and with the codes that are on this site i wanted to create just a single place with all the conversions all ready done.
Could you post a link to the particular list of codes that you want to decode.

The Sony format is simple enough that it would be easier to do the decode in Excel itself rather than trying to call Exchange.dll from Excel.
Rob
www.hifi-remote.com
Please don't PM me with remote questions, post them in the forums so all the experts can help!
The Robman
Site Owner
Posts: 21886
Joined: Fri Aug 01, 2003 9:37 am
Location: Chicago, IL
Contact:

Post by The Robman »

If you're referring to this list of Sony discretes at R/C:
http://www.remotecentral.com/cgi-bin/fi ... te&br=sony

The following spreadsheet decodes all of them into Sony codes:
http://www.hifi-remote.com/forums/dload ... le_id=8628
Rob
www.hifi-remote.com
Please don't PM me with remote questions, post them in the forums so all the experts can help!
ElizabethD
Advanced Member
Posts: 2348
Joined: Mon Feb 09, 2004 12:07 pm

Post by ElizabethD »

mdavej wrote:I'm not having any luck adding DecodeIR as a reference in VBA. Anybody know if it's even possible?
Yes it is, or it was long ago. For burst-pair inputs (not pronto) from decodeIR to excel.
Vicky PMd me to take a look here, so I did.
I dusted off some old Excel work I did using DecodeIR data and translating it. I don't understand ANY of it any more.
Reference maker:
Declare Function DecodeTT Lib "DecodeIR" Alias "DecodeIR" (ByRef paiContext As Long, ByRef paiBursts As Long _
, ByVal iFreq As Long, ByVal iSingleBurstCount As Long, ByVal iRepeatBurstCount As Long _
, ByRef psProtocol As Long, ByRef piDevice As Long, ByRef piSubDevice As Long _
, ByRef piOBC As Long, ByRef paiHex As Long _
, ByRef psMisc As Long, ByRef psError As Long) As Long
Declare Function VarPtrArray Lib "MSVBVM60.DLL" Alias "VarPtr" (ByRef numArray() As Any) As Long 'VarPtr,StrPtr,ObjPtr are built in
Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal bytes As Long)
'
Public tya As clsTypeArrays
Other than few notes in plain English I wrote into VBA, such as the need to declare a TYPE which I then played with in a Class module.
'Type is essential for pointers to work, they were flaky since many are pointers to pointers...
'Using class module is NOT essential, but a good thing to learn to use
'durations will be redimensioned based on #values in a signal
'ARRAYS must be in TYPEs, SINGLE VALUES do not have to be in TYPE
'bStrings are three arrays for Protocol, Misc, Error. They have to be byte packed, not Unicode
Private Type typArrays
context(1) As Long
durations() As Long
Hex(3) As Long
bProt(255) As Byte
bMisc(255) As Byte
bError(255) As Byte
End Type
'
Private tya As typArrays
and then setting a zillion type properties for the arrays - few examples:
'Public Property Get GetProtPtr() As Long
GetProtPtr = VarPtr(tya.bProt(0))
End Property
Public Property Get GetProtValue() As String
Dim v As String
v = StrConv(tya.bProt(), vbUnicode)
GetProtValue = Left(v, InStr(1, v, Chr(0)) - 1)
End Property
Public Property Get GetMiscPtr() As Long
GetMiscPtr = VarPtr(tya.bMisc(0))
End Property
... etc etc etc
Problem is I then incorporated it all into a big set of macros and at this point can't make much sense of it.
Liz
Tweeking 8910, HTPro/9811, C7-7800, 6131o, 6131n, AtlasOCAP-1056B01, RCA-RCRP05B and enjoying the ride :)
vickyg2003
Site Admin
Posts: 7104
Joined: Sat Mar 20, 2004 12:19 pm
Location: Florida
Contact:

Post by vickyg2003 »

Elizabeth, Just to jog your memory a little bit on this, I was calling decodeIR.dll from VFP and I gave you the declares VBA, but you figured out how to determine how many times to call decode, because when I did it from within VFP, if I over called it, my computer would crash, hard.

On 3/19/2008 you sent me an email called SUCCESS. Then on 4/16/2008, I had something from you talking about the loop, but the email with the code is gone. By the time I had the time to work on this, Graham had made it so I don't need it anymore, with his changes to IRScope.
Remember to provide feedback to let us know how the problem was solved and share your upgrades.

Tip: When creating an upgrade, always include ALL functions from the oem remote, even if you never plan on assigning them to a button. Complete function lists makes an upgrade more helpful to others.
ElizabethD
Advanced Member
Posts: 2348
Joined: Mon Feb 09, 2004 12:07 pm

Post by ElizabethD »

Vicky, Good question, you just jogged my brain.
Yes, not know ing when to stop was an issue.
There is defiinitely a Protocol=blank which ends things.
But that didn't always work for me. So, since I usually selected some range, I was also counting and enforcing the end that way.
Therefore looping forever was not an issue anymore and most stuff I tried worked fine.
Few scattered notes here and there tell me so.

Also I used it primarily for the timing from IRSA, where I needed to do few replacements for things like "END".

Bottom line, no longer used, no longer needed, abandoned code.
Liz
Tweeking 8910, HTPro/9811, C7-7800, 6131o, 6131n, AtlasOCAP-1056B01, RCA-RCRP05B and enjoying the ride :)
Mr Mod
Posts: 19
Joined: Wed Oct 27, 2004 8:23 am

Post by Mr Mod »

Thank you all for your replies,
I should have been a bit clearer as to what i am trying to do, i want to be able to take and manufacturers code and translate them not just Sony ones. I knew DecodeIR can do it but was not aware of ExchangeIR.

Although i admit i have 1 JP1 remote, i mostly use the Sony PC programmable ones such as the RM-AX1400 and NX7000 remotes. I get quite a fair few requests to provide codes for devices that people can use at remotecentral for these remotes.
So if i could do something in Excell that can do all the translations it would benefit others.
This site seems to have more people with knowledge on the 2 DLL's hence why i came here.

The Sony master list i was refering to was this one, which i have started to update to include the codes at this site.

http://www.remotecentral.com/cgi-bin/fi ... ection.zip
Post Reply