|
-
May 19th, 2003, 12:04 PM
#1
Thread Starter
New Member
native-code hangs after msg handler
Hi:
I'm using VB Enterprise on W2K. I have a simple form app with a button handler. When I've compiled the code to p-code it works just fine, but when I compile to native code it hangs when it exits the message handler. When I go into Task Manager, it indicates my app is using 97-99% of the CPU.
I get the same results on XP.
Thanxs for your feedback,
redcpu
-
May 19th, 2003, 12:09 PM
#2
Are you doing any "Advanced Optimizations"?
-
May 19th, 2003, 12:12 PM
#3
Thread Starter
New Member
No. I've tried "Fast Code" and "No Optimizations" on the Compile tab and both get the same results.
I suspect there's an infinite loop but it appears that infinite loop isn't in my code since the very last line of the msg handler is
MsgBox(.....)
which executes and then the hang occurs.
redcpu
Last edited by redcpu4ghz; May 19th, 2003 at 12:16 PM.
-
May 19th, 2003, 12:14 PM
#4
Thread Starter
New Member
I also wonder if I have some stack corruption problem . I wish I could "debug" the native code .exe using a disassembler like VC++.
Last edited by redcpu4ghz; May 19th, 2003 at 12:19 PM.
-
May 19th, 2003, 12:25 PM
#5
Can you give us an idea of what the message handler is doing (a code snippet maybe)
-
May 19th, 2003, 12:35 PM
#6
Thread Starter
New Member
Private Sub Button_Click()
Dim buffer(8) As Byte
Dim retval As Long
Dim rc As Long
retval = SendCommand(2,6,0, buffer(), 6, 1, 8, 0)
If retval <> 1 Then
Msg.Text = Msg.Text & "Command failed ... exiting." & vbCrLf
End If
rc = MsgBox("GettingOuttaHere", vbOKOnly)
End Sub
The prototype for SendCommand is:
Declare Function SendCommand Lib "blah.dll" (ByVal firstparam As Long, ByVal secondparam As Long, ByVal thirdparam As Long, buffer() As Byte, ByVal length As Long, ByVal sixparam As Long, ByVal datalength As Long, ByVal eightparam As Long) As Integer
-
May 19th, 2003, 12:37 PM
#7
Thread Starter
New Member
Forgot to mention - the function SendCommand has the proper VB linkage, namely _stdcall (as opposed to cdecl linkage).
redcpu
-
May 19th, 2003, 12:51 PM
#8
Have you identified that it's the code in the Button Click event that's causing the application to hang?
If not, try commenting out code in the event until the behavior stops.
-
May 19th, 2003, 01:35 PM
#9
Thread Starter
New Member
I've commented out the call to SendCommand and the hang doesn't occur. What's got me is why, when I compile to p-code, it all works?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|