Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Using Win32::Resource

by PrimeLord (Pilgrim)
on Feb 15, 2005 at 21:16 UTC ( [id://431332]=perlquestion: print w/replies, xml ) Need Help??

PrimeLord has asked for the wisdom of the Perl Monks concerning the following question:

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

Replies are listed 'Best First'.
Re: Using Win32::Resource
by NetWallah (Canon) on Feb 15, 2005 at 22:54 UTC
    instead of "print $data", try this:
    use Data::Dumper; print Dumper \$data;

        ..."I don't know what the facts are but somebody's certainly going to sit down with him and find out what he knows that they may not know, and make sure he knows what they know that he may not know, and that's a good thing. I think it's a very constructive exchange," --Donald Rumsfeld

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://431332]
Approved by Arunbear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (5)
As of 2024-03-28 20:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found