|
发表于 2011-12-10 18:36:35
|
显示全部楼层
- Option Explicit
- Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
- Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
- Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
- Private Declare Function GetWindowRect Lib "user32" (ByVal Hwnd As Long, lpRect As RECT) As Long
- Private Type RECT
- Left As Long
- Top As Long
- Right As Long
- Bottom As Long
- End Type
- Private Sub Command1_Click()
- Dim Hwnd As Long, tipwnd As Long, rctemp As RECT
- Hwnd = FindWindow("SciCalc", vbNullString)
- tipwnd = FindWindowEx(Hwnd, 0, "Edit", vbNullString)
- GetWindowRect tipwnd, rctemp
- With Text1
- SetParent .Hwnd, tipwnd
- .Top = 0
- .Left = 0
- .Width = (rctemp.Right - rctemp.Left) * Screen.TwipsPerPixelX - 50
- .Height = (rctemp.Bottom - rctemp.Top) * Screen.TwipsPerPixelY
- End With
- Me.Hide
- End Sub
- Private Sub Form_Load()
- With Text1
- .Appearance = 0
- .BorderStyle = 0
- .Text = ""
- End With
- Shell "calc.exe"
- End Sub
- Private Sub Text1_GotFocus()
- Text1.SelLength = Len(Text1.Text)
- Text1.SelStart = 0
- End Sub
- Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
- If KeyCode = 81 And Shift = 2 Then
- Unload Me
- End If
- End Sub
复制代码 百度百度。。。。。。这是简单的啦,自己修改。。 |
|