Announcement

Collapse
No announcement yet.

Is this safe to do?

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

  • Is this safe to do?

    Hello,

    Can you safely access editbox controls when processing the WM_DESTROY message. My program calls "dialog end cbhndl" when the cancel button is pressed. I then process the WM_DESTROY message, reading all the editboxes and saving the strings to the registry. Should I be doing this before I call "dialog end cbhndl" ?


    -------------
    Cheers

  • #2
    If I understand what you are doing, NO you can't do that...

    If the window is closing you want to read all of the data etc and then do say, registry chagnes, change values etc? (Like an options dialog box???)...

    I create an apply button and a static variable to see if changes were made.
    If changes were made and WM_DESTROY comes down, then send a message to apply to process.


    Code:
        Case %WM_CLOSE
             If IsTrue ChangesNotSaved Then
                Result = MsgBox("Save changes?",%MB_ICONQUESTION Or %MB_YESNO,Mine)
                If Result = %IDYES Then
                    SendMessage GetDlgItem(oDlg,%IDAPPLY) , %BM_CLICK, 0, 0
                End If
             End If

    ------------------
    Scott
    mailto:tngbb[email protected][email protected]</A>
    MCSE, MCP+Internet
    Scott Turchin
    MCSE, MCP+I
    http://www.tngbbs.com
    ----------------------
    True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi

    Comment


    • #3
      Scott,

      You are completely correct! That's exactly what I want to do. I was unsure as to what extent the "dialog end" function worked. Thank you for clearing that up for me!


      ------------------
      Cheers

      Comment


      • #4
        The downfall is having the variable ChangesSaved or whatnot, and for each object on the GUI you have to set that flag if an event happens on it, which is not really TOO big of a deal but by doing it you get the feature you want
        so here for example is a checkbox to set some option or another...
        I set the flag, re-enable the Apply button etc...
        Now, cool thing is that sometimes users press OK without pressing Apply, easily fixed by that flag, if istrue ChangesNotSaved then sendmessage GetDlgITem(oDlg,%idapply),%BM_CLICK,0,0 and walah you just pressed the apply button for them, and all of your code can be called in teh apply code and not duplicated....

        It works for me, everyone has a different style but it works
        Code:
                     Case %IDOK
                        SendMessage GetDlgItem(oDlg,%IDAPPLY) , %BM_CLICK, 0, 0
        
        
                     Case %IDCHECK2
                          ChangesNotSaved = %TRUE
                          Control Enable oDlg, %IDAPPLY
                          Function = 1
                          Exit Function

        Scott


        ------------------
        Scott
        mailto:[email protected][email protected]</A>
        MCSE, MCP+Internet
        Scott Turchin
        MCSE, MCP+I
        http://www.tngbbs.com
        ----------------------
        True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi

        Comment

        Working...
        X