I recently posted a question about accessing a .dll file to retreive some resource information. One of the suggestions for that was to look at
Win32::Resources. I have taken a look at that module, but I am confused on how to access the data I need. Here is the sample code I have tried to use.
use strict;
use Win32::Resources;
my $filename = "C:/path/to/file.dll";
my $data = Win32::Resources::LoadResource(
filename => $filename,
type => 'STRING',
name => '1',
language => '0'
);
print "$data\n";
The .dll file I am trying to access has 43 resource entries that are structured like the following:
STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
{
1, "foo"
2, "faz"
3, "far"
4, "bar"
5, "baz"
6, "boo"
7, "abc"
8, "def"
9, "ghi"
10, "jkl"
11, "mno"
12, "pqr"
13, "stu"
14, "vwx"
15, "yz1"
}
When I change the name field in my code between 1-43 $data has data written to it. When I go above 43 it is uninitialized. So it seems that the data I am looking for is getting written into $data. However when I print $data it seems to be just garbled data. Not the text information I was looking for. I am sure I am missing something easy, but from the module documentation i was not able to determine what it is. Any suggestions?
Thanks!
-Prime
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.