天天爱天天做天天做天天吃中文|久久综合给久合久久综合|亚洲视频一区二区三区|亚洲国产综合精品2022

  • 
    
    <delect id="ixd07"></delect>

       找回密碼
       注冊

      QQ登錄

      只需一步,快速開始

      未公開API函數(shù)揭秘——通用對話框

      [復制鏈接]
      1#
      發(fā)表于 2008-9-28 16:29:36 | 只看該作者 |倒序瀏覽 |閱讀模式
      <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)對話框?qū)⑹且患闊┑目嗖钍?。幸?lt;/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>& \- T% _6 f8 t
      <P class=MsoNormal><SPAN lang=EN-US>&nbsp;<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></P>
      6 c) ^; ?% E) d<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>, y2 g' `8 ^* N, ^9 [' @3 O
      <P class=MsoNormal><SPAN lang=EN-US>&nbsp;<o:p></o:p></SPAN></P>
      ; i1 R1 I% L6 h) {<P class=MsoNormal><SPAN style="FONT-FAMILY: 宋體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">選取圖標</SPAN></P>  H6 j+ ]6 v8 n) ]) t
      <P class=MsoNormal><SPAN lang=EN-US>&nbsp;<o:p></o:p></SPAN></P>( D- ~5 b+ r! x2 }5 @6 [; F
      <P class=MsoNormal><SPAN lang=EN-US>BOOL WINAPI PickIconDlg(</SPAN></P>
      , n' x% c# x# R  h+ E$ i<P class=MsoNormal><SPAN lang=EN-US>HWND hwndOwner, </SPAN></P>
      ' z7 b: E8 C5 L6 d6 w$ `. ~. V! G<P class=MsoNormal><SPAN lang=EN-US>LPSTR lpstrFile, </SPAN></P>
      " w/ {) r, |4 l  _5 ?4 v6 ]' d<P class=MsoNormal><SPAN lang=EN-US>DWORD nMaxFile, </SPAN></P>3 O: N& @% W1 t7 Z0 t# J+ m
      <P class=MsoNormal><SPAN lang=EN-US>LPDWORD lpdwIconIndex);</SPAN></P>5 r. Y& E- T  n/ d, K
      <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>6 v: Z8 L6 c* ~4 d$ s  [$ T
      <P class=MsoNormal><SPAN lang=EN-US>&nbsp;<o:p></o:p></SPAN></P>
      9 g" S' i# M8 o5 y) q0 E- J<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)菜單的關(guān)閉選項則返回值為假。</SPAN></P>
      2 Y4 S% c/ L9 r  c: `<P class=MsoNormal><SPAN lang=EN-US>&nbsp;<o:p></o:p></SPAN></P>
      0 g2 F/ g7 M! m6 n+ S<P class=MsoNormal><SPAN style="FONT-FAMILY: 宋體; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">運行程序?qū)υ捒?lt;/SPAN></P>* g/ O% x' j/ s' B; U
      <P class=MsoNormal><SPAN lang=EN-US>&nbsp;<o:p></o:p></SPAN></P>
      7 P( H. w, S5 V9 W0 J% G) r4 q<P class=MsoNormal><SPAN lang=EN-US>void WINAPI RunFileDlg(</SPAN></P>
      ' v* d2 J4 M+ x1 H4 h0 m4 ?<P class=MsoNormal><SPAN lang=EN-US>HWND hwndOwner, </SPAN></P>
      , s+ W5 u: s/ G) {/ R7 _, e( _<P class=MsoNormal><SPAN lang=EN-US>HICON hIcon, </SPAN></P>
      8 X$ |0 a4 F( K, A: i<P class=MsoNormal><SPAN lang=EN-US>LPCSTR lpstrDirectory, </SPAN></P>
      ; U! w* @8 Y: Z. }! M" U& R<P class=MsoNormal><SPAN lang=EN-US>LPCSTR lpstrTitle, </SPAN></P>
      ( ^8 l5 [" c! X9 p9 q1 u' _<P class=MsoNormal><SPAN lang=EN-US>LPCSTR lpstrDescription,</SPAN></P>. |9 e( Z/ {9 l2 f7 I
      <P class=MsoNormal><SPAN lang=EN-US>UINT uFlags);</SPAN></P>" F2 j6 f$ V4 S+ T! a# {  l5 l) {, L
      <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>
        v1 f" J8 {8 d5 [- k<P class=MsoNormal><SPAN lang=EN-US>&nbsp;<o:p></o:p></SPAN></P>  N7 p% j* e+ b, i. T+ u
      <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>- G& w% O9 q1 m' V
      <P class=MsoNormal><SPAN lang=EN-US>&nbsp;<o:p></o:p></SPAN></P>1 g. H( H  H" C5 D, ^3 a7 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>3 {, P0 N7 V+ p2 }* s
      <P class=MsoNormal><SPAN lang=EN-US>&nbsp;<o:p></o:p></SPAN></P>
      7 t! S0 `& {: u" S$ ~  X5 G$ l<P class=MsoNormal><SPAN lang=EN-US>RFF_NOBROWSE 0x01 Removes the browse button. </SPAN></P>
      " g) a1 X7 V; E: {; [* U! r<P class=MsoNormal><SPAN lang=EN-US>RFF_NODEFAULT 0x02 No default item selected. </SPAN></P>  X$ a  F: j) Q& W: Q$ s" X( W
      <P class=MsoNormal><SPAN lang=EN-US>RFF_CALCDIRECTORY 0x04 Calculates the working directory from the file name. </SPAN></P>! h! G! n+ X. M$ _$ M
      <P class=MsoNormal><SPAN lang=EN-US>RFF_NOLABEL 0x08 Removes the edit box label. </SPAN></P>/ g" m: J  S# P6 M6 M; F
      <P class=MsoNormal><SPAN lang=EN-US>RFF_NOSEPARATEMEM 0x20 Removes the Separate Memory Space check box (Windows NT only). </SPAN></P>
      您需要登錄后才可以回帖 登錄 | 注冊

      本版積分規(guī)則

      QQ|本地廣告聯(lián)系: QQ:905790666 TEL:13176190456|Archiver|手機版|小黑屋|汶上信息港 ( 魯ICP備19052200號-1 )

      GMT+8, 2025-8-25 06:15

      Powered by Discuz! X3.5

      © 2001-2025 Discuz! Team.

      快速回復 返回頂部 返回列表