VB程序员博客

VB程序开发

本人 想做一个淘宝自动登录器 但是老是报错 各位大哥帮帮忙 项目就差这一点了
https://login.taobao.com/member/login.jhtml?f=top&redirectURL=http%3A%2F%2Fwww.taobao.com%2F
就是这个页面 请各位看看 谢谢啦
高人帮帮忙啊是在 VB 中用 WebBrowser控件 打开网页进行登录吗?


有点急~~谢谢各位~~
VB6.0的代码怎样转换到VB2008上要看具体的代码,不是能够100%转换的。
http://topic.csdn.net/u/20100116/10/a8ca2cf7-4b9e-4cbe-bc98-9b8c338a1656.htmlPrivate Sub Command2_Click()
  Dim a, b, c
  Do
    a = Int(Rnd * 12) + 1
    b = Int(Rnd * 12) + 1
    c = Int(Rnd * 12) + 1
    If a / b = c Then
        Debug.Print a; "㷦quot;; b; "="; c
        Exit Do
    End If
  Loop

End Sub

Private Sub Form_Load()
    Randomize Timer
End Sub

以上是vb6.0的code  我在VB2008里那个Debug.Print a; "㷦quot;; b; "="; c中的 a; 下面有错误线提示
还有那个 Randomize Timer 中的Timer也有,谢谢帮忙~~~ 这是个关于被除数,除数,商都是1-12的整数,也就是说被除数一定能被除数整除,就像4除以2等于2,12除以6等于2 

是在VB2008里,谢谢  帮忙~~~~

If RadioButton4.Checked = True Then
            Dim a = TextBox1.Text, b = TextBox2.Text, c = TextBox4.Text
            Do
                a = Int(Rnd() * 12) + 1
                b = Int(Rnd() * 12) + 1
                c = Int(Rnd() * 12) + 1
                If a / b = c Then
                    Debug.Print("{0}㷻1}={2}", a, b, c)
                    Exit Do
                End If
            Loop
        End If

以上这种情况我运行了  没数在textbox里啊 
  If RadioButton4.Checked = True Then
            TextBox1.Text = Int((12 * Rnd()) + 1)
            TextBox2.Text = Int((12 * Rnd()) + 1)
            Dim a = TextBox1.Text, b = TextBox2.Text, c = TextBox4.Text
            Do
                a = Int(Rnd() * 12) + 1
                b = Int(Rnd() * 12) + 1
                c = Int(Rnd() * 12) + 1
                If a / b = c Then
                    Debug.Print("{0}㷻1}={2}", a, b, c)
                    Exit Do
                End If
            Loop
        End If
这种情况有数  但被除数不能被除数刚好整除  谢谢~~~这个跟转换代码有关系么?没有~~但~~我最终要解决的就是这个整除问题~~大哥,你能帮上忙吗?  我先把代码的分给你。  谢谢你~~~“VB中怎样使被除数,除数,商都是1-12的整数”  这是我发的帖~~ 


Private Sub Command1_Click()
Shell "E:桌面\新建文件夹123.txt", vbNormalFocus
End Sub

网上有人说是用这个打开程序啊,难道就不能用这来打开文本吗,是可看见的打开,就像平常我们打开一个程序那样,并不是那种Opne #什么的打开错误提示:无效的过程或参数此"打开"非彼"打开"也.<

晕!找到答案了

Shell "notepad.exe " & App.Path & "123.txt", vbNormalFocus
Shell "explorer.exe " & App.Path & "每日.html", vbNormalFocus<
<
<
<


客户打印机从COM变成USB,现在需要USB方面的代码。

用printer对象写打印代码,用打印机打印,与打印口无关
COM或USB  有什么关系?<
那就是说我在程序中指定一个PRINTER的名称,用户添加的时候规定这个名称就可以了?

<


客户打印机从COM变成USB,现在需要USB方面的代码。

用printer对象写打印代码,用打印机打印,与打印口无关
COM或USB  有什么关系?<
那就是说我在程序中指定一个PRINTER的名称,用户添加的时候规定这个名称就可以了?

<


原型:
push -1
push eax
push edx
mov ecx,14FB5B4
call 8152C0

VB:

Private Sub Command1_Click()
Dim pid As Long
hwd = FindWindow(vbNullString, "测试程序")
GetWindowThreadProcessId hwd, pid 
hProcess = OpenProcess(PROCESS_ALL_ACCESS, 0, pid)
Dim asm As New clsASM
Dim a As String
Dim b As String
a = Text1.Text
b = Text2.Text
With asm
    .Pushad
    .Push -1
    .Mov_EAX (a)
    .Mov_EDX (b)
    .Push_EAX
    .Push_EDX
    .Mov_ECX &H14FB5B4 'ecx是一个重要参数
    .Mov_EBP &H8152C0
    .Call_EBP
    .Popad
    .ret
End With
asm.Run_ASM pid, 0
CloseHandle (hProcess)
End Sub

这段代码运行后会出错,不知道错在哪里,请教了!会出现什么错误?堆栈不平衡么?
你可以用ollydbg、windbg一类的调试器看看。
clsASM是自己写的代码?把代码贴出来看看。<
你如何确保 clsASM 中的 8152C0 与原汇编一致?


这里有一段代码,存储用户的图片信息到表格里:
Function Save_Image(CommDial As CommonDialog, FX As Long, Column As Field)
    Dim Identification As Long
   
    '—–> Position Record Pointer
    Pictures.MoveFirst
    Identification = txtCustID
    strFind = "CustID = " & Identification & ""
    Pictures.Find strFind
   
    '—–> Save Images
    Pictures.Edit
        DataFile = 1
        Open CommDial.FileName For Binary Access Read As DataFile
        FX = LOF(DataFile)    ' Length of data in file
   
        If FX = 0 Then
            Close DataFile
            Exit Function
        End If
       
        '—–> Split Up to Avoid Buffer Overflow
        Chunks = FX ChunkSize
        Fragment = FX Mod ChunkSize
        ReDim Chunk(Fragment)
        Get DataFile, , Chunk()
        Column.AppendChunk Chunk()
        ReDim Chunk(ChunkSize)
        For I = 1 To Chunks
            Get DataFile, , Chunk()
            Column.AppendChunk Chunk()
        Next I
   
        Close DataFile
    Pictures.Update

End Function
由于这段程序是连接ACCESS数据库用的,当我改连SQL SERVER数据库之后运行Pictures.Edit语句报错,我将Pictures.Edit和Pictures.Edit注释起来之后,运行整个工程文件是发现执行了这个Save_Image方法后再执行Pictures.Close会报错。(Pictures 是个RECORDSET对象)
谁能很好的理解代码告诉我改成连SQL数据库在这段代码里面一应该怎么改呢?
有关变量的定义如下:
Dim CustPicts As ADODB.Connection
Dim Pictures As ADODB.Recordset
Dim DataFile As Integer, Chunks As Integer
Dim Fragment As Integer, Chunk() As Byte, I As Integer
Const ChunkSize As Integer = 16384      '(16K Chunk Size)
Const LongValue As Long = 2147483647
非常感谢!参考这个:

使用流对象保存和显示图片
打开vb6,新建工程。

添加两个按钮,一个image控件
注意:Access中的photo字段类型为OLE对象.
SqlServer中的photo字段类型为Image

'** 引用 Microsoft ActiveX Data Objects 2.5 Library 及以上版本
‘2.5版本以下不支持Stream对象
Dim iConcstr As String
Dim iConc As ADODB.Connection

'保存文件到数据库中
Sub s_SaveFile()
    Dim iStm As ADODB.Stream
    Dim iRe As ADODB.Recordset
    Dim iConcstr As String

    '读取文件到内容
    Set iStm = New ADODB.Stream
    With iStm
        .Type = adTypeBinary  '二进制模式
        .Open
        .LoadFromFile App.Path + " est.jpg"
    End With
 

    '打开保存文件的表
    Set iRe = New ADODB.Recordset
    With iRe
        .Open "select * from img", iConc, 1, 3
        .AddNew        '新增一条记录
        .Fields("photo") = iStm.Read
        .Update
    End With
 

  '完成后关闭对象
    iRe.Close
    iStm.Close
End Sub

Sub s_ReadFile()
    Dim iStm As ADODB.Stream
    Dim iRe As ADODB.Recordset
    '打开表
Set iRe = New ADODB.Recordset
‘得到最新添加的纪录
    iRe.Open "select top 1 * from img order by id desc", iConc, adOpenKeyset, adLockReadOnly
    '保存到文件
    Set iStm = New ADODB.Stream
    With iStm
        .Mode = adModeReadWrite
        .Type = adTypeBinary
        .Open
        .Write iRe("photo")
‘这里注意了,如果当前目录下存在test1.jpg,会报一个文件写入失败的错误.
        .SaveToFile App.Path & " est1.jpg"
    End With
 

    Image1.Picture = LoadPicture(App.Path & " est1.jpg")
  '关闭对象
    iRe.Close
    iStm.Close
End Sub

Private Sub Command1_Click()
Call s_ReadFile
End Sub

Private Sub Command2_Click()
Call s_SaveFile
End Sub

Private Sub Form_Load()
    '数据库连接字符串
    iConcstr = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False" & _
        ";Data Source=F:csdn_vbdatabase保存图片\access图片img.mdb"

‘下面的语句是连接sqlserver数据库的.
    ‘iConcstr = "Provider=SQLOLEDB.1;Persist Security Info=True;" & _
‘ "User ID=sa;Password=;Initial Catalog=test;Data Source=yang"

  Set iConc = New ADODB.Connection
  iConc.Open iConcstr
End Sub

Private Sub Form_Unload(Cancel As Integer)
iConc.Close
Set iConc = Nothing
End Sub这个我看过了,可是我只想在原来已经成熟的代码上进行修改而已,应该只是一点小小的改动吧<


这里有一段代码,存储用户的图片信息到表格里:
Function Save_Image(CommDial As CommonDialog, FX As Long, Column As Field)
    Dim Identification As Long
   
    '—–> Position Record Pointer
    Pictures.MoveFirst
    Identification = txtCustID
    strFind = "CustID = " & Identification & ""
    Pictures.Find strFind
   
    '—–> Save Images
    Pictures.Edit
        DataFile = 1
        Open CommDial.FileName For Binary Access Read As DataFile
        FX = LOF(DataFile)    ' Length of data in file
   
        If FX = 0 Then
            Close DataFile
            Exit Function
        End If
       
        '—–> Split Up to Avoid Buffer Overflow
        Chunks = FX ChunkSize
        Fragment = FX Mod ChunkSize
        ReDim Chunk(Fragment)
        Get DataFile, , Chunk()
        Column.AppendChunk Chunk()
        ReDim Chunk(ChunkSize)
        For I = 1 To Chunks
            Get DataFile, , Chunk()
            Column.AppendChunk Chunk()
        Next I
   
        Close DataFile
    Pictures.Update

End Function
由于这段程序是连接ACCESS数据库用的,当我改连SQL SERVER数据库之后运行Pictures.Edit语句报错,我将Pictures.Edit和Pictures.Edit注释起来之后,运行整个工程文件是发现执行了这个Save_Image方法后再执行Pictures.Close会报错。(Pictures 是个RECORDSET对象)
谁能很好的理解代码告诉我改成连SQL数据库在这段代码里面一应该怎么改呢?
有关变量的定义如下:
Dim CustPicts As ADODB.Connection
Dim Pictures As ADODB.Recordset
Dim DataFile As Integer, Chunks As Integer
Dim Fragment As Integer, Chunk() As Byte, I As Integer
Const ChunkSize As Integer = 16384      '(16K Chunk Size)
Const LongValue As Long = 2147483647
非常感谢!参考这个:

使用流对象保存和显示图片
打开vb6,新建工程。

添加两个按钮,一个image控件
注意:Access中的photo字段类型为OLE对象.
SqlServer中的photo字段类型为Image

'** 引用 Microsoft ActiveX Data Objects 2.5 Library 及以上版本
‘2.5版本以下不支持Stream对象
Dim iConcstr As String
Dim iConc As ADODB.Connection

'保存文件到数据库中
Sub s_SaveFile()
    Dim iStm As ADODB.Stream
    Dim iRe As ADODB.Recordset
    Dim iConcstr As String

    '读取文件到内容
    Set iStm = New ADODB.Stream
    With iStm
        .Type = adTypeBinary  '二进制模式
        .Open
        .LoadFromFile App.Path + " est.jpg"
    End With
 

    '打开保存文件的表
    Set iRe = New ADODB.Recordset
    With iRe
        .Open "select * from img", iConc, 1, 3
        .AddNew        '新增一条记录
        .Fields("photo") = iStm.Read
        .Update
    End With
 

  '完成后关闭对象
    iRe.Close
    iStm.Close
