flat assembler
Message board for the users of flat assembler.

Index > Windows > calling a dialogbox from a dialogbox

Author
Thread Post new topic Reply to topic
mns



Joined: 20 Dec 2007
Posts: 150
Location: Piliyandala,Sri lanka
mns 06 Sep 2011, 16:53
I have tried to call a dialogbox from a main dialogbox but no luck.I think problem is in the .rsrc section. Sad please some one help me Confused

source is attached with this


Description:
Download
Filename: tst4.ASM
Filesize: 4.84 KB
Downloaded: 321 Time(s)

Post 06 Sep 2011, 16:53
View user's profile Send private message Send e-mail Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2893
Location: 0x77760000
typedef 06 Sep 2011, 16:55
Dialog1 has a problem, Dialog 2 works fine.
And I see the way use used hWnd, that's confusing. Use eax instead.


Last edited by typedef on 06 Sep 2011, 17:03; edited 1 time in total
Post 06 Sep 2011, 16:55
View user's profile Send private message Reply with quote
mns



Joined: 20 Dec 2007
Posts: 150
Location: Piliyandala,Sri lanka
mns 06 Sep 2011, 17:01
typedef I'm having poor knowladge in windows programming(infact all kind of programming)Please, can you explain more?
Post 06 Sep 2011, 17:01
View user's profile Send private message Send e-mail Reply with quote
mns



Joined: 20 Dec 2007
Posts: 150
Location: Piliyandala,Sri lanka
mns 06 Sep 2011, 17:20
I used eax but the result is same, no dialog displayed. Are there errors in .rsrc section?
Post 06 Sep 2011, 17:20
View user's profile Send private message Send e-mail Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2893
Location: 0x77760000
typedef 06 Sep 2011, 17:23
It seems like The first dialog cannot be loaded for some reason. Even if you copy the 2nd dialog to the first one, it still doesn't show. Only the 2nd dialog shows, using MainDlg as it's procedure.

Odd..
Post 06 Sep 2011, 17:23
View user's profile Send private message Reply with quote
mns



Joined: 20 Dec 2007
Posts: 150
Location: Piliyandala,Sri lanka
mns 06 Sep 2011, 17:30
And if .rsrc section change like below it show the 1st dialog but giving a error when press the button,


directory RT_DIALOG, dialogs2,\
RT_DIALOG, dialogs1,\
RT_MANIFEST,manifest
Post 06 Sep 2011, 17:30
View user's profile Send private message Send e-mail Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2893
Location: 0x77760000
typedef 06 Sep 2011, 17:59
if you could, compare your code with FASMs templates
Post 06 Sep 2011, 17:59
View user's profile Send private message Reply with quote
mns



Joined: 20 Dec 2007
Posts: 150
Location: Piliyandala,Sri lanka
mns 06 Sep 2011, 18:05
typedef how can I find FASMs templates Confused (forgive me if i'm asking a foolish question)
Post 06 Sep 2011, 18:05
View user's profile Send private message Send e-mail Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2893
Location: 0x77760000
typedef 06 Sep 2011, 18:55
in your FASM folder --> fasmw16931\EXAMPLES\DIALOG\DIALOG.ASM
Post 06 Sep 2011, 18:55
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4225
Location: vpcmpistri
bitRAKE 06 Sep 2011, 19:47
I was able to get the first dialog to show by removing the manifest. There are several errors in the dialog procedure. Register preservation is off balance, leaf functions within proc cannot use RET (which is a macro) -- use RETN instead.
Post 06 Sep 2011, 19:47
View user's profile Send private message Visit poster's website Reply with quote
yoshimitsu



Joined: 07 Jul 2011
Posts: 96
yoshimitsu 07 Sep 2011, 21:49
Apparently, you shouldn't have the same kind of a directory twice, means your code has to look like this:
Code:
directory     RT_DIALOG, dialogs,\
              RT_MANIFEST,manifest

resource      dialogs,\
              IDD_DIALOG1, LANG_ENGLISH + SUBLANG_DEFAULT, main_dialog,\
              IDD_DIALOG2, LANG_ENGLISH + SUBLANG_DEFAULT, dialog2    


Though, bitRAKE is right, your code is f**ked up to the max..

Code:
  call    .process
  ; [...]
.process:
  mov     eax,1
endp    

you can't simply jump somewhere without returning..

Code:
  .wmclose:
        invoke  EndDialog,[hwnddlg],0
        ret    

don't just fill everything with rets..
(also note your push ebx esi edi, your program doesn't crash only because ret inserts a leave, but your registers aren't getting preserved, though.)
just do it like this:
Code:
  push ebx
  cmp [msg],WM_COMMAND
  je .wmcommand
  cmp [msg],WM_CLOSE
  je .wmclose
  xor eax,eax
  jmp .finish
.wmcommand:
  ;...
  jmp .handled
.wmclose:
  invoke  EndDialog,[hwnddlg],0
  ;fall through
.handled:
  mov eax,1
.finish:
  pop ebx
  ret    
Post 07 Sep 2011, 21:49
View user's profile Send private message Reply with quote
mns



Joined: 20 Dec 2007
Posts: 150
Location: Piliyandala,Sri lanka
mns 08 Sep 2011, 13:33
thank you very much yoshimitsu,bitRAKE and typedef for your kind help. Very Happy
One other thing,
How can I keep 1st dialog without closing, when closing 2nd dialog Question
Post 08 Sep 2011, 13:33
View user's profile Send private message Send e-mail Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.