VB程序员博客
Archive for the 'VB程序开发' Category
02 6th, 2010
dim cn as new adodb.connection
cn.open ""
str1="update tab set a=1 where …"
str2="update tab set a=12 where …"
str3="update tab set a=12 where …"
str4="update tab set a=12 where …"
str5="update tab set a=12 where …"
…
cn.execute str1
cn.execute str2
cn.execute str3
cn.execute str4
cn.execute str5
…
现在想把…包含的部分变成下列形式(但是下列的形式是错误的),请问如何实现。或帮我改易下页可以。
for i=0 to 2000
cn.execute str & (i+1)
next
为什么要写成上面的形式,我觉得这样好修改比较方便。另外不占地方.
dim str1(1 to 5) as string ' str是系统函数,所以用str1
str1(1)="update tab set a=1 where …"
str1(2)="update tab set a=12 where …"
str1(3)="update tab set a=12 where …"
str1(4)="update tab set a=12 where …"
str1(5)="update tab set a=12 where …"
for i=0 to 2000
cn.execute str1(i+1)
next
for i=0 to 2000
str="update tab set a=" & (i+1) & " where …"
cn.execute str
next
for i=0 to 2000
strsql="update tab set a=" & (i+1) & " where …"
cn.execute strsql
next
错误原因在于VB不支持直接使用指针。
延续1楼的思路,使用更有效率的批更新:
dim str1(1 to 5) as string ' str是系统函数,所以用str1
str1(1)="update tab set a=1 where …"
str1(2)="update tab set a=12 where …"
str1(3)="update tab set a=12 where …"
str1(4)="update tab set a=12 where …"
str1(5)="update tab set a=12 where …"
dim UpdateString as string
UpdateString = "BEGIN TRANSACTION" & chr(13) & chr(10)
for i=0 to 2000
updatestring=updatestring & str1(i+1) & chrw(13) & chrw(10)
next
updatestring = updatestring & "COMMIT TRANSACTION"
cn.execute updatestring
02 6th, 2010
Class1:
Public………
Module1:
Public Declare Function CreateThread Lib "kernel32.dll" ( _
ByVal lpThreadAttributes As Long, _
ByVal dwStackSize As Long, _
ByVal lpStartAddress As Long, _
ByVal lpParameter As Long, _
ByVal dwCreationFlags As Long, _
ByRef lpThreadId As Long) As Long
Public Function MyThread1(sss As Long) As Long
Dim cla1 As Class1
Set cla1= New Class1'程序运行到这里就崩溃了,为什么?请师傅来帮帮忙忙?
………'这里引用cla1的Public也会崩溃
End Function
Private Sub Form_Load()
Dim lRet1 As Long
lRet1 = CreateThread(0, 24096, AddressOf Module1.MyThread1, 0, 0, ByVal 0) '建立线程
End Sub
在窗体模块中调用一下,看是否也崩溃?如果是,就有标准模块无关,而是代码本身的问题。
从上面的代码来看没什么问题,可以在标准模块里面写的.
应该是你的类模块里的代码不对
02 6th, 2010
dim cn as new adodb.connection
cn.open ""
str1="update tab set a=1 where …"
str2="update tab set a=12 where …"
str3="update tab set a=12 where …"
str4="update tab set a=12 where …"
str5="update tab set a=12 where …"
…
cn.execute str1
cn.execute str2
cn.execute str3
cn.execute str4
cn.execute str5
…
现在想把…包含的部分变成下列形式(但是下列的形式是错误的),请问如何实现。或帮我改易下页可以。
for i=0 to 2000
cn.execute str & (i+1)
next
为什么要写成上面的形式,我觉得这样好修改比较方便。另外不占地方.
dim str1(1 to 5) as string ' str是系统函数,所以用str1
str1(1)="update tab set a=1 where …"
str1(2)="update tab set a=12 where …"
str1(3)="update tab set a=12 where …"
str1(4)="update tab set a=12 where …"
str1(5)="update tab set a=12 where …"
for i=0 to 2000
cn.execute str1(i+1)
next
for i=0 to 2000
str="update tab set a=" & (i+1) & " where …"
cn.execute str
next
for i=0 to 2000
strsql="update tab set a=" & (i+1) & " where …"
cn.execute strsql
next
错误原因在于VB不支持直接使用指针。
延续1楼的思路,使用更有效率的批更新:
dim str1(1 to 5) as string ' str是系统函数,所以用str1
str1(1)="update tab set a=1 where …"
str1(2)="update tab set a=12 where …"
str1(3)="update tab set a=12 where …"
str1(4)="update tab set a=12 where …"
str1(5)="update tab set a=12 where …"
dim UpdateString as string
UpdateString = "BEGIN TRANSACTION" & chr(13) & chr(10)
for i=0 to 2000
updatestring=updatestring & str1(i+1) & chrw(13) & chrw(10)
next
updatestring = updatestring & "COMMIT TRANSACTION"
cn.execute updatestring
02 6th, 2010
Class1:
Public………
Module1:
Public Declare Function CreateThread Lib "kernel32.dll" ( _
ByVal lpThreadAttributes As Long, _
ByVal dwStackSize As Long, _
ByVal lpStartAddress As Long, _
ByVal lpParameter As Long, _
ByVal dwCreationFlags As Long, _
ByRef lpThreadId As Long) As Long
Public Function MyThread1(sss As Long) As Long
Dim cla1 As Class1
Set cla1= New Class1'程序运行到这里就崩溃了,为什么?请师傅来帮帮忙忙?
………'这里引用cla1的Public也会崩溃
End Function
Private Sub Form_Load()
Dim lRet1 As Long
lRet1 = CreateThread(0, 24096, AddressOf Module1.MyThread1, 0, 0, ByVal 0) '建立线程
End Sub
在窗体模块中调用一下,看是否也崩溃?如果是,就有标准模块无关,而是代码本身的问题。
从上面的代码来看没什么问题,可以在标准模块里面写的.
应该是你的类模块里的代码不对
02 6th, 2010
虽然我会在WebBrowser里屏蔽掉IE的那个右键菜单,自定义菜单显示,但是我不想那样做,
只想保留IE原始右键菜单,但里面的那个“查看源文件”屏蔽掉,或者让它 点击无效
经过研究注册表,在注册表里找不到可以修改原始的那个“查看源文件”
注册表只可以添加新的右键菜单,不能删除和修改原始菜单
大虾们支招了ⷂ𗂷ⷼ/
同问ⷂ𗂷ⷂ𗂷
有志同道合的兄弟啊,谢谢帮顶ⷂ𗂷
把记事本删除就行了
别想了,难道你还能禁掉不同浏览器的主菜单。
甚至遨游还有一个 ViewPage 插件。
02 5th, 2010
小弟做了个程序,是自动点击的,调用的mouse_event
本来打算在虚拟桌面运行它就影响不到正常桌面的操作了,结果一运行发现,在虚拟桌面调用mouse_event照样会在正常桌面移动。。。这下可苦恼了!!!
请问下各位大大,有没办法让虚拟桌面调用mouse_event的时候不影响正常桌面的使用呢?
求求你们啦~~
我用的是setcursorpos来定位位置哈,然后再mouse_event
在虚拟桌面调用按键精灵,就不会影响到正常桌面,不知怎么做的呢,求求大家帮我想象办法吧~~~
哪是直接给窗口发送键盘消息,而 mouse_event 是全局事件。
那按键精灵为什么在桌面运行时也会像人工移动和点击一样呢?他这个消息是如何做的跟真的一样的呢?
请您讲解下好么
hook
能讲清楚点么
直接向窗体发 WM_MOUSEMOVE、WM_LBUTTONDOWN、WM_LBUTTONUP 等消息
。。。有很多程序都不支持消息的,一看就是伪造的。。。有其他办法么
没人回答么?
我想弄清楚的是:
像按键精灵一样,在虚拟桌面是跟人工移动一样的效果,但是回到原桌面又不会影响原桌面的鼠标
友情顶贴…………
按键精灵能在屏幕任何地方点击,这么说,他应该是全局的吧?
mouse_event也是全局的,为什么会影响到每一个虚拟桌面呢?
如果能像他一样,在哪个桌面,就影响到那个桌面就好了
真搞不懂。。。头都大了。。。今天又睡不着了。。。
可怜喔。。。。
麻烦能用个像按键精灵那种思路的好吗?
就是只影响一个桌面的
谢啦
继续求助,请各位大侠帮忙哈~~~
使用按键精灵不影响其它操作吗
不要管是否麻烦,先完成功能要紧,然后再考虑优化 改进
02 5th, 2010
我不要代码,只要原理,就像安全监控软件那样,监控特定API的调用。当然我知道是用HOOK,不过因为缺少资料不知如何入手,大家帮帮忙,谢了额,如果有相关资料给个下载地址好吗?
首先你得了解汇编指令的jmp
比如常见的e9,ff25等
<
学习了。。。。。。
计算机组成原理→DOS命令→汇编语言→C语言、代码书写规范→数据结构、编译原理、操作系统→计算机网络、数据库原理、正则表达式→其它语言、架构……
<
02 5th, 2010
QQ2009和别人语音的时候,我设置成图标不显示,最小化以后,就看不见了,但是如果对方关闭了和我语音的这个对话框,我和他聊天的这个QQ窗口就在任务栏显示出来,而且一亮一亮的闪
这个窗口是处于什么状态的?怎么检测出这个窗口的句柄并关闭掉它?
也就是怎么检测出我原来最小化的那个窗口和突然跳出来的这个窗口之间的变化.
求助求助.在线等着………………………
还有个办法,能不能直接隐藏起这个窗口来?让他在下边看不见.我按个热键,它就显示出来,这个该比较简单.

我使用程序检测这种状态
..算啦..我已经解决啦..可以直接隐藏起来这个窗口,就看不见了.但是上边的问题是永远也不了解了.
………………
02 5th, 2010
Public Sub UpData() '在线升级
On Error Resume Next
Dim MyData() As Byte, VerInfo() As Byte, Ti As Long, Tj As Long
If Inet1.StillExecuting = True Then Exit Sub
VerInfo() = Inet1.OpenURL("http://www.xxx.com/uploadsoft/update.txt", icString)
Ti = InStr(1, VerInfo, vbCrLf) + 2
Tj = InStr(Ti, VerInfo, vbCrLf)
'检测版本号
If Val(Left$(VerInfo, Ti - 3)) <= Val(App.Major & "." & App.Minor & App.Revision) Then Exit Sub
If MsgBox("SWpsF 发布了新的版本:" + Left$(VerInfo, Ti - 3) + ",文件大小:" + Mid$(VerInfo, Tj + 2) + ",是否进行在线升级 ?", vbYesNo + vbQuestion, "在线升级") = vbNo Then Exit Sub
IsUp = True
'开始下载更新文件
MyData() = Inet1.OpenURL("http://www.xxx.com/uploadsoft/" + Mid$(VerInfo, Ti, Tj - Ti), icByteArray)
Open App.Path + "" + Mid$(VerInfo, Ti, Tj - Ti) For Binary Access Write As #1
Put #1, , MyData()
Close #1
IsUp = False
'执行更新文件
ShellExecute 0, vbNullString, App.Path + "" + Mid$(VerInfo, Ti, Tj - Ti), vbNullString, App.Path, SW_SHOWNORMAL
End
End Sub
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
在执行了put #1,,mydata() 以后,写出的文件是一个4K大小的文件,文件名是一样的,不是我想要下来的文件,请高手帮看下有什么问题,还有啊,后面这个SHELLEXECUTE可以在本程序执行的时候强制关闭掉本身而运行那个程序吗?
————天.没高手了/
留下你的邮箱,确认你已给分后,再发给你!!
…我一定给你分啊…lyxrkj@163.com发给我好了.
好吧.
给你了
分给你啦/赶紧的发来
02 5th, 2010
由来见此贴
http://topic.csdn.net/u/20100113/10/d33d20cb-6ddd-417c-ad66-41a8e46c0935.html?87174
论坛好像不能贴视频,只能给链接了
http://www.tudou.com/programs/view/1DAYQS485zM/
非常雷人,点击者自重
楼主好湿
雷的外焦里嫩 楼主太有才了
请大家自备避雷针 
路过……
<
外焦内嫩~~~~~
jf
唱的太难听了….只能看看…
JF
jf
来jf
接分
<
似乎是散分,接下……
好湿
nx
真是难听
如需要阅读该回复,请