I'm having a problem calling a function so to prove that I have the module figured out (granted I'm a novice PERL gent) I put two functions in the following code. The first one works, the second function call works but the return code is not what I am expecting "0" and I could get a -1 or -2. What I am getting for a return code is 1949630464 which really baffles me....
Thanks for the suggestion BrowserUK, I cleaned up the code, unfortunatly still no luck.
use Win32::API;
use strict;
use warnings "all";
# MessageBox API - Reference: http://msdn2.microsoft.com/en-us/libra
+ry/ms712455.aspx
# int MessageBox(
# HWND hWnd,
# LPCTSTR lpText,
# LPCTSTR lpCaption,
# UINT uType
# );
my $hwndOwner = 0;
my $LpszText = "Message Box Text";
my $LpszTitle = "Message Box Title";
my $uStyle = 0; #define MB_OKCANCEL 0x00000001L
my $fnMessageBox = new Win32::API("user32", "MessageBox", 'NPPN', 'I')
+;
my $call1ret = $fnMessageBox->Call($hwndOwner, $LpszText, $LpszTitle,
+$uStyle);
print "MessageBox Return Code: ".$call1ret."\n";
# SQLAllocHandle API - Reference: http://msdn2.microsoft.com/en-us/l
+ibrary/ms712455.aspx
# SQLRETURN SQLAllocHandle(
# SQLSMALLINT HandleType,
# SQLHANDLE InputHandle,
# SQLHANDLE * OutputHandlePtr);
my $HandleType = 1;
my $InputHandle = 0;
my $OutputHandlePtr = '';
my $fnSQLAllocHandle = new Win32::API("odbc32", "SQLAllocHandle", 'PPP
+', 'I');
my $call2ret = $fnSQLAllocHandle->Call($HandleType, $InputHandle, $Out
+putHandlePtr);
print "?? ".$^E."\n\n";
print "SQLAllocHandle Return Code: ".$call2ret."\n";
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.