1. Eti Tiwari
  2. PowerBuilder
  3. Wednesday, 15 April 2020 15:54 PM UTC

Hi,

I was checking our system for performance issue and found out that messagebox() takes relatively longer time. I am not sure what is causing this to take more time. Does anyone have any idea about it?

Is there an alternative to messagebox?

 

Thanks

Michael Kramer Accepted Answer Pending Moderation
  1. Sunday, 19 April 2020 00:09 AM UTC
  2. PowerBuilder
  3. # 1

How slow is MessageBox function if use create completely new app with NO code at all but this code in its Open event?

// NOTE: Time between first and second dialog tells how fast MessageBox opens
MessageBox("Intro", "Press [OK] to close this dialog and begin the test.")
MessageBox("Test!" "How long did it take from you hit [OK] until this message displays?")

You will sometimes see slow behavior when:

1) User runs app via some terminal services where local printers are shared with terminal app.

2) Your app hasn't deployed the UI Theme files.

RE (2): This happens even when your app doesn't use UI themes. Presence of these files may have tremendous performance impact.

HTH /Michael

Comment
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Saturday, 18 April 2020 01:01 AM UTC
  2. PowerBuilder
  3. # 2

And ... to answer your question:

The alternative to messagebox() does exist: you create a small response window and pass your info to that one.

Comment
  1. Roland Smith
  2. Saturday, 18 April 2020 01:55 AM UTC
Given Arnd's possible explanation, creating a response window will not solve the problem.
  1. Helpful
  1. Miguel Leeuwe
  2. Saturday, 18 April 2020 02:02 AM UTC
Just answering the question "if there's an alternative".

We don't know if Arnd's answer is really what's going on here. Like the person who asked the initial question doesn't seem very responsive anyway.

regards
  1. Helpful
There are no comments made yet.
Arnd Schmidt Accepted Answer Pending Moderation
  1. Friday, 17 April 2020 15:10 PM UTC
  2. PowerBuilder
  3. # 3

The MessageBox() function has the effect to grab the focus so that LoseFocus in a Control and/or Deactive Event in a Window are triggered.
If you code for example a sleep(5) in a windows deactivate Event... the message box shows up after 5 seconds.

 

Comment
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Friday, 17 April 2020 15:08 PM UTC
  2. PowerBuilder
  3. # 4

Could it be that somehow you have an Override of the normal Messagebox()?

I know that that is possible, but don't remember how. Could that be the source of the problem?

 

Comment
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Thursday, 16 April 2020 20:05 PM UTC
  2. PowerBuilder
  3. # 5

Greetings, Eti - 

Since you have looked at performance/timing data, can you please provide us with some numbers as to what "relatively longer" means?

I'm curious...Does the measured timing you are seeing include the delay that it takes the user to respond to the message - To click on a response button and close the MessageBox window? If so, those "performance" numbers are essentially meaningless. You might be chasing a problem that is really not a problem.

Regards, John

Comment
  1. Eti Tiwari
  2. Friday, 17 April 2020 15:47 PM UTC
i have added a screenshot to indicate what i mean by more time.

I ran profiling and checked which function was taking more time and found that it traced back to messageBox. You can check the screenshot and see for 13 hits it took somewhere around 111 sec. which i feel is huge.

To ans Miguel Leeuwe - there is no override.

Does the time mentioned in SS refer to the time duration it was opened and closed??? i did click on the response quickly each time though. I can once try that also.. not clicking on response for like 10-20sec and see if that increases the time, but i guess the time shown is execution time.

  1. Helpful
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Thursday, 16 April 2020 18:09 PM UTC
  2. PowerBuilder
  3. # 6

Hi Eti ;

  AFAIK (and see) the MB() command is still super fast on my W10 test PC's.

  In order to help you more though, we would need to know a lot more about your PB edition/version, O/S version, environment, etc.

Regards ... Chris

Comment
  1. Chris Pollach @Appeon
  2. Friday, 17 April 2020 16:15 PM UTC
Hi Eti;

Yes, Citrix can be a real slow down on any App if not configured properly. Please contact your Citrix Administrator for change your session settings.

Regards ... Chris
  1. Helpful
  1. Roland Smith
  2. Friday, 17 April 2020 18:43 PM UTC
Does the profiler include the time the MessageBox is waiting for the user to dismiss?
  1. Helpful
  1. Roland Smith
  2. Friday, 17 April 2020 18:45 PM UTC
The Windows API function MessageBox is a wrapper around an undocumented function called MessageBoxTimeout. It has an additional argument which allows you to have it automatically close after an amount of time you specify.

I have an example here:

https://www.topwizprogramming.com/freecode_messagebox.html
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.