av激情亚洲男人的天堂国语,日韩欧美精品一中文字幕,无码av一区二区三区无码,国产又色又爽又刺激的a片,国产又色又爽又刺激的a片

VB.NETWindowsAPI函數(shù)兩步通

VB.NET經(jīng)過長時間的發(fā)展,很多用戶都很了解VB.NET Windows API函數(shù)了,這里我發(fā)表一下個人理解,和大家討論討論。VB.NET要實現(xiàn)查看文件中的圖標,目前只使用.Net FrameWork SDK是無法實現(xiàn)這種功能的,正如前面所說,主要是由于.Net FrameWork SDK推出的時間較短,其功能還不可能面面俱到。

專業(yè)領(lǐng)域包括做網(wǎng)站、網(wǎng)站設(shè)計、商城網(wǎng)站建設(shè)、微信營銷、系統(tǒng)平臺開發(fā), 與其他網(wǎng)站設(shè)計及系統(tǒng)開發(fā)公司不同,成都創(chuàng)新互聯(lián)的整合解決方案結(jié)合了幫做網(wǎng)絡(luò)品牌建設(shè)經(jīng)驗和互聯(lián)網(wǎng)整合營銷的理念,并將策略和執(zhí)行緊密結(jié)合,為客戶提供全網(wǎng)互聯(lián)網(wǎng)整合方案。

#T#解決問題的關(guān)鍵是正確使用Windows API函數(shù),其中所涉及到的Windows API函數(shù)主要有二個:其一是獲得指定文件中的圖標數(shù)目;其二是從指定文件的指定位置導(dǎo)出圖標的Windows句柄。這二個函數(shù)都位于 “Shell32.dll”文件中,并且函數(shù)的入口點都為“ExtractIcon”。下面是在VB.NET中分別使用DllImport特征類和“Declare”語句申明這二個VB.NET Windows API函數(shù)的具體方法。

1.使用DllImport特征類來申明VB.NET Windows API函數(shù)

下面是在VB.NET中使用DllImport特征類申明二個Windows API函數(shù)的具體示例:

 
 
  1. 函數(shù)ExtractIcon,其功能是是從指定文件的指定位置導(dǎo)出圖標的Windows句柄。  
  2. < System.Runtime.InteropServices.DllImport ( "Shell32.dll" , EntryPoint := "ExtractIcon" ) > _  
  3. Public Function _  
  4. ExtractIcon ( ByVal src As System.IntPtr , ByVal strFileName As string , ByVal uiIconIndex As UInt32 ) As System.IntPtr  
  5. End Function  
  6. '函數(shù)Icon_Num,其功能是獲得指定文件中的圖標數(shù)目  
  7. < System.Runtime.InteropServices.DllImport ( "Shell32.dll" , EntryPoint := "ExtractIcon" ) > _  
  8. Public Function _  
  9. Icon_Num ( ByVal src As System.IntPtr , ByVal strFileName As string , ByVal uiIconIndex As Integer ) As Integer  
  10. End Function  

在使用DllImport特征類申明Windows API函數(shù)時,如果申明的函數(shù)名稱和函數(shù)的入口點相同,則可以在申明Windows API函數(shù)時,省略定義函數(shù)入口點對應(yīng)的代碼,即EntryPoint對象字段對應(yīng)的代碼,這樣聲明ExtractIcon函數(shù)的代碼也可以簡化為如下所示:

 
 
  1. < System.Runtime.InteropServices.DllImport ( "Shell32.dll" ) > _  
  2. Public Function _  
  3. ExtractIcon ( ByVal src As System.IntPtr , ByVal strFileName As string , ByVal uiIconIndex As UInt32 ) As System.IntPtr  
  4. End Function 

2.使用“Declare”語句來申明Windows API函數(shù)

使用“Declare”語句的確比使用DllImport特征類要簡單了許多,下面是在VB.NET中使用“Declare”語句來聲明上述二個Windows API函數(shù)的具體方法:

 
 
  1. Declare Auto Function ExtractIcon Lib "Shell32.dll" Alias "ExtractIcon"   
  2. ( ByVal src As System.IntPtr , ByVal strFileName As string , ByVal uiIconIndex As UInt32 ) As System.IntPtr  
  3. '聲明ExtractIcon函數(shù)  
  4. Declare Auto Function Icon_Num Lib "Shell32.dll" Alias "ExtractIcon"   
  5. ( ByVal src As System.IntPtr , ByVal strFileName As string , ByVal uiIconIndex As Integer ) As Integer  
  6. '聲明Icon_Num函數(shù) 

在VB.NET中聲明Windows API函數(shù)時,“Declare”語句中Alias關(guān)鍵字的作用相當于使用DllImport特征類中的EntryPoint對象字段。同樣在使用 “Declare”語句聲明Windows API函數(shù)時,如果聲明的函數(shù)和函數(shù)的入口點相同,也可以省略Alias關(guān)鍵字對應(yīng)的代碼,所以ExtractIcon函數(shù)也可以簡化為如下:

 
 
  1. Declare Auto Function ExtractIcon Lib "Shell32.dll"   
  2. ( ByVal src As System.IntPtr , ByVal strFileName As string , ByVal uiIconIndex As UInt32 )   
  3. As System.IntPtr 

下面就結(jié)合一個示例的編寫過程來掌握的這二個Windows API函數(shù)的具體使用方法,這個示例的作用就是讀取指定文件中的圖標數(shù)目,并顯示文件中的圖標。


文章名稱:VB.NETWindowsAPI函數(shù)兩步通
當前路徑:http://uogjgqi.cn/article/coggphg.html
掃二維碼與項目經(jīng)理溝通

我們在微信上24小時期待你的聲音

解答本文疑問/技術(shù)咨詢/運營咨詢/技術(shù)建議/互聯(lián)網(wǎng)交流