从vb6中的exe文件读取
我想读取exe文件,以便找到此代码从vb6中的exe文件读取,vb6,exe,Vb6,Exe,我想读取exe文件,以便找到此代码 Dim strData As String Dim lngFind As Long Open txtAdrsOfFile For Binary As #1 strData = Space$(FileLen(txtAdrsOfFile)) Get #1, , strData Close #1 lngFind = InStr(1, strData, txtFindString) If strDa
Dim strData As String
Dim lngFind As Long
Open txtAdrsOfFile For Binary As #1
strData = Space$(FileLen(txtAdrsOfFile))
Get #1, , strData
Close #1
lngFind = InStr(1, strData, txtFindString)
If strData = txtFindString Then
MsgBox "FIND"
Else
MsgBox "NOT FIND"
End If
它需要一个命令和两个文本框
但它不起作用
如果有一种方法可以使用这段代码,如果你们能帮我处理多管字符串,我的意思是我们可以从一个文件中读取多个
tnxfirst instr()返回查找字符串在搜索字符串中的位置的整数
它不会改变你传递给它的两个字符串
因此,与其检查
If strData = txtFindString Then
你应该检查一下
If lngFind > 0 then
MsgBox "FIND"
Else
MsgBox "NOT FIND"
End If
这是因为StrData仍然等于调用instr()之前文件的内容
另外,正如所指出的,如果您搜索文本并且不担心大小写匹配问题,那么应该使用text标志调用instr()
lngFind = InStr(1, strData, txtFindString,1)
你能解释一下“不工作”吗?如果“不工作”是指找不到所需的文本(InStr返回0),可能是因为区分大小写。默认值是区分大小写的搜索(通常是这样),因此InStr(1,“OriginalText”,“text”)将返回0(未找到)。可选的compare参数可以指定不区分大小写的搜索:InStr(1,“OriginalText”,“text”,vbTextCompare)。正如@jac所说,对“不工作”的含义进行更完整的描述会有所帮助。我的意思是,当我搜索字符串时,这部分代码会显示为MsgBox“not FIND”,我不知道为什么它找不到我正在搜索的字符串!我找不到!我正在搜索的字符串是否必须是十六进制?或者类似的东西?请记住,这无助于在可执行文件中查找unicode格式的文本。