Hello everybody!!!!


I'm using in memory dialogs from dialogs.inc; I want the main dialog window to init Hidden.


I'd tried to remove "WS_VISIBLE" flag, in dialog declaration, but it doesn't work: still showing the window!


main proc
    LOCAL lpArgs:DWORD
    Invoke GlobalAlloc,GMEM_FIXED or GMEM_ZEROINIT, 32
    mov lpArgs, eax
    push hIcon
    pop
    Dialog  "KriKro","Ms Sans Serif",8, \        ; caption,font,pointsize MS Sans Serif
            WS_OVERLAPPED OR WS_POPUP OR WS_CAPTION OR WS_SYSMENU OR WS_VISIBLE, \
            39, \                                            ; control count
            0,0,302,254, \                                  ; x y co-ordinates
            2048                                            ; memory buffer size


Second thingy I'd done was hiding the windows with "Invoke ShowWindow,hWinMain,SW_HIDE" at WM_INITDIALOG event.
This almost works, but with a little flash that happens cos' the windows is initialize visible.



; ?????????????????????????????????????????????????????????????????????????
;                      DIALOG PROCEDURE FOR KriKro
; ?????????????????????????????????????????????????????????????????????????
DlgProc proc hWnd:DWORD,uMsg:DWORD,wParam:DWORD,lParam:DWORD

    .if uMsg == WM_INITDIALOG

          mov eax,hWnd
          mov hWinMain,eax
          Invoke ShowWindowAsync,hWinMain,SW_HIDE
          Invoke SetWindowLong,hWnd,GWL_USERDATA,lParam


Is there a Flag to init the Dialog Windows NO VISIBLE?

tHanKs in Advance!!!

Posted on 2005-05-18 10:02:53 by Caraveiro

invoke CreateDialogParam,hInstance,IDD_DIALOG,NULL,addr WndProc,NULL
;invoke ShowWindow,hWnd,SW_SHOWNORMAL
invoke UpdateWindow,hWnd
.while TRUE
invoke GetMessage,addr msg,NULL,0,0
? .BREAK .if !eax
invoke TranslateMessage,addr msg
invoke DispatchMessage,addr msg
.endw
mov eax,msg.wParam
ret

That's how I did it... And I didn't set the flag for WS_VISIBLE either.. No flash, no nothing.
Posted on 2005-05-18 10:26:31 by JimmyClif
You have to remove the WS_VISIBLE style inserted by default by the resource compiler, check your RC compiler manual because it might be a little different in each case. Anyhow, it only works for modeless boxes AFAIK.
Posted on 2005-05-18 10:33:10 by QvasiModo
Hi QvasiModo: I'm Using Dialog.inc to create IN MEMORY Dialogs ergo no Resource.rc file is necesary!


Modal Dialog Boxes
A modal dialog box should be a pop-up window having a System menu, a title bar, and a thick border; that is, the dialog box template should specify the WS_POPUP, WS_SYSMENU, WS_CAPTION, and DS_MODALFRAME styles. Although an application can designate the WS_VISIBLE style, Windows always displays a modal dialog box regardless of whether the dialog box template specifies the WS_VISIBLE style. An application must not create a modal dialog box having the WS_CHILD style. A modal dialog box with this style disables itself, preventing any subsequent input from reaching the application


JimmyClif

Dialog.inc uses CallModalDialog Macro to call DialogBoxIndirectParam


    ; ------------------------------------
    ; create a modal dialog from the data
    ; written to the memory template.
    ; ------------------------------------
      CallModalDialog MACRO Instance,Parent,DlgProc,lpExtra
        invoke DialogBoxIndirectParam,Instance,esi,Parent,
                                      ADDR DlgProc,lpExtra
        push eax                ;; preserve return value
        invoke GlobalFree,esi  ;; free memory
        pop eax                ;; restore return value
        pop edi
        pop esi
      ENDM



Thanks JimmyClif

I'd tried your solution this way:


    ;CallModalDialog hInstance,0,DlgProc,ADDR lpArgs
    ;Invoke DialogBoxIndirectParam,hInstance,esi,NULL,ADDR DlgProc,ADDR lpArgs
    Invoke CreateDialogParam,hInstance,esi,NULL,ADDR DlgProc,ADDR lpArgs
        push eax                ;; preserve return value
        Invoke dwtoa, eax,addr szBuffer
        Invoke MessageBox,NULL,addr szBuffer,addr szAppName,MB_OK+MB_ICONERROR       
        invoke GlobalFree,esi  ;; free memory
        pop eax                ;; restore return value
        pop edi
        pop esi

    Invoke GlobalFree, lpArgs

    ret



But the function CreateDialogParam fails cos' the return value is NULL. GetLastError returns ERROR_RESOURCE_TYPE_NOT_FOUND = 1813

Let me work on it...


Posted on 2005-05-18 11:11:31 by Caraveiro

Hi QvasiModo: I'm Using Dialog.inc to create IN MEMORY Dialogs ergo no Resource.rc file is necesary!


I guess the problem is then that you're not using the indirect functions, to load the dialog template from memory instead of the resources. You're using the CreateDialogParam API to search for a resource that isn't there.


Modal Dialog Boxes
A modal dialog box should be a pop-up window having a System menu, a title bar, and a thick border; that is, the dialog box template should specify the WS_POPUP, WS_SYSMENU, WS_CAPTION, and DS_MODALFRAME styles. Although an application can designate the WS_VISIBLE style, Windows always displays a modal dialog box regardless of whether the dialog box template specifies the WS_VISIBLE style. An application must not create a modal dialog box having the WS_CHILD style. A modal dialog box with this style disables itself, preventing any subsequent input from reaching the application.


Exactly my point. :)
Posted on 2005-05-18 14:29:34 by QvasiModo
Hi

Try also? WS_EX_TOOLWINDOW? +

.elseif uMsg==WM_INITDIALOG
invoke SetWindowPos,hWnd,0,-3000,0,0,0,SWP_NOSIZE or SWP_NOZORDER
Posted on 2005-05-19 20:31:50 by kero
how about invoke ShowWindow(hWnd,SW_HIDE) in WM_INITDIALOG ?
Posted on 2005-05-20 00:28:13 by 13800
2 13800

read 1-st post
Posted on 2005-05-20 01:06:15 by kero