亚洲色一色噜一噜噜噜_在线国产精品一区二区_91国自产拍 精品_国产伦三级一区二区
汶上信息港
標題:
未公開API函數(shù)揭秘——通用對話框
[打印本頁]
作者:
hbhdgpyz
時間:
2008-9-28 16:29
標題:
未公開API函數(shù)揭秘——通用對話框
<P class=MsoNormal><SPAN lang=EN-US>COMDLG32.DLL </SPAN><SPAN style="FONT-FAMILY: 宋體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">為我們提供了一些很有用的對話框,但是仍然有部分我們可能會用到的系統(tǒng)對話框它卻沒有提供。如果試圖復制這些系統(tǒng)對話框將是一件麻煩的苦差事。幸好</SPAN><SPAN lang=EN-US>shell32.dll</SPAN><SPAN style="FONT-FAMILY: 宋體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">為我們提供了這些對話框,本文將帶你去發(fā)掘一些未公開的</SPAN><SPAN lang=EN-US>API</SPAN><SPAN style="FONT-FAMILY: 宋體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">函數(shù),以實現(xiàn)這些對話框。</SPAN></P>
; ?4 N9 r8 j+ u9 T. V$ A
<P class=MsoNormal><SPAN lang=EN-US> <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></P>
0 g% h" F/ C7 t8 O
<P class=MsoNormal><SPAN style="FONT-FAMILY: 宋體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在使用未公開的</SPAN><SPAN lang=EN-US>API</SPAN><SPAN style="FONT-FAMILY: 宋體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">函數(shù)之前,你必須知道聲明未公開的</SPAN><SPAN lang=EN-US>API</SPAN><SPAN style="FONT-FAMILY: 宋體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">函數(shù)與聲明那些公開的</SPAN><SPAN lang=EN-US>API</SPAN><SPAN style="FONT-FAMILY: 宋體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">函數(shù)略有不同,那就是,你必須用到未公開</SPAN><SPAN lang=EN-US>API</SPAN><SPAN style="FONT-FAMILY: 宋體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">函數(shù)的順序號</SPAN><SPAN lang=EN-US>(ordinal number)</SPAN><SPAN style="FONT-FAMILY: 宋體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">。這個順序號就是未公開函數(shù)的別名。也就是說在聲明未公開</SPAN><SPAN lang=EN-US>API</SPAN><SPAN style="FONT-FAMILY: 宋體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">函數(shù)時,必須加上它的別名。例如下面要說到的</SPAN><SPAN lang=EN-US>PickIconDlg</SPAN><SPAN style="FONT-FAMILY: 宋體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">函數(shù)的順序號為</SPAN><SPAN lang=EN-US>62</SPAN><SPAN style="FONT-FAMILY: 宋體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">,它的別名就是</SPAN><SPAN lang=EN-US>"#62"</SPAN><SPAN style="FONT-FAMILY: 宋體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">。如果不這樣做,系統(tǒng)會提示你找不到函數(shù)的入口點。</SPAN></P>
( \$ |8 D6 C# {9 Y0 U* ~) r
<P class=MsoNormal><SPAN lang=EN-US> <o:p></o:p></SPAN></P>
. @: m- D3 ]( y" R4 |
<P class=MsoNormal><SPAN style="FONT-FAMILY: 宋體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">選取圖標</SPAN></P>
3 K3 H2 z0 B6 p! j
<P class=MsoNormal><SPAN lang=EN-US> <o:p></o:p></SPAN></P>
3 q6 y$ u6 Y' w p8 V
<P class=MsoNormal><SPAN lang=EN-US>BOOL WINAPI PickIconDlg(</SPAN></P>
4 x; D# h2 b* @8 M- g# ?5 z) c
<P class=MsoNormal><SPAN lang=EN-US>HWND hwndOwner, </SPAN></P>
' U b* ]$ h0 @
<P class=MsoNormal><SPAN lang=EN-US>LPSTR lpstrFile, </SPAN></P>
" ?( Y, E$ r3 X/ `, ^' P
<P class=MsoNormal><SPAN lang=EN-US>DWORD nMaxFile, </SPAN></P>
( F9 [" l* N9 w6 q1 O9 z& Z( G
<P class=MsoNormal><SPAN lang=EN-US>LPDWORD lpdwIconIndex);</SPAN></P>
9 V3 D8 w; ?8 h# o6 u; J
<P class=MsoNormal><SPAN style="FONT-FAMILY: 宋體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">該函數(shù)的順序號為</SPAN><SPAN lang=EN-US>62</SPAN><SPAN style="FONT-FAMILY: 宋體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">。</SPAN></P>
2 I8 g) p- r3 B4 a0 F
<P class=MsoNormal><SPAN lang=EN-US> <o:p></o:p></SPAN></P>
5 D5 B# t' y& c: ^& H7 S P
<P class=MsoNormal><SPAN lang=EN-US>hwndOwner</SPAN><SPAN style="FONT-FAMILY: 宋體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">擁有該對話框的窗口句柄</SPAN><SPAN lang=EN-US> lpstrFile</SPAN><SPAN style="FONT-FAMILY: 宋體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">指向一個緩沖,包含初始的文件名。函數(shù)返回后它就包含新的文件名。</SPAN><SPAN lang=EN-US>nMaxFile</SPAN><SPAN style="FONT-FAMILY: 宋體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">指定緩沖的大小,以字符為單位。</SPAN><SPAN lang=EN-US> lpdwIconIndex</SPAN><SPAN style="FONT-FAMILY: 宋體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">指向一個變量其中包含基于零的圖標的索引。函數(shù)返回后它包含新圖標的索引值。</SPAN> <SPAN style="FONT-FAMILY: 宋體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">如果用戶選擇了圖標,則返回值為真,如果用戶選擇取消按鈕或是系統(tǒng)菜單的關閉選項則返回值為假。</SPAN></P>
: w: B. O3 D4 t6 J
<P class=MsoNormal><SPAN lang=EN-US> <o:p></o:p></SPAN></P>
' j( j( ~# h" ^, @
<P class=MsoNormal><SPAN style="FONT-FAMILY: 宋體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">運行程序對話框</SPAN></P>
a' \1 f: Z# B
<P class=MsoNormal><SPAN lang=EN-US> <o:p></o:p></SPAN></P>
5 h2 c8 i5 J8 A' Y4 k
<P class=MsoNormal><SPAN lang=EN-US>void WINAPI RunFileDlg(</SPAN></P>
9 t- R3 }3 o4 k7 x: d4 J$ i* A. Z
<P class=MsoNormal><SPAN lang=EN-US>HWND hwndOwner, </SPAN></P>
/ I2 P0 K+ E5 }6 l
<P class=MsoNormal><SPAN lang=EN-US>HICON hIcon, </SPAN></P>
# f4 e, z7 @) R4 U+ x& J
<P class=MsoNormal><SPAN lang=EN-US>LPCSTR lpstrDirectory, </SPAN></P>
8 j! F5 E5 e d% u" ?* H( b
<P class=MsoNormal><SPAN lang=EN-US>LPCSTR lpstrTitle, </SPAN></P>
. {3 J' ]) g8 ~9 s: J$ s' u2 [
<P class=MsoNormal><SPAN lang=EN-US>LPCSTR lpstrDescription,</SPAN></P>
6 i* n0 L" y; o. b" z, j
<P class=MsoNormal><SPAN lang=EN-US>UINT uFlags);</SPAN></P>
+ U/ @* J0 ^3 w; d7 j1 }4 v
<P class=MsoNormal><SPAN style="FONT-FAMILY: 宋體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">該函數(shù)的順序號為</SPAN><SPAN lang=EN-US>61</SPAN><SPAN style="FONT-FAMILY: 宋體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">。在</SPAN><SPAN lang=EN-US>VB</SPAN><SPAN style="FONT-FAMILY: 宋體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中可聲明如下:</SPAN></P>
$ C1 o2 K) r0 s
<P class=MsoNormal><SPAN lang=EN-US> <o:p></o:p></SPAN></P>
$ h8 w! W: e9 A/ N- D1 c# L% B! A
<P class=MsoNormal><SPAN lang=EN-US>Private Declare Function RunFileDlg Lib "shell32" Alias "#61" (ByVal hwndOwner As Long, ByVal hIcon As Long, ByVal lpstrDirectory As String, ByVal lpstrTitle As String, ByVal lpstrDescription As String, ByVal uFlags As Long) As Long</SPAN></P>
- j, u1 I0 x T, G6 ]
<P class=MsoNormal><SPAN lang=EN-US> <o:p></o:p></SPAN></P>
! w3 _0 O, W; r. d1 E% H8 R
<P class=MsoNormal><SPAN style="FONT-FAMILY: 宋體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">其中</SPAN><SPAN lang=EN-US>uFlags</SPAN><SPAN style="FONT-FAMILY: 宋體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">參數(shù)的可選值為</SPAN></P>
- j! U" a* q2 R" V. v
<P class=MsoNormal><SPAN lang=EN-US> <o:p></o:p></SPAN></P>
7 [1 c3 h7 f. T3 k3 T
<P class=MsoNormal><SPAN lang=EN-US>RFF_NOBROWSE 0x01 Removes the browse button. </SPAN></P>
3 N- z5 r/ `: h
<P class=MsoNormal><SPAN lang=EN-US>RFF_NODEFAULT 0x02 No default item selected. </SPAN></P>
/ P% X) W$ |& m8 s8 C
<P class=MsoNormal><SPAN lang=EN-US>RFF_CALCDIRECTORY 0x04 Calculates the working directory from the file name. </SPAN></P>
! {* D% r3 H5 t! b; G5 T/ N
<P class=MsoNormal><SPAN lang=EN-US>RFF_NOLABEL 0x08 Removes the edit box label. </SPAN></P>
" n) }' C6 k' K9 m$ G
<P class=MsoNormal><SPAN lang=EN-US>RFF_NOSEPARATEMEM 0x20 Removes the Separate Memory Space check box (Windows NT only). </SPAN></P>
歡迎光臨 汶上信息港 (http://m.loveproblemguru.com/)
Powered by Discuz! X3.5