Announcement

Collapse
No announcement yet.

Degging Windows Programs

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Degging Windows Programs

    I declared a GLOBAL value for debbuging in my windows
    progam

    GLOBAL alertvalue AS STRING

    then defined a Callback function

    CALLBACK FUNCTION Alert()
    alertvalue="Hello"
    END FUNCTION

    and called the function from dialog button CALL.

    Then in the "main loop" for my dialog (just after the
    FUNCTION=action statement), I put the statements

    IF alertvalue>"" THEN MSGBOX alertvalue:alertvalue=""
    =====================================================

    I never get a MSGBOX. Why isn't alertvalue being
    set, and the MSGBOX showing its value?

    Is there another smarter way to display values seen
    inside CALLBACK functions?

  • #2
    If you are testing alertvalue to see if it has a value, why do you use the comparison operator ">"? Should that not be IF alertvalue <> "" THEN ...
    If you try to make something idiot-proof, someone will invent a better idiot.

    Comment


    • #3
      I appreciate your taking the time to answer, but all strings are greater
      than the null string. That's not it, but I did change the code anyway.
      (just in case). No my problem has some other origin.

      Comment


      • #4
        Joe:

        >Then in the "main loop" for my dialog (just after the
        >FUNCTION=action statement), I put the statements
        >
        >IF alertvalue>"" THEN MSGBOX alertvalue:alertvalue=""

        The first NO, NO is "Never" try to display a messagebox from within a DialogBox (or window Proc) Procedure unless it is done when a specific message is processed (like WM_COMMAND).

        By putting the messagebox command in a place where it can be executed by any Dialog Message (ie, where you put it), you may be trying to display a messagebox during a particular message that Windows finds offensive.

        Do NOT assume that a Dialog Procedure is dormant. There are a bunch of messages that are processed before a Window (Dialog) is even displayed, ie. WM_NCCREATE, WM_INITDIALOG and possibly others.

        By putting the messagebox command in a place that where it may execute during a windows message that does not like it, you can cause problems, even GPFs.

        If you move your messagebox command to the WM_COMMAND message and test for say a Button press and then execute it, it should work fine.

        Chris Boss
        Computer Workshop
        Developer of "EZGUI"
        http://cwsof.com
        http://twitter.com/EZGUIProGuy

        Comment

        Working...
        X