-
I have a problem with this code .
'in module
Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Declare Function CreateThread Lib "kernel32" (lpThreadAttributes As Any, ByVal dwStackSize As Long, ByVal lpStartAddress As Long, lpParameter As Any, ByVal dwCreationFlags As Long, lpThreadID As Long) As Long
Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Public Sub Threadfunc()
dim i as integer
do until i = 20
form1.caption = i
sleep 500
i = i+1
loop
End Sub
'in form1
Private Sub Command1_Click()
Dim hThread As Long, hThreadID As Long
hThread = CreateThread(ByVal 0&, ByVal 0&, AddressOf threadfunc, ByVal 0&, ByVal 0&, hThreadID)
End Sub
When i run it in VB it works fine but when i run it as a compiled EXE un illegal operation in msvbvm60.dll occurs.
What's the problem?
-
<?>
If you are running the compiled version on a machine without VB installed you will need to copy the VB msvbvm60.dll file into the windows system dir of the machine you are running the exe on.
-
No, no, i have all vb runtime files including the msvbvm60.dll in the system dir.
-
<?>
It does so on my system as well..another thing is if in the app before you convert it to an exe you stop before it reaches 19 you will get a different dll error and crash VB.
I have no explanation as to why!