Ok, the software is a 2d barcode (data matrix) encoder created by IDAutomation. http://www.idautomation.com/datamatrixfaq.html
the paramaters that the routine expects are DataToEncode, ProcessTilde, EncodingMode, PreferredFormat, Result
it should also then return an encoded string that can then be used to generate a 2d barcode font.
Thanks
Dan
| [reply] [d/l] [select] |
Hi Ive been in touch with the vendor, and they confirm that both the dll and the function are correct,the paramaters are
string,numeric,numeric,numeric,string
so my amended code now looks like this, however I still get the same error ('Cant call method "Call" on an undefined value at line 12'), am I doing some thing wrong, or should I just learn VB so I can use the vendor example...
use Win32::API;
my $DataToEncode = "Test1 Test2 Test3";
my $return_sring = undef;
use Win32::API;
$function = Win32::API->new(
'IDAutomationDMATRIX6', 'FontEncode',['P','N','N','N','P']
);
my $string = $function->Call('FontEncode');
Thanks
| [reply] [d/l] |
use Win32::API;
my $DataToEncode = "Test1 Test2 Test3";
my $return_sring = undef;
use Win32::API;
$function = Win32::API->new(
'IDAutomationDMATRIX6', 'FontEncode',['P','N','N','N','P']
);
my $string = $function->Call('FontEncode');
There are still some inconsistencies in the above code - and these inconsistencies may be preventing the thing from working (there might also be Win32::API bugs that mean it's never gunna work anyway).
I think you still need to specify the return type in new:
$function = Win32::API->new(
'IDAutomationDMATRIX6', 'FontEncode',['P','N','N','N','P'], 'P'
);
You could also try the 2 following renditions:
$function = Win32::API->new(
'IDAutomationDMATRIX6', 'FontEncode',['P','N','N','N','P'], 'P',
+ '_cdecl'
);
and
$function = Win32::API->new(
'IDAutomationDMATRIX6', 'FontEncode',['P','N','N','N','P'], 'P',
+ '__stdcall'
);
Since FontEncode takes 5 arguments, Call() also needs to be given 5 arguments - a string, an int, an int, an int, and a string (in that order):
my $string = $function->Call($str1, $n1, $n2, $n3, $str2);
Finally, $string may need to be large enough to accommodate the return string:
my $string = '' x 500; # Big enough ?
$string = $function->Call($str1, $n1, $n2, $n3, $str2);
Without access to the dll it's hard to provide good assistance. If you can't get anywhere with it using Win32::API, then VB might be your best approach.
XS/Inline::C would also be options - and they provide excellent milage. I far prefer Inline::C over Win32::API, any day. However, for that to be an option, you also need the relevant header (.h) file and import lib (.lib) - as well as a Microsoft C compiler. (Actually, MinGW usually works fine, too - and doesn't even need the import lib. But I don't think you can use MinGW where COM is involved.)
Cheers, Rob | [reply] [d/l] [select] |