News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

instead of in WM_CREATE: whats right message instead?

Started by daydreamer, October 20, 2021, 03:28:10 AM

Previous topic - Next topic

daydreamer

I am working on a GUI program:lots of sending,recieving and other doing buttons settings,
testing with GUI changing code inside WM_LMOUSEBUTTONDOWN:,WM_TIMER: works
but when using same code from in WM_CREATE: nothings happen
place it in some message that comes first when window shows up?

my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

HSE

Equations in Assembly: SmplMath

daydreamer

updated first post,the code its about read db strings and change buttons sw_hide,sw_show status
timer slow also works changing it

timer rot randomly changes icons+reappear and disappear buttons

in buttons.inc create buttons and sets pattern of two different colored icons



my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

HSE

Program always have to return from WM_CREATE.

Note, after creategrid:invoke SendMessage, hWnd, WM_LBUTTONDOWN, 0, 0
Equations in Assembly: SmplMath

daydreamer

Quote from: HSE on October 20, 2021, 05:43:50 AM
Program always have to return from WM_CREATE.

Note, after creategrid:invoke SendMessage, hWnd, WM_LBUTTONDOWN, 0, 0
thanks :thumbsup:
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

daydreamer

how is it possible to have a secondary window with many buttons and use show/hide when needed?
subclass existing window?
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

Greenhorn

You can store all the stuff you need to manage the buttons in a structure, allocate memory for the struct and save the pointer to it in the window's extra bytes. Within the window procedure you retrieve the pointer from the window's extra bytes to access the buttons.

You need mov  wc.cbClsExtra, sizeof DWORD and Get-/SetWindowLongPtr with argument dwNewLong set to 0.

This is similar to the implementation of (custom) controls. Here's an example of custom controls, just apply this technique to your main window ...
Custom Controls

Cheers
Greenhorn

P.S. Why not just start a new process ?
P.P.S. For LoadImage the LR_SHARED flag is very useful if you load the same image more than once ...
Kole Feut un Nordenwind gift en krusen Büdel un en lütten Pint.

fearless

Yes i do something similar with ModernUI controls except i use two dwords of extra space, one for a pointer to allocated memory for a structure of internal properties I use for the control and one for a pointer to allocated memory for a structure of external properties that is used by the control that can be modified by the user. After some experimentation and use I found that allocating more than 40 bytes, in practice should be fine, but officially isnt recommended and I found strange bugs with allocating lots of memory on a couple of occasions: See https://fearless.gitbook.io/creating-controls-in-assembler/control-properties for details.

Biterider


fearless

Thanks Biterider


Its a few years old now (2017/18 i think) when it was on the gitbooks.com site - since changed to gitbooks.io with a free and a freeium/premium option now for hosting projects. Had a option to import the older project over, so done that so that its still available online to view - the epub/pdf options probably dont work now.


Still, it might be useful for someone. Also the corresponding simple button control referenced in the gitbook is on my github as well: https://github.com/mrfearless/SimpleButton


fearless

Thanks JJ

I thought people knew about it already, but maybe I forgot to post up about it. Anyhow, I also added a link in my profile to it as well. Plus its accessible via a link on the original github repo that stores the content for the gitbook: https://github.com/mrfearless/creating-controls-in-assembler

daydreamer

thanks greenhorn :thumbsup:
thanks fearless  :thumbsup:
seem like I need to make several wndproc version:labyrinth,tactics grid

my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding

BugCatcher

With many button programs, I use a dlg program with child dlgs. Buttons in the resource file that have unique identifiers then use equates to give them understandable names. Can use any dlg with handle.
                  invoke   GetDlgItem,hWin,StartNflSeasonButton hWin=dlg handle
            invoke   ShowWindow,eax,SW_HIDE
            invoke   GetDlgItem,hWin,StartCollegeSeasonButton
            invoke   ShowWindow,eax,SW_HIDE
            invoke   GetDlgItem,hWin,EndGameButton
            invoke   ShowWindow,eax,SW_SHOW         

daydreamer

But at her thanks :thumbsup:
What about start with mdi instead?
my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding