Announcement

Collapse
No announcement yet.

hDlg but no wm_initdialog until..

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

  • hDlg but no wm_initdialog until..

    I'm very curious how PB achieved to return a hDlg and WM_INITDIALOG is sent only when Dialog Show is used.

    How can this be?


    ------------------
    [email protected]

    [This message has been edited by Edwin Knoppert (edited January 13, 2001).]
    hellobasic

  • #2
    DDT is quite clever, huh?

    Actually, CreateWindow() and CreateWindowEx() both return a handle to the target window, and no matter how a window, dialog or control is created, at some stage one of these two API's is called (say, by the DDT engine or from within Windows own API's, etc).



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

    Comment


    • #3
      Are you saying that DDT is calling the WM_INITDIALOG message again? (can't imagne)
      Can't understand it yet..

      Can you be more specific?
      I'm right that it's not a standard way ain't it.
      Just a DDT benefit.


      ------------------
      [email protected]
      hellobasic

      Comment


      • #4
        Edwin --

        It looks, that
        - Dialog New CREATES modeless dialog.
        - Dialog Show includes ShowWindow + message pump.
        WM_INITDIALOG, which happends in CALLBACK proc is imitation only.
        Real event already happened inside DDT engine before Dialog Show.
        And this explains, why you can't hide a dialog inside WM_INITDIALOG and so on.

        Code:
           #Compile Exe
           #Register None
           #Dim All
           #Include "win32Api.inc"
        
           Global OldProc As Long
           CallBack Function DlgProc
              Select Case CbMsg
                 Case %WM_INITDIALOG: MsgBox "Ok" ' Not happends
                 Case %WM_DESTROY
                    PostQuitMessage 0
              End Select
              Function = CallWindowProc(OldProc, CbHndl, CbMsg, CbWparam, CbLparam)
        
           End Function
        
           Function PbMain
              Dim hDlg As Long
              Dialog New 0, "Test", , , 200, 200, %WS_SYSMENU Or %WS_CAPTION To hDlg
              OldProc = SetWindowLong (hDlg, %GWL_WNDPROC, CodePtr(DlgProc))
              Control Add TextBox, hDlg, 101, "", 10, 10, 180, 15
              Dim msg As tagMsg
              ShowWindow hDlg, 1
              UpdateWindow hDlg
              While GetMessage (msg, %NULL, 0, 0)
                 If IsDialogMessage (hDlg, msg) Then
                 Else
                   TranslateMessage msg
                   DispatchMessage  msg
                 End If
              Wend
              ' SetWindowLong hDlg, %GWL_WNDPROC, OldProc
           End Function


        ------------------
        E-MAIL: [email protected]

        Comment


        • #5
          I didn't actually tried the cancellation of the dialog.
          I assume PB destroys the dialogbox itself.

          Then, it would be a resend

          Thanks,


          ------------------
          [email protected]
          hellobasic

          Comment

          Working...
          X
          😀
          🥰
          🤢
          😎
          😡
          👍
          👎