News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

How to show multiple windows using same Pattern

Started by kyo, July 11, 2007, 04:20:03 AM

Previous topic - Next topic

kyo

Hey,
Can we show multiple windows similar to each other but have differently respond to messages . one window is closed other should not and so on.

jdoe

You can set your window in a resource file and call DialogBoxParam for each window with their own DialogProc.


DLG1_ID DIALOGEX 0, 0, 72, 72
FONT 8, "MS Sans Serif"
STYLE WS_CAPTION | WS_VISIBLE | DS_CENTER
BEGIN
   CONTROL "OK", BTN1_ID, "Button", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, 10, 10, 40, 14
END



invoke DialogBoxParamA, hInstance, DLG1_ID, NULL, addr DialogProc1, NULL
invoke DialogBoxParamA, hInstance, DLG1_ID, NULL, addr DialogProc2, NULL



kyo

Ok i got you , what if i wanted to perfrom some code in that tample eg i wanted to make a simple program which listens to a tcp port and activates each time a window whcih accepts the call and chat or what ever we want to do with that specific window we do it.

DLG1_ID DIALOGEX 0, 0, 72, 72
FONT 8, "MS Sans Serif"
STYLE WS_CAPTION | WS_VISIBLE | DS_CENTER
BEGIN
   CONTROL "OK", BTN1_ID, "Button", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, 10, 10, 40, 14
END


can we built wnd processes of various controls in that tample because they are needed seperatly to perform that tasks

jdoe

I'm not sure about your last post but I forgot to say in my previous one that you'll need CreateThread either to be able to have multiple windows open because DialogBoxParam returns when the dialog is closed.

u

By using CreateDialogParam, no extra threads are necessary.
Please use a smaller graphic in your signature.

kyo

Ultrano,
Prob is that i want to display the windows as many time code is called and every window should process its own code eg, chat received to one window should be displayed in that window not in the other window.Guide me how to do this. In Visual Basic its quite easy one create a form/windows which process all the chat code then decleare it as array var and then load it and show which array index window you want to show there but how to do this in asm
invoke DialogBoxParamA, hInstance, DLG1_ID, NULL, addr DialogProc1, NULL
doing this will show the window but there are questions ,
1:- will it be modleless window mean that other windows in the app will be workable.
2:- Where to perform the wnd procedures of that dialog.

kyo

I have attached an example plz try to convert this one to asm.

[attachment deleted by admin]

mnemonic

Quote from: kyo on July 13, 2007, 03:34:15 AM
I have attached an example plz try to convert this one to asm.
And afterwards we should get you a girlfriend, shouldn't we?
Be kind. Everyone you meet is fighting a hard battle.--Plato
-------
How To Ask Questions The Smart Way

kyo

Quote from: mnemonic on July 13, 2007, 05:24:48 AM
Quote from: kyo on July 13, 2007, 03:34:15 AM
I have attached an example plz try to convert this one to asm.
And afterwards we should get you a girlfriend, shouldn't we?

That was a nice solution by you :red
I searched else  where but not able to find how to do this thats why i asked.


hutch--

kyo,

The problem is I don't properly understand your question. Having multiple windows open is no big deal, multiple threads with a window in each is just a little bit more work.

Tell us just a little bit more about wha you are trying to do.

Do you need each window to act seperately from the others ? (Asynchronous).
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

kyo

hutch,
invoke DialogBoxParamA, hInstance, DLG1_ID, NULL, addr DialogProc1, NULL

works perfectly ok but  when WM_Close message goes to that dialogproc all windows are closed how we can count this so that only one dialog is closed whose close button is clicked.I have also attached a file which i made using vb i am tring to do this in asm so my learnings in asm increase.

hutch--

kyo,

Have a look and see if this example is doing what you require. Its an example for the next version of MASM32 which creates each extra window in a seperate thread and allows them all to run at the same time.

[attachment deleted by admin]
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

kyo

Quote from: hutch-- on July 14, 2007, 07:01:08 PM
kyo,

Have a look and see if this example is doing what you require. Its an example for the next version of MASM32 which creates each extra window in a seperate thread and allows them all to run at the same time.

Thank you hutch

That was what  i was  looking for i searhed on this fourm  and googled  but unable  to find  it,but  now  i  got it.Good  luck  for the new  version of Masm libs  this  way it will compete HLL  and also provide  the  option  to  code  in low  level  so  to optimize Alogerthoms .I have few Suggestions   for you.  Try to increase the unicode support. AS  i know  there  is  no UNICODE  version of  SADD i converted  asc to UNI CODE Which i like to  share  with you

    ; --------------------------------
    ; string address in INVOKE format
    ; --------------------------------
      UNISADD MACRO quoted_text:VARARG
        EXITM <ADDR UNIliteral(quoted_text)>
      ENDM
    ; ---------------------
    ; literal string MACRO
    ; ---------------------
      UNIliteral MACRO quoted_text:VARARG
        LOCAL local_text
        .data
          WSTR local_text,quoted_text
        align 4
        .code
        EXITM <local_text>
      ENDM

Thanks for  providing such a nice example