| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2526 人关注过本帖
标题:怎样判断一个网页是否打开呢?
只看楼主 加入收藏
r316999443
Rank: 7Rank: 7Rank: 7
来 自:星城长沙
等 级:黑侠
威 望:1
帖 子:597
专家分:501
注 册:2006-11-7
结帖率:80%
收藏
 问题点数:0 回复次数:6 
怎样判断一个网页是否打开呢?
VB 是如何判断一个网页以打开了呢?假设是www.pc-cn.net这网页
VB可以对内存的进程名进行识别吗
搜索更多相关主题的帖子: 网页 判断 
2006-12-29 10:59
学习VB才2天
Rank: 5Rank: 5
等 级:贵宾
威 望:16
帖 子:1653
专家分:0
注 册:2006-5-4
收藏
得分:0 

獲取進程的````

Private Declare Function LookupAccountSid Lib “advapi32.dll“ Alias “LookupAccountSidA“ (ByVal lpSystemName As String, ByVal SID As Long, ByVal name As String, cbName As Long, ByVal ReferencedDomainName As String, cbReferencedDomainName As Long, peUse As Long) As Long
Private Declare Function OpenProcessToken Lib “advapi32.dll“ (ByVal ProcessHandle As Long, ByVal DesiredAccess As Long, TokenHandle As Long) As Long
Private Declare Function GetTokenInformation Lib “advapi32.dll“ (ByVal TokenHandle As Long, ByVal TokenInformationClass As Long, TokenInformation As Any, ByVal TokenInformationLength As Long, ReturnLength As Long) As Long
Private Declare Function OpenProcess Lib “kernel32.dll“ (ByVal dwDesiredAccessas As Long, ByVal bInheritHandle As Long, ByVal dwProcId As Long) As Long
Private Declare Function CloseHandle Lib “kernel32“ (ByVal hObject As Long) As Long

Private Const PROCESS_QUERY_INFORMATION = 1024
Private Const PROCESS_VM_READ = 16
Private Const SECURITY_BUILTIN_DOMAIN_RID = &H20&
Private Const SECURITY_NT_AUTHORITY = &H5
Private Const DOMAIN_ALIAS_RID_USERS = &H221
Private Const TOKEN_READ = &H20008
Private Const TokenUser = 1

Private Type SID_IDENTIFIER_AUTHORITY
Value(6) As Byte
End Type

Private Type SID_AND_ATTRIBUTES
SID As Long
Attributes As Long
End Type

Private Type TOKEN_USER
User As SID_AND_ATTRIBUTES
SID(500) As Byte
End Type

Private Function GetPrcUserName(ByVal pID As Long) As String

Dim hProcessID As Long
Dim hToken As Long
Dim res As Long
Dim cbBuff As Long
Dim tiLen As Long
Dim TU As TOKEN_USER
Dim cnt As Long
Dim sAcctName2 As String
Dim cbAcctName As Long
Dim sDomainName As String
Dim cbDomainName As Long
Dim peUse As Long
Dim barr() As Byte

hProcessID = OpenProcess(PROCESS_QUERY_INFORMATION Or PROCESS_VM_READ, 0, pID)
If hProcessID <> 0 Then
If OpenProcessToken(hProcessID, TOKEN_READ, hToken) = 1 Then ’这一步可能失败
res = GetTokenInformation(hToken, TokenUser, ByVal 0, tiLen, cbBuff)
If res = 0 And cbBuff > 0 Then
tiLen = cbBuff
If cbBuff > Len(TU) Then Exit Function
res = GetTokenInformation(hToken, TokenUser, TU, tiLen, cbBuff)
If res = 1 And tiLen > 0 Then
sAcctName2 = Space$(255)
sDomainName = Space$(255)
cbAcctName = 255
cbDomainName = 255
res = LookupAccountSid(vbNullString, TU.User.SID, sAcctName2, cbAcctName, sDomainName, cbDomainName, peUse)
GetPrcUserName = Replace(Trim(sAcctName2), Chr(0), ““)
End If
End If
Else
GetPrcUserName = “OpenProcessToken 失败“
End If
If hToken Then CloseHandle hToken
CloseHandle hProcessID
End If

End Function


[GLOW=255,DeepPink,3]我的免费网盘[/GLOW]
2006-12-29 11:03
学习VB才2天
Rank: 5Rank: 5
等 级:贵宾
威 望:16
帖 子:1653
专家分:0
注 册:2006-5-4
收藏
得分:0 
在WEBBROWSER1中判斷網頁是否打開`````

Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
'检测URL,如果与你指定的URL一样,则表示正常打开

if lcase(url)=lcase("http:aaaa.bbbb.com") then msgbox "打开网页!"

End Sub

[GLOW=255,DeepPink,3]我的免费网盘[/GLOW]
2006-12-29 11:05
tang688
Rank: 5Rank: 5
等 级:贵宾
威 望:16
帖 子:1219
专家分:35
注 册:2004-12-25
收藏
得分:0 
还是学了二天的人厉害,我就不会.

2006-12-29 14:36
griefforyou
Rank: 6Rank: 6
等 级:贵宾
威 望:27
帖 子:3336
专家分:0
注 册:2004-4-15
收藏
得分:0 
可以用ShellWindows枚举到IE和WebBrowser控件中打开的网址。

天津网站建设 http://www./
2006-12-29 14:42
r316999443
Rank: 7Rank: 7Rank: 7
来 自:星城长沙
等 级:黑侠
威 望:1
帖 子:597
专家分:501
注 册:2006-11-7
收藏
得分:0 
谢谢啊!!我就去试试
2006-12-30 11:57
r316999443
Rank: 7Rank: 7Rank: 7
来 自:星城长沙
等 级:黑侠
威 望:1
帖 子:597
专家分:501
注 册:2006-11-7
收藏
得分:0 
我没找着WebBrowser控件是不是我用的系统问题我是2003
或者是没有这控件
2006-12-30 12:07
快速回复:怎样判断一个网页是否打开呢?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.038669 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved