各位大侠,小弟菜鸟,因工作需要,临时捉刀,需要一个小软件实现这样一个功能,软件启动,在系统中注册一个全局热键,然后,每当按这个热键的时候,程序自动的在光标当前位置(网页,程序文本框,记事本程序等)输入系统时间戳。
我的全部代码如下:Public Class Main
    Declare Function RegisterHotKey Lib "user32" (ByVal hwnd As Integer, ByVal id As Integer, ByVal fsModifiers As Integer, ByVal vk As Integer) As Integer
    Declare Function WindowFromPoint Lib "user32" (ByVal xPonit As Integer, ByVal yPonit As Integer) As IntPtr
    Private Declare Function GetCursorPos Lib "user32" (ByRef lpPoint As POINTAPI) As Integer
    Private Declare Function SendMessage Lib "user32" (ByVal hwnd As IntPtr, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As String) As Integer
    Public Const MOD_ALT = &H1
    Public Const WM_SETTEXT = &HC
    Private Structure POINTAPI
        Dim x As Integer
        Dim y As Integer
    End Structure
    Public Sub ww()
        Dim a As POINTAPI
        Dim b As IntPtr
        Dim bb As Long
        GetCursorPos(a)
        b = WindowFromPoint(a.x, a.y)
        Label2.Text = b
        bb = CLng(b)
        SendMessage(b, WM_SETTEXT, 0, CStr(Now))
    End Sub    Public Sub Main_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load, Timer1.Tick
        RegisterHotKey(Handle, 101, MOD_ALT, Keys.R)
    End Sub
    Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
        If m.Msg = 786 Then
            If m.WParam.ToInt32 = 101 Then
                'MsgBox(CStr(Now))
                Label1.Text = CStr(Now)
                Call ww()
            End If
        End If
        MyBase.WndProc(m)
    End SubEnd Class
运行时竟然会提示“Unable to find an entry point named 'SendMessage' in DLL 'user32'.”。快崩溃了大侠们帮帮忙啊…………谢谢各位了,问题究竟出在哪里呢