SQLitening Support Forum

Support Forums => You've got Questions? We've got Answers! => Topic started by: Bern Ertl on July 22, 2009, 11:45:13 AM

Title: Why won't a MSGBOX in a SQLiteningProc Fn work?
Post by: Bern Ertl on July 22, 2009, 11:45:13 AM
If I try putting a MSGBOX in a function in an SQLiteningProc DLL, the function hangs/errors out when it reaches that point of the code (ie. the MSGBOX causes the hang/error).  I'm having to write code to exit the function with data in one of the string parameters to check client side as part of the debugging process, but it would be much easier if I could use a MSGBOX.  Any idea why it doesn't work?
Title: Re: Why won't a MSGBOX in a SQLiteningProc Fn work?
Post by: David Kenny on July 22, 2009, 12:26:47 PM
Bert,

I don't have any thoughts on the msgbox problem itself.  But I dropped msgbox as a trouble shooting tool when Patrice Terrier released his ztrace.dll.

Now, any program I need to debug, I include this declaration:
Declare Function zTrace Lib "zTrace.DLL" Alias "zTrace" (zMessage As Asciiz) As Long


And anytime I need to observe a variable I use something like one of these:
ztrace "sDriveLetter =" & Left$(sPath,2)
ztrace "Entered CalcTotals function"
ztrace "lReturn =" & Str$(lReturn)


The benefits include: easy to use, doesn't slow execution measurably, can view all the elements at one time (and in order), can copy them to the clipboard.  I'm sure I could come up with more.

You just need to put the dll in the path.  I threw it in the Windows folder.  PB 9.0 sometimes complains that the parameters don't match when using a function that returns a string.  I just use insert a ["" & ] in front of it.

Here is a link to Patrice's post on Jos? Roca's forum:
http://www.jose.it-berater.org/smfforum/index.php?topic=3092.msg9672;topicseen#msg9672 (http://www.jose.it-berater.org/smfforum/index.php?topic=3092.msg9672;topicseen#msg9672)

You will find the attachment at the bottom of the first post.

David

Title: Re: Why won't a MSGBOX in a SQLiteningProc Fn work?
Post by: Bern Ertl on July 22, 2009, 03:15:20 PM
Thanks David, I'll have a look.
Title: Re: Why won't a MSGBOX in a SQLiteningProc Fn work?
Post by: Fred Meier on July 23, 2009, 05:52:24 PM
Can't use MsgBox in a program that is running as a Service (Remote Mode).  There is no user so it just waits forever for an answer and your client will timeout.  However, you can use a MsgBox in a proc if you run it in Local Mode, be sure to remove before using in Remote Mode.