VB-2.1
2011年09月26日
Option Explicit
Dim seaid As Integer
Dim id1 As Integer
Dim txt As String
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameter As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private Declare Function GetPrivateProfileString Lib "Kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, lpKeyName As Any, ByVal lpDefault As String, ByVal lpRetunedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
Private Declare Function WritePrivateProfileString Lib "Kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As String) As Long
Private r As Long
Private entry As String
Private iniPath As String
Function GetFormINI(AppName As String, KeyName As String, FileName As String) As String
Dim RetStr As String
RetStr = String(255, Chr(0))
GetFormINI = Left(RetStr, GetPrivateProfileString(AppName, ByVal KeyName, "", RetStr, Len(RetStr), FileName))
End Function
Private Sub Combo1_Click()
seaid = Combo1.ListIndex 'seaid为目前combobox现行选中项
WritePrivateProfileString "配置设置", "seaid", CStr(seaid), iniPath
If seaid = 0 Then
Option1.Caption = "新闻"
Option2.Caption = "网页"
Option3.Caption = "贴吧"
Option4.Caption = "知道"
Option5.Caption = "音乐"
Option6.Caption = "图片"
Option7.Caption = "视频"
Option8.Caption = "地图"
Option9.Caption = "百科"
Option10.Caption = "文库"
Option11.Caption = "词典"
ElseIf seaid = 1 Then
Option1.Caption = "新闻"
Option2.Caption = "网页"
Option3.Caption = "购物"
Option4.Caption = "学术"
Option5.Caption = "音乐"
Option6.Caption = "图片"
Option7.Caption = "视频"
Option8.Caption = "地图"
Option9.Caption = "翻译"
Option10.Caption = "图书"
Option11.Caption = "Code"
ElseIf seaid = 2 Then
'此处加入其他选中项时显示的相关内容
End If
If id1 = 1 Then
Option1_Click
ElseIf id1 = 2 Then
Option2_Click
ElseIf id1 = 3 Then
Option3_Click
ElseIf id1 = 4 Then
Option4_Click
ElseIf id1 = 5 Then
Option5_Click
ElseIf id1 = 6 Then
Option6_Click
ElseIf id1 = 7 Then
Option7_Click
ElseIf id1 = 8 Then
Option8_Click
ElseIf id1 = 9 Then
Option9_Click
ElseIf id1 = 10 Then
Option10_Click
ElseIf id1 = 11 Then
Option11_Click
End If
End Sub
Public Function UTF8Encode(ByVal szInput As String) As String '此函数将汉字转换成UTF8编码
Dim wch As String
Dim uch As String
Dim szRet As String
Dim x As Long
Dim inputLen As Long
Dim nAsc As Long
Dim nAsc2 As Long
Dim nAsc3 As Long
If szInput = "" Then
UTF8Encode = szInput
Exit Function
End If
inputLen = Len(szInput)
For x = 1 To inputLen
wch = Mid(szInput, x, 1)
nAsc = AscW(wch)
If nAsc "" Then
If seaid = 0 Then
WebBrowser1.Navigate "http://news.baidu.com/ns?word=" + Text1.Text
ElseIf seaid = 1 Then
WebBrowser1.Navigate "http://www.google.com.hk/search?hl=zh-CN&gl=cn&tbm=nws&btnmeta_news_search=1&q=" + txt
End If
Else
If seaid = 0 Then
WebBrowser1.Navigate "http://news.baidu.com/"
ElseIf seaid = 1 Then
WebBrowser1.Navigate "http://news.google.com/"
End If
End If
id1 = 1
WritePrivateProfileString "配置设置", "id1", CStr(id1), iniPath
End Sub
Private Sub Option10_Click() '文库
If Text1.Text "" Then
If seaid = 0 Then
WebBrowser1.Navigate "http://wenku.baidu.com/search?word=" + Text1.Text
ElseIf seaid = 1 Then
WebBrowser1.Navigate "http://www.google.com.hk/search?q=" + txt + "&btnG=%E6%90%9C%E7%B4%A2%E5%9B%BE%E4%B9%A6&tbm=bks&tbo=1&hl=zh-CN"
End If
Else
If seaid = 0 Then
WebBrowser1.Navigate "http://wenku.baidu.com/"
ElseIf seaid = 1 Then
WebBrowser1.Navigate "http://books.google.com.hk/books?hl=zh-CN"
End If
End If
id1 = 10
WritePrivateProfileString "配置设置", "id1", CStr(id1), iniPath
End Sub
Private Sub Option11_Click() '词典
If Text1.Text "" Then
If seaid = 0 Then
WebBrowser1.Navigate "http://dict.baidu.com/s?wd=" + Text1.Text
ElseIf seaid = 1 Then
WebBrowser1.Navigate "http://code.google.com/intl/zh-CN/query/#q=" + txt
End If
Else
If seaid = 0 Then
WebBrowser1.Navigate "http://dict.baidu.com/s?wd=" + Text1.Text
ElseIf seaid = 1 Then
WebBrowser1.Navigate "http://code.google.com/intl/zh-CN/"
End If
End If
id1 = 11
WritePrivateProfileString "配置设置", "id1", CStr(id1), iniPath
End Sub
Private Sub Option2_Click() '新闻
If Text1.Text "" Then
If seaid = 0 Then
WebBrowser1.Navigate "http://www.baidu.com/s?wd=" + Text1.Text
ElseIf seaid = 1 Then
WebBrowser1.Navigate "http://www.google.com.hk/webhp?hl=zh-CN&source=hp#hl=zh-CN&source=hp&q=" + txt
End If
Else
If seaid = 0 Then
WebBrowser1.Navigate "http://www.baidu.com/"
ElseIf seaid = 1 Then
WebBrowser1.Navigate "http://www.google.com.hk/"
End If
End If
id1 = 2
WritePrivateProfileString "配置设置", "id1", CStr(id1), iniPath
End Sub
Private Sub Option3_Click() '贴吧
If Text1.Text "" Then
If seaid = 0 Then
WebBrowser1.Navigate "http://tieba.baidu.com/f?kw=" + Text1.Text
ElseIf seaid = 1 Then
WebBrowser1.Navigate "http://www.google.cn/products?q=" + txt
End If
Else
If seaid = 0 Then
WebBrowser1.Navigate "http://tieba.baidu.com/"
ElseIf seaid = 1 Then
WebBrowser1.Navigate "http://www.google.cn/prdhp?hl=zh-CN&tab=ff"
End If
End If
id1 = 3
WritePrivateProfileString "配置设置", "id1", CStr(id1), iniPath
End Sub
Private Sub Option4_Click() '知道
If Text1.Text "" Then
If seaid = 0 Then
WebBrowser1.Navigate "http://zhidao.baidu.com/q?word=" + Text1.Text + "&ct=17&pn=0&tn=ikaslist&rn=10&lm=0&fr=search"
ElseIf seaid = 1 Then
WebBrowser1.Navigate "http://scholar.google.com.hk/scholar?q=" + txt
End If
Else
If seaid = 0 Then
WebBrowser1.Navigate "http://zhidao.baidu.com/"
ElseIf seaid = 1 Then
WebBrowser1.Navigate "http://scholar.google.com.hk/schhp?hl=zh-CN&as_sdt=0,5"
End If
End If
id1 = 4
WritePrivateProfileString "配置设置", "id1", CStr(id1), iniPath
End Sub
Private Sub Option5_Click() '音乐
If Text1.Text "" Then
If seaid = 0 Then
WebBrowser1.Navigate "http://mp3.baidu.com/m?f=ms&rf=idx&tn=baidump3&ct=134217728&lf=&rn=&word=" + Text1.Text
ElseIf seaid = 1 Then
WebBrowser1.Navigate "http://www.google.cn/music/search?q=" + txt
End If
Else
If seaid = 0 Then
WebBrowser1.Navigate "http://mp3.baidu.com/"
ElseIf seaid = 1 Then
WebBrowser1.Navigate "http://www.google.cn/music/"
End If
End If
id1 = 5
WritePrivateProfileString "配置设置", "id1", CStr(id1), iniPath
End Sub
Private Sub Option6_Click() '图片
If Text1.Text "" Then
If seaid = 0 Then
WebBrowser1.Navigate "http://image.baidu.com/i?ct=201326592&cl=2&lm=-1&tn=baiduimage&istype=2&fm=index&pv=&z=0&word=" + Text1.Text
ElseIf seaid = 1 Then
WebBrowser1.Navigate "http://www.google.com.hk/search?tbm=isch&hl=zh-CN&source=hp&biw=1366&bih=573&q=" + txt
End If
Else
If seaid = 0 Then
WebBrowser1.Navigate "http://image.baidu.com/"
ElseIf seaid = 1 Then
WebBrowser1.Navigate "http://www.google.com.hk/imghp?hl=zh-CN&tab=wi"
End If
End If
id1 = 6
WritePrivateProfileString "配置设置", "id1", CStr(id1), iniPath
End Sub
Private Sub Option7_Click() '视频
If Text1.Text "" Then
If seaid = 0 Then
WebBrowser1.Navigate "http://video.baidu.com/v?word=" + Text1.Text
ElseIf seaid = 1 Then
WebBrowser1.Navigate "http://www.google.com.hk/search?q=" + txt + "&tbo=p&tbm=vid&source=vgc&hl=zh-CN&aq=f"
End If
Else
If seaid = 0 Then
WebBrowser1.Navigate "http://video.baidu.com/"
ElseIf seaid = 1 Then
WebBrowser1.Navigate "http://www.google.com.hk/videohp?hl=zh-CN&tab=wv"
End If
End If
id1 = 7
WritePrivateProfileString "配置设置", "id1", CStr(id1), iniPath
End Sub
Private Sub Option8_Click() '地图
If Text1.Text "" Then
If seaid = 0 Then
WebBrowser1.Navigate "http://map.baidu.com/?newmap=1&ie=utf-8&s=s%26wd%3D" + Text1.Text
ElseIf seaid = 1 Then
WebBrowser1.Navigate "http://ditu.google.cn/maps?q=" + txt
End If
Else
If seaid = 0 Then
WebBrowser1.Navigate "http://map.baidu.com/"
ElseIf seaid = 1 Then
WebBrowser1.Navigate "http://ditu.google.cn/"
End If
End If
id1 = 8
WritePrivateProfileString "配置设置", "id1", CStr(id1), iniPath
End Sub
Private Sub Option9_Click() '百科
If Text1.Text "" Then
If seaid = 0 Then
WebBrowser1.Navigate "http://baike.baidu.com/notexists?word=" + Text1.Text
ElseIf seaid = 1 Then
WebBrowser1.Navigate "http://translate.google.cn/?q=" + txt
End If
Else
If seaid = 0 Then
WebBrowser1.Navigate "http://baike.baidu.com/"
ElseIf seaid = 1 Then
WebBrowser1.Navigate "http://translate.google.cn/"
End If
End If
id1 = 9
WritePrivateProfileString "配置设置", "id1", CStr(id1), iniPath
End Sub
Private Sub Text1_Change()
txt = UTF8Encode(Text1.Text)
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
If id1 = 1 Then
Call Option1_Click
ElseIf id1 = 2 Then
Call Option2_Click
ElseIf id1 = 2 Then
Call Option2_Click
ElseIf id1 = 3 Then
Call Option3_Click
ElseIf id1 = 4 Then
Call Option4_Click
ElseIf id1 = 5 Then
Call Option5_Click
ElseIf id1 = 6 Then
Call Option6_Click
ElseIf id1 = 7 Then
Call Option7_Click
ElseIf id1 = 8 Then
Call Option8_Click
ElseIf id1 = 9 Then
Call Option9_Click
ElseIf id1 = 10 Then
Call Option10_Click
ElseIf id1 = 11 Then
Call Option11_Click
End If
End If
End Sub
发表评论
-
C和C++之间库的互相调用
2012-01-20 12:20 644C和C++之间库的互相调用 2011年01月19日 1. ... -
linux文件缓冲区
2012-01-20 12:20 990linux文件缓冲区 2011年01 ... -
字母大小写转换可以不用循环吗
2012-01-20 12:20 716字母大小写转换可以不用循环吗 2011年03月22日 2 ... -
VC6下将ANSI程序转化为UNICODE基本步骤
2012-01-20 12:20 1220VC6下将ANSI程序转化为UNI ... -
Linux0.11内核--汇编和C语言混合编程之参数传递
2012-01-20 12:20 770Linux0.11内核--汇编和C语言混合编程之参数传递 2 ... -
3月编程语言排行榜:C#超Python和PHP
2012-01-19 17:01 8043月编程语言排行榜:C#超Python和PHP 2011年0 ... -
python os模块
2012-01-19 17:01 1015python os模块 2011年05月22日 os.l ... -
2010年IT薪酬报告:java,apex,python,windows技术最赚钱
2012-01-19 17:01 7732010年IT薪酬报告:java,apex ... -
python 实现多台UNIX服务器自动巡检
2012-01-19 17:01 1829python 实现多台UNIX服务器自动巡检 2012年01 ... -
初学Python有感!!!
2012-01-19 17:01 566初学Python有感!!! 2011年01月25日 ... -
VC++6.0实现超链接
2012-01-17 06:46 1203VC++6.0实现超链接 2011年 ... -
经典的串口调试助手源代码(一)
2012-01-17 06:46 839经典的串口调试助手源代码(一) 2011年05月26日 ... -
经典的串口调试助手源代码(一)
2012-01-17 06:46 1123经典的串口调试助手源代码(一) 2011年04月26日 ... -
转 Windows API 函数在VFP中的运用
2012-01-17 06:46 1178转 Windows API 函数在VFP中的运用 2010年 ... -
越南攻略
2012-01-16 05:36 566越南攻略 2010年07月02日 ... -
去越南相亲吧~~~~~
2012-01-16 05:36 588去越南相亲吧~~~~~ 2011年05月04日 越南,一 ... -
谷歌找客户的方法
2012-01-16 05:35 566谷歌找客户的方法 2011年12月16日 Wind怎么利 ...
相关推荐
简介(Introduction) 免费的源代码行数统计工具,...可以对 C++、VB.Net、VB、C#、JAVA、Delphi、ASP.Net、ASP、JSP、PHP、HTML 等项目的代码行数、工数和成本进行统计,并能保存统计的结果。 下载地址(Download) ...
简介(Introduction) 免费的源代码行数统计工具,...可以对 C++、VB.Net、VB、C#、JAVA、Delphi、ASP.Net、ASP、JSP、PHP、HTML 等项目的代码行数、工数和成本进行统计,并能保存统计的结果。 下载地址(Download) ...
图书馆信息管理系统-数据库课程设计VB-SQL 9 摘 要 在计算机日益普及的今天,图书作为教学和学习必不可少的工具,采用一套行之有效的图书管理系统来管理书籍就显得尤为重要。而图书资料的管理需要有效的图书管理软件...
免费的源代码行数统计工具,支持20多种代码格式。具有统计迅速、准确的优点...可以对 C++、VB.Net、VB、C#、JAVA、Delphi、ASP.Net、ASP、JSP、PHP、HTML 等项目的代码行数、工数和成本进行统计,并能保存统计的结果。
vbdox 2.1 源代码,用于vb项目自动书写帮助文档.支持vb6.供学习参考.
VB2.1的复习题,有需要VB等级考试的可以下载观看。
clswindow是vb下控制外部程序的一个框架,封装了很多简单使用的操作函数。详细介绍:https://blog.csdn.net/sysdzw/article/details/9083313 看到网上某豪的登录器,用了下完全就是操作外部程序嘛,这个我们用...
vb编程 文本编辑器设计思路目录 1.选题的意义 ------------------- ----5 2.系统的功能能分 ------------- ------7 2.1 系统概述 ------------------ -----7 2.2 系统的构成 ----------- ---- ----8 2.3系统的...
cocos2d-x入门 魔塔源码(高级,基于cocos2d-2.1rc0-x-2.1.2/iOS)
VB 游戏编程学习系统 2.1
很好用哦,每道题都有解释,不过貌似只有VB部分的题目,没有公共基础的题....这是未注册版...需要再下一个注册补丁
VB-CAD二次开绘制点和相对坐
VB6搭桥小游戏(含源码)V2.1 '描 述:这是网页上比较常见的小游戏,今天闲来用vb写了下,还是有点不足 '使用方法:点击小人所在的墙块,鼠标摁住的时间长短控制桥的长度,以保证小人顺利通过 '编 程:sysdzw 原创...
刷卡后自动读取卡RFID卡卡片信息 RFID卡读卡器参数设置 RFID卡卡片信息写入
版本: 1.2.2.1 [如果有新版本 大家可以用SelfUpdater.exe进行升级.] 下载后大家使用checksum.txt检查MD5合格后在运行程序.其他信息在readme(en).txt里写有[只不过是英文的..] 要求: 此程序用VB.NET 2008 (VB9)写的...
程序语言基础 2.1 数据类型 2.2 VB.NET的变量 2.3 VB .NET的常量 2.4 运算符 与 表达式 2.5 语句 2.6 常用系统内部函数
2.1 vb概述 1 2.2 vb发展历史 1 2.3 vb语言特性 2 3.系统分析 4 3.1选题原则 4 3.2应用前景 4 4.系统总体设计 5 4.1项目名称 5 4.2总体模块图 5 4.3主要控件设置 5 4.4主要功能说明 6 5.系统详细设计 7 5.1初始化...
VB编写的XP风格文件生成器 Ver 2.1(更新版)[XPStylemanifestmaker.rar]-精品源代码
phpDesigner是一款强大的PHP开发软件,软件不但支持PHP,还支持HTML,XHTML,CSS,Java,Perl,JavaScript,VB,C#,SQL,phpDesigner具有智能语法标识,及时识别语法错误。