Re: Help on Win32 API
- From: jis <jismagic@xxxxxxxxx>
- Date: Wed, 20 Jun 2007 16:10:20 -0700
On Jun 20, 5:22 pm, "Mumia W." <paduille.4061.mumia.w
+nos...@xxxxxxxxxxxxx> wrote:
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 followingperlcode to call the above function
useWin32::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 anerror
1. unknown parameter type const and unsigned
2. Argument A03744 isnt numeric in subroutine entry.
I tried removing const and unsigned.Then I got anerror
"Modification of read only value attempted".
Where am i going wrong?
Please advise.
regards,
jis
the CPAN source forWin32::API. Read the POD forWin32::API::Types. It
says you should examine the __DATA__ section ofWin32/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 anerror
"Modification of read only value attempted"
Only time it gave away theerrorwas 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::APIprobably doesn't recognize the [] becauseWin32::APIis
not a C compiler.
int OpenAduDeviceBySerialNumber(LPCHAR psSerialNumber,ULONG
iTimeout)
---or even---
int OpenAduDeviceBySerialNumber(LPCHAR,ULONG)- Hide quoted text -
- Show quoted text -
Thanks for the reply.
i tried like
use Win32::API;
my $function = Win32::API->new(
'AduHid.dll','OpenAduDeviceBySerialNumber',PN,N );
my $return = $function->Call("A02365",0);
print $return;
it goes without any errors.But i always get the result 1952.
I have got another function.
void * _stdcall OpenAduDevice(unsigned long iTimeout);
which i tried with the following perl function.
use strict;
use warnings;
use Win32::API;
my $function = Win32::API->new(
'AduHid.dll', 'int OpenAduDevice(ULONG iTimeout)');
$result= $function->Call(0);
print $result;
I always get the result 1952. I tried the same code in Visual
Basic ,it works fine.
Any idea what 1952 is?
Even i tried the following code
use strict;
use warnings;
use Win32::API;
my $function = Win32::API->new(
'AduHid.dll', 'OpenAduDevice',N,N);
$result= $function->Call(0);
print $result;
It still always give me 1952.
Any ideas??
regards,
jis
.
- Follow-Ups:
- Re: Help on Win32 API
- From: Sisyphus
- Re: Help on Win32 API
- References:
- Help on Win32 API
- From: jis
- Re: Help on Win32 API
- From: Mumia W.
- Re: Help on Win32 API
- From: Mumia W.
- Help on Win32 API
- Prev by Date: Re: Help on Win32 API
- 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):
Relevant Pages
|