VBAPI.doc_第1页
VBAPI.doc_第2页
VBAPI.doc_第3页
VBAPI.doc_第4页
VBAPI.doc_第5页
已阅读5页,还剩31页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

? ? ? ? PEARs BLOG,?DElPHI(1)VB APIvb 2010-01-06 20:22:10 9 0 ?VB6.0,VB API,99API,.VB GOOD,.?VB API?VB API?API?Win32 APIMicrosoft 32ApplicationProgramming Interfacein32?Win32 APIWindows32Mircrosoft32API Win32 API?APIAPI?API?APIAPIVBAPI?APIAPIAPIAPI?Private Declare Sub Sleep Lib kernel32 Alias Sleep (ByVal dwMilliseconds As Long)?APIAPIAPIAPIVBAPIAPIAPIMicrosoft Visual Basic 6.0 Microsoft Visual Basic 6.0 API API,WIN32API.TXT,SleepAPICtrl+VAPIVB?APIPrivate(),Public()PrivatePublicAPIAPIAPIPrivatePublic(Private)?APIAPIAPIPrivateAPIDeclareVBAPIAPISubVBSubFunctionLibVBDLLAPIVBkernel32.dLLAPIDLLuser32shell32.dll.dllAliasAlias SleepDLL?APIAPIForm1?Private Declare Sub Sleep Lib kernel32 (ByVal dwMilliseconds As Long)Private Sub Form_Load()? Sleep 2000? 2000,2End Sub?Sleep API2dwMillisecondsTimerSleep2000VBVB APIAPI?API?APIAPI?1,MsgBox?APIVBMsgBoxAPIMsgBoxAPIMessageBoxAPIVBMsgBoxMsgBoxMessageBoxAPIVBAPIVBCommandButton?Private Declare Function MessageBox Lib user32 Alias MessageBoxA(ByVal hwnd As Long, ByVal lpText As String, ByVal lpCaption As String,ByVal wType As Long) As LongPrivate Sub Command1_Click()? MessageBox Me.hwnd, , , 0End Sub?Byval hWnd As Long Me.hwndAPIMe.hwndVBhWnd ?hwnd Msgbox Me.hwndMeFormMe.Caption=Me.BackColor=vbRed?Me.hwndMessageBoxByval hwnd As LongByVal lpText As StringlpText,MsgBoxByVal lpCaption As StringlpCaptionMsgBoxByVal wType As LongwTypeMsgBoxVBMsgBoxvbYesNo,vbOkCancel0?F5Command1MsgBox?2,?Windows(?)APIGetWindowShowWindowAPI,FormAPIComboxGW_OWNERSW_HIDEAPI?Private Declare Function GetWindow Lib user32 (ByVal hwnd As Long,ByVal ?wCmd As Long) As LongPrivate Declare Function ShowWindow Lib user32 (ByVal hwnd As Long?_ByVal nCmdShow As Long) As LongPrivate Const GW_OWNER = 4Private Const SW_HIDE = 0Private Sub Form_Load()? Dim lphWnd As Long? lphWnd = GetWindow(Me.hwnd, GW_OWNER)? ShowWindow lphWnd, SW_HIDEEnd Sub?API?GetWindow,hWndwCmdShowWindowhWndnCmdShow?lphWnd = GetWindow(Me.hwnd, GW_OWNER)GetWindowFunctionLong()ShowWindow lphWnd, SW_HIDElphwndSW_HIDE,APIAPIHideExe?GW_OWNERAPIGetWindowGW_OWNERShowWindowSW_HIDEAPIGetWindowGet(G)Window(W)=GWShowWindowShow(S)Window(W)=SWVBAPI?3?3,? ? APIAPIAPIVB(Type)? ? APIAPIAPI70%API? ? GetCursorPosGetCursorPosAPIAPIPrivate Declare Function GetCursorPos Lib user32 Alias GetCursorPos (lpPoint As POINTAPI) As Long? ? APIVB? ? lpPoint As POINTAPIPOINTAPIVBStringIntegerLongByte(,)APIComboxListAPITextPOINTAPIPrivate Type POINTAPI? ? ?x As Long? ? ?y As LongEnd Type? ? Timer? ? Interval = 100? ? Enabled?= True? ? TimerPrivate Declare Function GetCursorPos Lib user32 (lpPoint As POINTAPI) As LongPrivate Type POINTAPI? ? ?x As Long? ? ?y As LongEnd TypePrivate Sub Timer1_Timer()? ? Dim lpPoint As POINTAPI? ? ? GetCursorPos lpPoint? ? ? Me.Caption = X = & lpPoint.x & Y = & lpPoint.yEnd Sub? ? ? ? Dim lpPoint As POINTAPIPOINTAPI? ? GetCursorPos lpPointAPIAPIlpPointGetCursorPosLongStringPOINTAPIPOINTAPIVB? ? Me.Caption = X = & lpPoint.x & Y = & lpPoint.ylpPointVB? ? APIAPI? ? APIAPIAPI? ? APIAPIAPIAPI? ? 1,? ? Windows(API)? ? WindowsWindows()APIExit()WindowsAPIAPIExitWindowsEXAPIAPI16Win32ExitWindowsEXAPI?Private Declare Function ExitWindowsEx Lib user32 Alias ExitWindowsEx (ByVal uFlags As Long, ByVal dwReserved As Long) As Long? ? ByVal uFlags As LongAPIAPIFlagsAPI(API)APIAPIAPIAPI? ? APIAPI?Exit? ? E?Windows W?Ex? ? E? ?EWE_? ? APIEWEEWXExAPIEWXXExXAPIuFlags?Private Const EWX_FORCE = 4?Private Const EWX_LOGOFF = 0?Private Const EWX_REBOOT = 2?Private Const EWX_SHUTDOWN = 1? ? ? ? EWX_FORCE EWX_ _ ,Force ( _ )ExitWindowsEx APIWindowsWindows?EWX_LOGOFF Logout Off?EWX_REBOOT ?EWX_SHUTDOWN ? ? ? ByVal dwReserved As Long00,APIAPIVS.MSDNMSDNWindows 2000/95/98/MeXP? ? APIFunctionLongMSDN? ? APIFormTimerInterval 1000Enabled True?Private Declare Function ExitWindowsEx Lib user32 (ByVal uFlags As Long, ByVal dwReserved As Long) As Long?Private Const EWX_LOGOFF = 0?Private Sub Timer1_Timer()? ? ?Static i As Integer? ? ? ?i = i + 1? ? ? ?Me.Caption = i ? ? ? ?If i = 10 Then ? ? ? ? ExitWindowsEx EWX_LOGOFF, 0? ? ?End If?End Sub? ? Static i As Integer ()i = i + 1Timeri1,Timerinterval100010002000If i = 10 Theni=1010ExitWindowsEx EWX_LOGOFF Or EWX_FORCE, 0OrWindows? ? API Or OrVBEWX_LOGOFF Or EWX_FORCE Or(/bookfiles/110/1001103366.shtml)API Or ? ? F5Form10Windows? ? EWX_SHUTDOWNNTAPI? ? 2,API? ? ? ? APIGet()GetWindow()WindowsAPI?GetWindowGetWindowDCGetWindowLongGetWindowRectGetWindowRgnGetWindowsDirectoryGetWindowTextGetWindowThreadProcessId? ? ? ? GetWindowTextGet()Window()Text()Very Good!APIFollow Me!? ? FormCommandButtonCaption:TextBoxText1PasswordChar=*;Text=123456789Text2TextForm1?Private Declare Function GetWindowText Lib user32 Alias GetWindowTextA (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long?Private Sub Command1_Click()? ? ?Dim sBuffer As String? ? ? ?sBuffer = Space(255)? ? ?GetWindowText Text1.hwnd, sBuffer, 255? ? ? ?Text2.Text = sBuffer?End Sub? ? OKF5Command1Text1Text2Tex

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论