Announcement

Collapse
No announcement yet.

Closing DDT program during WM_INITDIALOG

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

  • Adrian C Aitken
    replied
    Thanks Lance - its a good job you're on the other side of the planet so when I'm programming at night someones there in their morning !

    Regards

    Adrian Aitken

    ------------------

    Leave a comment:


  • Lance Edmonds
    replied
    You cannot destroy a dialog during %WM_INITDIALOG. The easy solution is to POST a message to the dialog and then abandon ship when that message arrives.
    ie,
    Code:
    CASE %WM_INITDIALOG
      IF somecondition THEN PostMessage CBHNDL, %WM_USER + 999&, 0, 0
    CASE %WM_USER+999&
      DIALOG END CBHNDL
    ...
    END FUNCTION


    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>

    Leave a comment:


  • Adrian C Aitken
    started a topic Closing DDT program during WM_INITDIALOG

    Closing DDT program during WM_INITDIALOG

    Hi all, am I doing something stupid ?
    I want to have the option of closing a DDT based program during the WM_INITDIALOG message. Listing 'A' hides the program (but task manager still shows it running), listing 'B' show the dialog and it has to be manually closed.
    The mnuClose message just does DIALOG END CBHNDL ,0 and it works if I manually click on the menu item.


    Regards

    Adrian Aitken
    Code:
    Listing A
    
        SELECT CASE CBMSG
            CASE %WM_INITDIALOG
              DoSomeThing
              IF JustOnce THEN
                 DIALOG END CBHNDL, 0
                 EXIT FUNCTION
              END IF
    
    
    Listing B
    
        SELECT CASE CBMSG
            CASE %WM_INITDIALOG
              DoSomeThing
              IF JustOnce THEN
                 DIALOG SEND CBHNDL , %WM_COMMAND , 0 , %mnuCLOSE
                 EXIT FUNCTION
              END IF
    ------------------
Working...
X