flat assembler
Message board for the users of flat assembler.

Index > Windows > How do you create multiple DialogParambox's?

Author
Thread Post new topic Reply to topic
shism2



Joined: 14 Sep 2005
Posts: 248
shism2
I know how to create multiple ones... but it just isn't efficent. Let's say I have res file with 2 dialog windows. I load the dialog with control ID 100, later I want to also load the one with control id 200... ( like let's say an about window). How could I do that without callind dialogboxparam and all that crap again.
Post 30 Dec 2005, 03:56
View user's profile Send private message Reply with quote
shism2



Joined: 14 Sep 2005
Posts: 248
shism2
anyone give me a hand?
Post 30 Dec 2005, 23:40
View user's profile Send private message Reply with quote
SDragon



Joined: 13 Sep 2005
Posts: 19
Location: Siberia
SDragon
Create an array with contol ID values, then make a loop that retrieves values from this array and calls DialogBoxParam.
Post 31 Dec 2005, 02:54
View user's profile Send private message Reply with quote
shism2



Joined: 14 Sep 2005
Posts: 248
shism2
SIGH thats I didnt want to do...
Post 31 Dec 2005, 03:44
View user's profile Send private message Reply with quote
comrade



Joined: 16 Jun 2003
Posts: 1137
Location: Russian Federation
comrade
What is it that you have against calling DialogBoxParam twice?
Post 31 Dec 2005, 04:02
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
shism2



Joined: 14 Sep 2005
Posts: 248
shism2
wont i have to setup another loop?
Post 31 Dec 2005, 04:59
View user's profile Send private message Reply with quote
comrade



Joined: 16 Jun 2003
Posts: 1137
Location: Russian Federation
comrade
You don't need a message loop at all for DialogBoxParam... its is a modal window (the function returns when the dialog box is closed)
Post 31 Dec 2005, 06:12
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
Reverend



Joined: 24 Aug 2004
Posts: 408
Location: Poland
Reverend
And you can always point to the same DlgProc (message handling) for all your windows. But then you must remember that ids have to be different in every window.
Post 31 Dec 2005, 14:21
View user's profile Send private message Visit poster's website Reply with quote
shism2



Joined: 14 Sep 2005
Posts: 248
shism2
HMMMMM..... You just gave me a good idea Reverend... I'll have to use polymorphism.

So,Instead of having to make a whole new loop to handle the new window. I'll use polymorphism to do changes the the current loop, to increase performance.
Post 31 Dec 2005, 14:58
View user's profile Send private message Reply with quote
Reverend



Joined: 24 Aug 2004
Posts: 408
Location: Poland
Reverend
Nice but rather error-prone solution Wink
I'd rather suggest sth like this:
Code:
; let's say we have two dialogs of ids 1 and 2
; both have two buttons (100, 101) and (200, 201)

proc DlgProc hwnd, umsg, wparam, lparam
        cmp [umsg], WM_INITDIALOG
        jz ...
        cmp [umsg], WM_CLOSE
        jz ...
        cmp [umsg], WM_COMMAND
        jnz @F
        cmp [wparam], 100
        jz ...
        cmp [wparam], 101
        jz ...
        cmp [wparam], 200
        jz ...
        cmp [wparam], 201
        jz ...
    @@:
endp    
You see there's no need for any polymorphism. Just some code is shared between dialogs, but they still can be distinguished (100-199 first dialog, 200-299 second dialog)
Post 04 Jan 2006, 00:33
View user's profile Send private message Visit poster's website 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-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.