in reply to Re^2: Win32::API - How to call an Imported function with Win32::API::Types ?
in thread Win32::API - How to call an Imported function with Win32::API::Types ?

I suspect that the problem is that TCHAR is not a type that Win32::API::Type knows about. You can find the list of those that it does know about at the bottom of the Type.pm source file.

You probably need to change

Win32::API::Type->typedef( 'OMDTEXTZ', 'TCHAR');

to something like

Win32::API::Type->typedef( 'OMDTEXTZ', 'unsigned char') or die $^E;

However, if you were to add some error checking to your calls (as above and in my original snippet. E.g. ...or die $^E;), then the module would be telling you what is wrong and where.


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"Think for yourself!" - Abigail
"Memory, processor, disk in that order on the hardware side. Algorithm, algoritm, algorithm on the code side." - tachyon

Replies are listed 'Best First'.
Re^4: Win32::API - How to call an Imported function with Win32::API::Types ?
by fx (Pilgrim) on Jul 02, 2004 at 11:24 UTC

    According to the source, TCHAR is a valid type which is why I chose it. Hmm...

    As you suggest, I shall put lots of error checking in and see what isn't being liked.

    Thanks,

    fx, Infinity is Colourless

      Ok, I've just added ...or die $^E to every Win32::API module call and nothing is die'ing. As far as I can see the call to the function inside the DLL is actually working

      Hmm...

      fx, Infinity is Colourless

        Try initializing my $client = pack('L', 0); as you did in the code that worked.


        Examine what is said, not who speaks.
        "Efficiency is intelligent laziness." -David Dunham
        "Think for yourself!" - Abigail
        "Memory, processor, disk in that order on the hardware side. Algorithm, algoritm, algorithm on the code side." - tachyon