End Sub

Sub s_ReadFile()
    Dim iStm As ADODB.Stream
    Dim iRe As ADODB.Recordset
    '打开表
Set iRe = New ADODB.Recordset
‘得到最新添加的纪录
    iRe.Open "select top 1 * from img order by id desc", iConc, adOpenKeyset, adLockReadOnly
    '保存到文件
    Set iStm = New ADODB.Stream
    With iStm
        .Mode = adModeReadWrite
        .Type = adTypeBinary
        .Open
        .Write iRe("photo")
‘这里注意了,如果当前目录下存在test1.jpg,会报一个文件写入失败的错误.
        .SaveToFile App.Path & " est1.jpg"
    End With
 

    Image1.Picture = LoadPicture(App.Path & " est1.jpg")
  '关闭对象
    iRe.Close
    iStm.Close
End Sub

Private Sub Command1_Click()
Call s_ReadFile
End Sub

Private Sub Command2_Click()
Call s_SaveFile
End Sub

Private Sub Form_Load()
    '数据库连接字符串
    iConcstr = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False" & _
        ";Data Source=F:csdn_vbdatabase保存图片\access图片img.mdb"

‘下面的语句是连接sqlserver数据库的.
    ‘iConcstr = "Provider=SQLOLEDB.1;Persist Security Info=True;" & _
‘ "User ID=sa;Password=;Initial Catalog=test;Data Source=yang"

  Set iConc = New ADODB.Connection
  iConc.Open iConcstr
End Sub

Private Sub Form_Unload(Cancel As Integer)
iConc.Close
Set iConc = Nothing
End Sub这个我看过了,可是我只想在原来已经成熟的代码上进行修改而已,应该只是一点小小的改动吧<


vb实现保存到excel中
如何让生成的excel自动筛选(就是表头都有下拉列表)
能用代码实现吗???
。。。。excel中录制宏,拿到vb修改一下

楼上的怎么做成模板?<
我的是个Acess程序
那保存excel的时候还得有什么特殊操作吗
我直接用
DoCmd.TransferSpreadsheet acExport, 5, WRK_EXPORT, export_name, False, "人员名单"
生成的

PS:要是把代码加进去的话,怎么老提示with。。。的错误,应该怎么加

解决了
Set Excel_App = CreateObject("Excel.Application")
    Set Excel_Book = Excel_App.Workbooks.Open(export_name)
    Set Excel_Sheet = Excel_App.Worksheets(1)
    Excel_Sheet.Rows(1).AutoFilter

谢谢楼上两位
揭帖


小弟新手,看vb教程 上面输入 “ActiveMovie1.”,这时就会弹出一个列表框,列出了对象 ActiveMovie1 的全部属性、方法和事件。我的怎么没有提示?
我下的是vb6.0精简版,http://10.duote.org/duotevb6.exe 这里下载的。

是我版本问题还是需要另外设置啊?麻烦指点,如果版本问题,希望好心人给我一个好点的下载地址,非常感谢!你新开一个程序,双击窗体,

Private Sub Form_Load()
   
End Sub

输入 me.

象这样
Private Sub Form_Load()
    me.
End Sub

看是否出来东西如楼上所说,你双击窗体后在窗体的Load事件中输入me.,然后看一下是否会有代码提示,你所提到的ActiveMovie1那是需要添加相应的控件之后,才能出现代码提示的。至于VB版本,我建议你下载企业版试试,最新的是VB6(SP6),在百度里搜一下即可。我提供一个网址,你试一下吧:http://www.codesky.net/showhtml/4160.htm,选择下载地址三(1)工具→选项→编辑→勾选自动列出员选项(VB6.0企业版是这样,vb6.0精简版可试一下,应该也是这样);
(2)要确保ActiveMovie1控件已经放在了窗体上了。
三位高手,在下膜拜不已!
估计确实是因为我没有放那个控件的原因所以才没有提示,按照一二楼朋友的输入me.就有了提示了!
非常感谢!
另外  感谢二楼的提供的下载地址,稍后就去下载  再次谢谢!