亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? api.html

?? WIN32::API for perl dev 5.7
?? HTML
字號:
<HTML>
<HEAD>
<TITLE>Win32::API - Perl Win32 API Import Facility</TITLE>
<LINK REV="made" HREF="mailto:">
</HEAD>

<BODY>

<!-- INDEX BEGIN -->

<UL>

	<LI><A HREF="#NAME">NAME</A></LI>
	<LI><A HREF="#SYNOPSIS">SYNOPSIS</A></LI>
	<LI><A HREF="#ABSTRACT">ABSTRACT</A></LI>
	<LI><A HREF="#CREDITS">CREDITS</A></LI>
	<LI><A HREF="#DESCRIPTION">DESCRIPTION</A></LI>
	<UL>

		<LI><A HREF="#IMPORTING_A_FUNCTION">IMPORTING A FUNCTION</A></LI>
		<LI><A HREF="#CALLING_AN_IMPORTED_FUNCTION">CALLING AN IMPORTED FUNCTION</A></LI>
	</UL>

	<LI><A HREF="#AUTHOR">AUTHOR</A></LI>
</UL>
<!-- INDEX END -->

<HR>
<P>
<H1><A NAME="NAME">NAME</A></H1>
<P>
Win32::API - Perl Win32 API Import Facility

</P>
<P>
<HR>
<H1><A NAME="SYNOPSIS">SYNOPSIS</A></H1>
<P>
<PRE>  use Win32::API;
  $function = new Win32::API(
      $library, $functionname, \@argumenttypes, $returntype,
  );
  $return = $function-&gt;Call(@arguments);
</PRE>
</P>
<P>
<HR>
<H1><A NAME="ABSTRACT">ABSTRACT</A></H1>
<P>
With this module you can import and call arbitrary functions from Win32's
Dynamic Link Libraries (DLL), without having to write an XS extension.
Note, however, that this module can't do anything (parameters input and
output is limited to simpler cases), and anyway a regular XS extension is
always safer and faster. 

</P>
<P>
The current version of Win32::API is available at my website:

</P>
<P>
<PRE>  <A HREF="http://dada.perl.it/">http://dada.perl.it/</A>
</PRE>
</P>
<P>
It's also available on your nearest CPAN mirror (but allow a few days for
worldwide spreading of the latest version) reachable at:

