Web Connection User Discussions
Feels like a newbie question
Gravatar is a globally recognized avatar based on your email address. Feels like a newbie question
  Michael B
  All
  Nov 10, 2020 @ 10:49am

Rick,

Is it possible that MESSAGEBOX() hangs the exe whenrunning in COM? I am still trying to track down what appears to be random hangs of my exe and that occurred to me. I noticed you use MESSAGEBOX a lot, but I am wondering maybe the wconnect.h and LOCALSITE is somehow getting confused or something.

Ignore if ridiculous...

Gravatar is a globally recognized avatar based on your email address. re: Feels like a newbie question
  Tore Bleken
  Michael B
  Nov 10, 2020 @ 11:54am

Since you run WC in COM mode, you can't have any user interface, none. IOW a messagebox() will make your program hang. Instead of using messagebox() you should write to a file.

Read here: When to use COM - disadvantages

Gravatar is a globally recognized avatar based on your email address. re: Feels like a newbie question
  Michael B
  Tore Bleken
  Nov 10, 2020 @ 02:51pm

Tore - totally agree and understand. However, if you scan the WWWC framework for messagebox you'll see it many times. I assumed that all obvious built in vfp functions with UI components like MESSAGEBOX and SET STEP ON are being ignored at runtime via COM.

What brought this on, was that I discovered that my app had a third party prg added (copytoxslx6) that makes it possible to create a proper xlsx from a vfp cursor. That prg uses messagebox() when there is an error. I thought to myself AH HAH - I found the reason as to why my app intermittently hangs and crashes. I thought 'what if other messagebox() are being called unintentionally and hanging...

I was hoping Rick would confirm.

ps: I think the answer is NO, not a problem, the COM will ignore messagebox(). I guess I need to just create a simple function and test with one instance of the app.

Gravatar is a globally recognized avatar based on your email address. re: Feels like a newbie question
  Rick Strahl
  Michael B
  Nov 10, 2020 @ 04:33pm

WWWC may use MESSAGEBOX in some of the UI components, but not in any of the Web Connection core or HTML generation components.

COM servers will not hang on UI operations like MESSAGEBOX() only if you set the SYS(2335,0) && on via the Web Connection UnattendedMode=on flag in the configuration. If that function is not enabled COM servers will hang on any UI operation.

Note that even if SYS(2335,0) is set, it'll not just ignore the UI code - it will cause a FoxPro error and your code will fall into the Web Connection (or your own) error handler. So it's not like you can just leave MESSAGEBOX() debug statements in your code.

SET STEP ON debugging commands are ignored at runtime when not running with SET DEBUG ON and when running with the standalone runtimes (ie. it only does something inside of the FoxPro IDE).

The most common hang scenario isn't explicit UI operations, but File Open dialogs caused by operations that are trying to access files that don't exist or are locked. The file open dialog will just hang your server. With the unattended mode on I believe FoxPro gives the appropriate file access error rather than a UI exception.

It's never a good idea to leave these commands in place, but I know I'm known to do that often by accident 😃

+++ Rick ---

© 1996-2024