|
|
马上注册,结识高手,享用更多资源,轻松玩转三维网社区。
您需要 登录 才可以下载或查看,没有帐号?注册
x
Get a handle to an application window.
! \0 h f4 ~. m5 YDeclare Auto Function FindWindow Lib "USER32.DLL" ( _ 7 V- E% T& Y3 Q
ByVal lpClassName As String, _
! o+ Z5 J$ p8 x( ?) j7 t& X5 T0 XByVal lpWindowName As String) As IntPtr
/ z2 J' [- r* a c7 ]6 L
3 D2 S8 X" u) }' Activate an application window.
& ?* T5 j* @5 g( a% ^Declare Auto Function SetForegroundWindow Lib "USER32.DLL" _
7 w4 @ u+ \5 }9 e& B(ByVal hWnd As IntPtr) As Boolean ! M, Q# A* L7 F& ?* m9 L+ d
. G8 {+ r: H# o0 [( J! u' Send a series of key presses to the Calculator application.
6 A, N. E* B6 D0 S$ D, O% bPrivate Sub button1_Click(ByVal sender As Object, _
3 M, s. D6 K* ]! @. j) C9 fByVal e As EventArgs) Handles button1.Click 5 L D) g- F! `9 B; T& a
( s& x. @9 @# E7 ^' Get a handle to the Calculator application. The window class
( g$ N( T% t8 l- w9 b( V1 [' and window name were obtained using the Spy++ tool.
0 M v' Q4 j, T3 l, E hDim calculatorHandle As IntPtr = FindWindow("SciCalc", "Calculator")
5 ]2 O+ H* g5 O, C8 ]4 V" A; `* n
' Verify that Calculator is a running process. 2 C8 X/ }/ v7 R& w
If calculatorHandle = IntPtr.Zero Then
6 V: w! M$ Z! Q7 ~1 g1 C2 f: m; NMsgBox("Calculator is not running.") : p" T7 a8 {3 ^
Return
9 I. r0 J1 t/ o& uEnd If / R* {0 c4 ]- ^6 u6 ^
! _) D6 L# ?% ]: p) q3 \, O0 j8 Q[ 本帖最后由 zhaojianhong 于 2009-7-8 11:26 编辑 ] |
评分
-
查看全部评分
|