</P>
<P>
<PRE>  <A HREF="http://www.perl.com/CPAN/authors/Aldo_Calpini/">http://www.perl.com/CPAN/authors/Aldo_Calpini/</A>
</PRE>
</P>
<P>
A short example of how you can use this module (it just gets the PID of the
current process, eg. same as Perl's internal <CODE>$$</CODE>):

</P>
<P>
<PRE>    use Win32::API;
    $GetPID = new Win32::API(&quot;kernel32&quot;, &quot;GetCurrentProcessId&quot;, '', 'N');
    $PID = $GetPID-&gt;Call();
</PRE>
</P>
<P>
The possibilities are nearly infinite (but not all are good :-). Enjoy it.

</P>
<P>
<HR>
<H1><A NAME="CREDITS">CREDITS</A></H1>
<P>
All the credits go to Andrea Frosini for the neat assembler trick that
makes this thing work. A big thank you also to Gurusamy Sarathy for his
unvaluable help in XS development, and to all the Perl community for being
what it is.

</P>
<P>
<HR>
<H1><A NAME="DESCRIPTION">DESCRIPTION</A></H1>
<P>
To use this module put the following line at the beginning of your script:

</P>
<P>
<PRE>    use Win32::API;
</PRE>
</P>
<P>
You can now use the <CODE>new()</CODE> function of the Win32::API module to create a new API object (see <A HREF="#IMPORTING_A_FUNCTION">IMPORTING A FUNCTION</A>) and then invoke the 
<CODE>Call()</CODE> method on this object to perform a call to the imported API (see <A HREF="#CALLING_AN_IMPORTED_FUNCTION">CALLING AN IMPORTED FUNCTION</A>).

</P>
<P>
<HR>
<H2><A NAME="IMPORTING_A_FUNCTION">IMPORTING A FUNCTION</A></H2>
<P>
You can import a function from a 32 bit Dynamic Link Library (DLL) file
with the <CODE>new()</CODE> function. This will create a Perl object that contains the reference to
that function, which you can later <CODE>Call()</CODE>. You need to pass 4 parameters:

</P>
<OL>
<LI><STRONG><A NAME="item_The_name_of_the_library_from_whi">The name of the library from which you want to import the function.</A></STRONG>
<LI><STRONG><A NAME="item_The_name_of_the_function_as_exp">The name of the function (as exported by the library).</A></STRONG>
<LI><STRONG><A NAME="item_The_number_and_types_of_the_argu">The number and types of the arguments the function expects as input.</A></STRONG>
<LI><STRONG><A NAME="item_The_type_of_the_value_returned_b">The type of the value returned by the function.</A></STRONG>
</OL>
<P>
To better explain their meaning, let's suppose that we want to import and
call the Win32 API <CODE>GetTempPath()</CODE>. This function is defined in C as:

</P>
<P>
<PRE>    DWORD WINAPI GetTempPathA( DWORD nBufferLength, LPSTR lpBuffer );
</PRE>
</P>
<P>
This is documented in the <STRONG>Win32 SDK Reference</STRONG>; you can look for it on the Microsoft's WWW site, or in your C compiler's
documentation, if you own one.

</P>
<OL>
<LI><STRONG><A NAME="item__">.</A></STRONG>
<P>
The first parameter is the name of the library file that exports this
function; our function resides in the <EM>KERNEL32.DLL</EM>
system file. When specifying this name as parameter, the <EM>.DLL</EM> extension is implicit, and if no path is given, the file is searched
through a couple of directories, including: 

</P>
<OL>
<LI><STRONG><A NAME="item_The_directory_from_which_the_app">The directory from which the application loaded.</A></STRONG>
<LI><STRONG><A NAME="item_The_current_directory_">The current directory.</A></STRONG>
<LI><STRONG><A NAME="item_The_Windows_system_directory_eg">The Windows system directory (eg. c:\windows\system or system32).</A></STRONG>
<LI><STRONG><A NAME="item_The_Windows_directory_eg_c_wi">The Windows directory (eg. c:\windows).</A></STRONG>
<LI><STRONG><A NAME="item_The_directories_that_are_listed_">The directories that are listed in the PATH environment variable.</A></STRONG>
</OL>
<P>
So, you don't have to write <EM>C:\windows\system\kernel32.dll</EM>; only <EM>kernel32</EM> is enough:

</P>
<P>
<PRE>    $GetTempPath = new Win32::API('kernel32', ...
</PRE>
</P>
<LI><STRONG>.</STRONG>
<P>
Now for the second parameter: the name of the function. It must be written
exactly as it is exported by the library (case is significant here). If you
are using Windows 95 or NT 4.0, you can use the <STRONG>Quick View</STRONG> 
command on the DLL file to see the function it exports. Remember that you
can only import functions from 32 bit DLLs: in Quick View, the file's
characteristics should report somewhere ``32 bit word machine''; as a rule
of thumb, when you see that all the exported functions are in upper case,
the DLL is a 16 bit one and you can't use it. If their capitalization looks
correct, then it's probably a 32 bit DLL.

</P>
<P>
Also note that many Win32 APIs are exported twice, with the addition of a
final <STRONG>A</STRONG> or <STRONG>W</STRONG> to their name, for - respectively - the ASCII and the Unicode version. When
a function name is not found, Win32::API will actually append an <STRONG>A</STRONG> to the name and try again; if the extension is built on a Unicode system,
then it will try with the <STRONG>W</STRONG> instead. So our function name will be:

</P>
<P>
<PRE>    $GetTempPath = new Win32::API('kernel32', 'GetTempPath', ...
</PRE>
</P>
<P>
In our case <CODE>GetTempPath</CODE> is really loaded as <CODE>GetTempPathA</CODE>.

</P>
<LI><STRONG>.</STRONG>
<P>
The third parameter, the input parameter list, specifies how many arguments
the function wants, and their types. It can be passed as a single string,
in which each character represents one parameter, or as a list reference.
The following forms are valid:

</P>
<P>
<PRE>    &quot;abcd&quot;
    [a, b, c, d]
    \@LIST
</PRE>
</P>
<P>
But those are not:

</P>
<P>
<PRE>    (a, b, c, d)
    @LIST
</PRE>
</P>
<P>
The number of characters, or elements in the list, specifies the number of
parameters, and each character or element specifies the type of an
argument; allowed types are:

</P>
<DL>
<DT><STRONG><A NAME="item_I">I: 
value is an integer</A></STRONG><DD>
<DT><STRONG><A NAME="item_N">N: 
value is a number (long)</A></STRONG><DD>
<DT><STRONG><A NAME="item_F">F: 
value is a floating point number (float)</A></STRONG><DD>
<DT><STRONG><A NAME="item_D">D: 
value is a double precision number (double)</A></STRONG><DD>
<DT><STRONG><A NAME="item_P">P: 
value is a pointer (to a string, structure, etc...)</A></STRONG><DD>
</DL>
<P>
Our function needs two parameters: a number (<CODE>DWORD</CODE>) and a pointer to a string (<CODE>LPSTR</CODE>):

</P>
<P>
<PRE>    $GetTempPath = new Win32::API('kernel32', 'GetTempPath', 'NP', ...
</PRE>
</P>
<LI><STRONG>.</STRONG>
<P>
The fourth and final parameter is the type of the value returned by the
function. It can be one of the types seen above, plus another type named <STRONG>V</STRONG> 
(for <CODE>void</CODE>), used for functions that do not return a value. In our example the value
returned by <CODE>GetTempPath()</CODE> is a <CODE>DWORD</CODE>, so our return type will be <STRONG>N</STRONG>:

</P>
<P>
<PRE>    $GetTempPath = new Win32::API('kernel32', 'GetTempPath', 'NP', 'N');
</PRE>
</P>
<P>
Now the line is complete, and the <CODE>GetTempPath()</CODE> API is ready
to be used in Perl. Before calling it, you should test that
<CODE>$GetTempPath</CODE> is 
<CODE>defined</CODE>, otherwise either the function or the library could not be loaded; in this
case, <CODE>$!</CODE> will be set to the error message reported by Windows. Our definition, with
error checking added, should then look like this:

</P>
<P>
<PRE>    $GetTempPath = new Win32::API('kernel32', 'GetTempPath', 'NP', 'N');
    if(not defined $GetTempPath) {
        die &quot;Can't import API GetTempPath: $!\n&quot;;
    }
</PRE>
</P>
</OL>
<P>
<HR>
<H2><A NAME="CALLING_AN_IMPORTED_FUNCTION">CALLING AN IMPORTED FUNCTION</A></H2>
<P>
To effectively make a call to an imported function you must use the
<CODE>Call()</CODE> method on the Win32::API object you created. Continuing
with the example from the previous paragraph, the
<CODE>GetTempPath()</CODE> API can be called using the method:

</P>
<P>
<PRE>    $GetTempPath-&gt;Call(...
</PRE>
</P>
<P>
Of course, parameters have to be passed as defined in the import phase. In
particular, if the number of parameters does not match (in the example, if
<CODE>GetTempPath()</CODE> is called with more or less than two
parameters), Perl will <CODE>croak</CODE> an error message and <CODE>die</CODE>.

</P>
<P>
The two parameters needed here are the length of the buffer that will hold
the returned temporary path, and a pointer to the buffer itself. For
numerical parameters, you can use either a constant expression or a
variable, while <STRONG>for pointers you must use a variable name</STRONG> (no Perl references, just a plain variable name). Also note that <STRONG>memory must be allocated before calling the function</STRONG>, just like in C. For example, to pass a buffer of 80 characters to
<CODE>GetTempPath(),</CODE> it must be initialized before with:

</P>
<P>
<PRE>    $lpBuffer = &quot; &quot; x 80;
</PRE>
</P>
<P>
This allocates a string of 80 characters. If you don't do so, you'll
probably get <CODE>Runtime exception</CODE> errors, and generally nothing will work. The call should therefore include:

</P>
<P>
<PRE>    $lpBuffer = &quot; &quot; x 80;
    $GetTempPath-&gt;Call(80, $lpBuffer);
</PRE>
</P>
<P>
And the result will be stored in the <CODE>$lpBuffer</CODE> variable. Note
that you don't need to pass a reference to the variable (eg. you <STRONG>don't need</STRONG>  <CODE>\$lpBuffer</CODE>), even if its value will be set by the function. 

</P>
<P>
A little problem here is that Perl does not trim the variable, so
<CODE>$lpBuffer</CODE> will still contain 80 characters in return; the
exceeding characters will be spaces, because we said <CODE>&quot; &quot; x 80</CODE>.

</P>
<P>
In this case we're lucky enough, because the value returned by the
<CODE>GetTempPath()</CODE> function is the length of the string, so to get
the actual temporary path we can write:

</P>
<P>
<PRE>    $lpBuffer = &quot; &quot; x 80;
    $return = $GetTempPath-&gt;Call(80, $lpBuffer);
    $TempPath = substr($lpBuffer, 0, $return);
</PRE>
</P>
<P>
If you don't know the length of the string, you can usually cut it at the <CODE>\0</CODE> (ASCII zero) character, which is the string delimiter in C:

</P>
<P>
<PRE>    $TempPath = ((split(/\0/, $lpBuffer))[0];
    
    # or
    
    $lpBuffer =~ s/\0.*$//;
</PRE>
</P>
<P>
Another note: to pass a pointer to a structure in C, you have to
<CODE>pack()</CODE> the required elements in a variable. And of course, to
access the values stored in a structure, <CODE>unpack()</CODE> it as
required. A short example of how it works: the <CODE>POINT</CODE> structure is defined in C as:

</P>
<P>
<PRE>    typedef struct {
        LONG  x;
        LONG  y;
    } POINT;
</PRE>
</P>
<P>
Thus, to call a function that uses a <CODE>POINT</CODE> structure you need the following lines:

</P>
<P>
<PRE>    $GetCursorPos = new Win32::API('user32', 'GetCursorPos', 'P', 'V');
    
    $lpPoint = pack('LL', 0, 0); # store two LONGs
    $GetCursorPos-&gt;Call($lpPoint);
    ($x, $y) = unpack('LL', $lpPoint); # get the actual values
</PRE>
</P>
<P>
The rest is left as an exercise to the reader...

</P>
<P>
<HR>
<H1><A NAME="AUTHOR">AUTHOR</A></H1>
<P>
Aldo Calpini ( <EM>dada@perl.it</EM> ).

</P>

</BODY>

</HTML>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91久久精品一区二区二区| 亚洲欧美偷拍另类a∨色屁股| 欧美xingq一区二区| 久久久久国色av免费看影院| 国产精品久久久久久户外露出| 亚洲欧美日韩综合aⅴ视频| 亚洲一区二区三区影院| 六月丁香婷婷色狠狠久久| 国产精品66部| 91天堂素人约啪| 日韩一区二区在线观看| 国产日韩v精品一区二区| 亚洲综合精品久久| 国产在线观看一区二区| 99国产精品久久久久久久久久久| 91色在线porny| 亚洲成人在线网站| 国产乱妇无码大片在线观看| 91网址在线看| 欧美一区二区三级| 国产精品色哟哟网站| 日日夜夜精品视频天天综合网| 国内精品视频一区二区三区八戒| 色系网站成人免费| 日韩欧美高清dvd碟片| 亚洲日本免费电影| 蜜乳av一区二区三区| 91片在线免费观看| 日韩色在线观看| 一区二区在线观看免费| 国产一区免费电影| 五月综合激情网| 国产精品1024| 欧美日韩国产综合视频在线观看| 久久久精品蜜桃| 日本成人在线电影网| 播五月开心婷婷综合| 制服丝袜成人动漫| 亚洲欧美区自拍先锋| 国模大尺度一区二区三区| 欧美最新大片在线看| 欧美激情综合网| 久久国产欧美日韩精品| 色婷婷av久久久久久久| 亚洲综合视频在线| 日韩高清国产一区在线| 欧美影视一区二区三区| 国产精品嫩草影院com| a亚洲天堂av| 精品久久国产字幕高潮| 国产精品久久久久久久午夜片| 亚洲成av人片一区二区三区| 91热门视频在线观看| 一区二区三区中文字幕精品精品| 日韩一区二区高清| 国产精品素人一区二区| 国产婷婷色一区二区三区四区| 婷婷开心久久网| 99久久er热在这里只有精品66| 久久综合久久99| 久久精品国产亚洲高清剧情介绍 | 国产v综合v亚洲欧| 日韩免费性生活视频播放| 午夜精品一区二区三区免费视频| 一本久道中文字幕精品亚洲嫩| 日本一区二区三区在线不卡| 国产一区二区三区电影在线观看 | 喷水一区二区三区| 欧美日韩亚洲综合在线 欧美亚洲特黄一级| 高清成人免费视频| xfplay精品久久| 国产资源在线一区| 久久在线免费观看| 国产精品中文欧美| 久久九九影视网| 粗大黑人巨茎大战欧美成人| 国产女人aaa级久久久级| 国产成人8x视频一区二区| 国产亚洲成av人在线观看导航| 韩国欧美国产1区| 久久久99久久精品欧美| 国产伦理精品不卡| 欧美激情一区在线观看| 成人黄色大片在线观看| 欧美高清一级片在线观看| 男女性色大片免费观看一区二区 | 国产精品国产a| 懂色av噜噜一区二区三区av| 国产精品三级av| 国产在线麻豆精品观看| 国产三区在线成人av| 国产成人av一区二区三区在线| 久久久久久久综合色一本| 国产99久久久精品| 国产精品色一区二区三区| 99久久伊人久久99| 欧美激情艳妇裸体舞| 成人动漫在线一区| 国产精品久久久久久久久久久免费看| 色视频成人在线观看免| 樱桃国产成人精品视频| 欧美日韩在线播放三区四区| 亚洲精品国产品国语在线app| 欧美色图12p| 天天影视网天天综合色在线播放 | 捆绑调教一区二区三区| 国产色产综合产在线视频| 成人黄色一级视频| 一个色综合网站| 亚洲成人av福利| 4438x成人网最大色成网站| 欧美a级一区二区| 中文字幕免费在线观看视频一区| 国内精品久久久久影院一蜜桃| 国产精品剧情在线亚洲| 91小视频在线| 日韩精品国产精品| 欧美经典一区二区三区| 91在线精品一区二区| 日日摸夜夜添夜夜添亚洲女人| 精品福利一区二区三区| aaa欧美日韩| 亚洲国产wwwccc36天堂| 国产亚洲欧美在线| 91免费精品国自产拍在线不卡| 日韩av电影免费观看高清完整版在线观看| 日韩视频永久免费| 色婷婷国产精品综合在线观看| 日本中文一区二区三区| 亚洲欧美一区二区在线观看| 欧美午夜精品久久久| 国产麻豆91精品| 亚洲黄网站在线观看| 久久一区二区视频| 色综合天天综合狠狠| 精东粉嫩av免费一区二区三区| 中文字幕一区二区三区在线不卡| 777a∨成人精品桃花网| 国产激情精品久久久第一区二区 | 亚洲一二三区在线观看| 久久综合九色综合欧美就去吻 | 欧美激情中文字幕| 欧美日韩一级二级| 国产精品小仙女| 秋霞午夜av一区二区三区| 中文字幕精品在线不卡| 欧美一区二区精美| 99精品视频在线播放观看| 韩国女主播一区| 亚洲午夜精品在线| 国产情人综合久久777777| 日韩视频不卡中文| 色婷婷国产精品综合在线观看| 国产福利视频一区二区三区| 一区二区三区四区高清精品免费观看| 国产亚洲欧洲一区高清在线观看| 欧美日韩综合色| 一本色道**综合亚洲精品蜜桃冫| 美国毛片一区二区| 婷婷成人激情在线网| 国产精品久久看| 精品盗摄一区二区三区| 91官网在线观看| 成人一级片网址| 国产美女视频91| 日韩av网站免费在线| 亚洲二区视频在线| 国产精品丝袜黑色高跟| 国产亚洲美州欧州综合国| 欧美性大战久久久久久久 | 国产夜色精品一区二区av| 日韩视频免费直播| 欧美日韩一区二区三区高清 | 精品国产一区a| 9191久久久久久久久久久| 91日韩精品一区| 91视频观看免费| 国产一区二区三区精品欧美日韩一区二区三区| 日韩在线一二三区| 亚洲欧美激情一区二区| 亚洲美女在线国产| 国产精品毛片大码女人| 国产精品国产三级国产普通话蜜臀 | 国产精品第四页| 欧美va亚洲va香蕉在线| 日韩精品中文字幕一区| 精品视频1区2区| 91福利在线导航| 欧美性感一类影片在线播放| 色老头久久综合| 欧洲av一区二区嗯嗯嗯啊| thepron国产精品| 色网综合在线观看| 91蜜桃婷婷狠狠久久综合9色| 91美女在线视频| 99久久精品情趣| 91精品福利视频| 欧美少妇bbb| 欧美三级中文字| 欧美一三区三区四区免费在线看 |