vb³ÌÐòÖÐwebbrowser ½ÓÊÜSendMessage µÄÏûÏ¢
webbrowser ²»ÄÜÊÕµ½SendMessageµÄÏûÏ¢
Ö÷ÒªÊÇÒòΪ1webbrowser µÄ¾ä±úÕÒ²»µ½¡£¾¹ýŬÁ¦ËÑË÷£¬ÖÕÓÚ½â¾öÁË¡£×ö¸ö¼Ç¼.
Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
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
Const WM_LBUTTONDOWN = &H201
Const WM_LBUTTONUP = &H202
Const MK_LBUTTON = &H1
'»ñµÃwebbrowserµÄ¾ä±ú
Public Function GetBrowserWindow(´°Ìå¾ä±ú As Long) As Long
Dim hwndPeer As Long
hwndPeer = FindWindowEx(´°Ìå¾ä±ú, 0, "Shell Embedding", vbNullString)'ÍøÉϺܶà°ïÖú¾ÍÕÒµ½ÕâÀï¾Í½áÊøÁË£¬ÄÇÊDz»ÄÜÊÕµ½ÏûÏ¢µÄ¡£
hwndPeer = FindWindowEx(hwndPeer, 0, "Shell DocObject View", vbNullString)
hwndPeer = FindWindowEx(hwndPeer, 0, "Internet Explorer_Server", vbNullString)
GetBrowserWindow = hwndPeer
End Function
'°´Å¥µ¥»÷
Private Sub ÃüÁî_Click()
Dim t As String, x As Long, y As Long, w As WebBrowser, wbhwnd As Long, k As Long
x = 537'´ÓWebBrowser¿Ø¼þ×óÉϽÇÆð0,0,×ø±ê²»ÊÇƽʱleft¡¢right¡¢top¡¢heightÄǸö×ø±ê£¬¿ÉÒÔÖ±½Ó¸´Öƿؼþµ½»Í¼ÀïÃ棬¿´·Ö±æ¼¡£
y = 44 * &H10000'Ū³É¸ßλ
wbhwnd = GetBrowserWindow(Form1.hwnd)
k = PostMessage(wbhwnd, WM_LBUTTONDOWN, MK_LBUTTON, ByVal ((y) + x))
k = PostMessage(wbhwnd, WM_LBUTTONUP, 0, (x + (y)))
End Sub
'²âÊÔͨ¹ý¡£
Ïà¹ØÎĵµ£º
Option Explicit
Private Const INTERNET_OPEN_TYPE_DIRECT = 1
Private Const scuseragent = "vb wininet"
Private Const INTERNET_FLAG_PASSIVE = &H8000000
'µ÷ÓÃÉèÖû·¾³
Private Declare Function InternetOpen Lib "wininet.dll" Alias "InternetOpenA" (ByVal sAgent As String, ByVal lAccessType As Long ......
http://social.msdn.microsoft.com/Forums/zh-TW/232/thread/5b0e0eb7-9cd7-420a-9f56-e588154174ba
http://www.mndsoft.com/blog/article.asp?id=903
http://topic.csdn.net/t/20051015/14/4328396.html
¡¡¡¡VBÊdz£ÓõÄÓ¦ÓÃÈí¼þ¿ª·¢¹¤¾ßÖ®Ò»£¬ÓÉÓÚVBµÄ±¨±í¹¦ÄÜÓÐÏÞ£¬¶øÇÒÒ»µ«±¨±í¸ñʽ·¢Éú±ä»¯£¬¾ÍµÃÏàÓ¦Ð޸ijÌÐò£ ......
VB6
ÔÚ³ÌÐòÔËÐÐʱÓÃÈçÏÂÓï¾ä£º
if app.PrevInstance=true then
end
end if
VB 2005:
1. ÔÚVB2005ÖÐ,´ò¿ª"ÊôÐÔ"Ò³,ÆôÓÃ"Ó¦ÓóÌÐò“¿ò¼Ü, Ñ¡ÖÐ"
µ¥ÊµÀýÓ¦ÓóÌÐò"Ç°Ã渴ѡ¿ò,¾ÍÐÐÁË¡£
......
VB ×¢ÊͳÌÐò´úÂëµÄ·ûºÅÊÇ '£¬Ö»ÒªÔÚijÐгÌÐòÇ°Ãæ¼ÓÉϸ÷ûºÅ¾Í¿ÉÒÔ×¢Ê͸ÃÐгÌÐò¡£µ«Èç¹û³ÌÐò´úÂëÓï¾äºÜ¶àµÄʱºò£¬Ò»ÐÐÒ»ÐеØ×¢Ê;ͷdz£²»·½±ã¡£Æäʵ VB
±¾ÉíÌṩÁËÒ»´ÎÐÔ×¢ÊͶàÌõÓï¾äµÄ¹¦ÄÜ£ºÔÚÖ÷²Ëµ¥“ÊÓͼ”Ñ¡ÏîµÄ“¹¤¾ßÀ¸”Ï£¬Ñ¡ÖГ±à¼”£¬VB
µÄ½çÃæ»á³öÏÖÒ»ÅŹ¤¾ß°´Å¥£¬ÆäÖоÍÓÐÓà ......