Re: Help on Win32 API
- From: "Mumia W." <paduille.4061.mumia.w+nospam@xxxxxxxxxxxxx>
- Date: Wed, 20 Jun 2007 22:22:54 GMT
On 06/20/2007 11:25 AM, jis wrote:
On Jun 20, 10:44 am, "Mumia W." <paduille.4061.mumia.w
+nos...@xxxxxxxxxxxxx> wrote:
On 06/20/2007 08:53 AM, jis wrote:
Hi,I don't have access to a Windows computer, but I was able to download
I have a dll by name AduHid.dll.
There is a function with prototype
void * _stdcall OpenAduDeviceBySerialNumber(const char*
psSerialNUmber,unsigned long iTimeout);
I used the following perl code to call the above function
use Win32::API;
my $function = Win32::API->new(
'AduHid.dll','int OpenAduDeviceBySerialNumber(const
char* psSerialNUmber,unsigned long iTimeout)' );
my $return = $function->Call("A03744",0);
But i get an error
1. unknown parameter type const and unsigned
2. Argument A03744 isnt numeric in subroutine entry.
I tried removing const and unsigned.Then I got an error
"Modification of read only value attempted".
Where am i going wrong?
Please advise.
regards,
jis
the CPAN source for Win32::API. Read the POD for Win32::API::Types. It
says you should examine the __DATA__ section of Win32/API/Types.pm to
see a list of supported types.
You might need to specify a prototype like this:
int OpenAduDeviceBySerialNumber(PCHAR psSerialNUmber, ULONG iTimeout)
I hope this helps some.- Hide quoted text -
- Show quoted text -
Thanks for the quick reply.
It took away errors that were there.But came up with an error
"Modification of read only value attempted"
Only time it gave away the error was when i tried
int OpenAduDeviceBySerialNumber(CHAR psSerialNumber[],ULONG
iTimeout)
Unfortunately this time the code crashed with "the memory could not be
read"
Anyway it took me a step ahead.
regards,
jis
Try to keep the conversation in the newsgroup.
"Const char*" tells me that psSerialNUmber is a pointer to characters, so either PCHAR or LPCHAR should be used for that parameter. Note: it's been years since I've had to program for Windows in C, so I may not remember everything exactly, but I think LPCHAR is what you're looking for.
Also, Win32::API probably doesn't recognize the [] because Win32::API is not a C compiler.
int OpenAduDeviceBySerialNumber(LPCHAR psSerialNumber,ULONG
iTimeout)
---or even---
int OpenAduDeviceBySerialNumber(LPCHAR,ULONG)
.
- Follow-Ups:
- Re: Help on Win32 API
- From: jis
- Re: Help on Win32 API
- References:
- Help on Win32 API
- From: jis
- Re: Help on Win32 API
- From: Mumia W.
- Help on Win32 API
- Prev by Date: Re: Spread***::Read 0.20
- Next by Date: Re: Help on Win32 API
- Previous by thread: Re: Help on Win32 API
- Next by thread: Re: Help on Win32 API
- Index(es):