Author Topic: instead of in WM_CREATE: whats right message instead?  (Read 633 times)

daydreamer

  • Member
  • *****
  • Posts: 1813
  • green elevator
instead of in WM_CREATE: whats right message instead?
« on: October 20, 2021, 03:28:10 AM »
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?

« Last Edit: October 20, 2021, 05:12:51 AM by daydreamer »
SIMD fan and macro fan
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."

HSE

  • Member
  • *****
  • Posts: 1815
  • AMD 7-32 / i3 10-64
Re: instead of in WM_CREATE: whats right message instead?
« Reply #1 on: October 20, 2021, 04:20:01 AM »
the source code is missing.

daydreamer

  • Member
  • *****
  • Posts: 1813
  • green elevator
Re: instead of in WM_CREATE: whats right message instead?
« Reply #2 on: October 20, 2021, 05:14:21 AM »
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



SIMD fan and macro fan
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."

HSE

  • Member
  • *****
  • Posts: 1815
  • AMD 7-32 / i3 10-64
Re: instead of in WM_CREATE: whats right message instead?
« Reply #3 on: October 20, 2021, 05:43:50 AM »
Program always have to return from WM_CREATE.

Note, after creategrid:
Code: [Select]
invoke SendMessage, hWnd, WM_LBUTTONDOWN, 0, 0

daydreamer

  • Member
  • *****
  • Posts: 1813
  • green elevator
Re: instead of in WM_CREATE: whats right message instead?
« Reply #4 on: October 20, 2021, 07:21:19 AM »
Program always have to return from WM_CREATE.

Note, after creategrid:
Code: [Select]
invoke SendMessage, hWnd, WM_LBUTTONDOWN, 0, 0
thanks :thumbsup:
SIMD fan and macro fan
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."

daydreamer

  • Member
  • *****
  • Posts: 1813
  • green elevator
Re: instead of in WM_CREATE: whats right message instead?
« Reply #5 on: October 22, 2021, 07:01:37 AM »
how is it possible to have a secondary window with many buttons and use show/hide when needed?
subclass existing window?
SIMD fan and macro fan
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."

Greenhorn

  • Member
  • **
  • Posts: 201
Re: instead of in WM_CREATE: whats right message instead?
« Reply #6 on: October 22, 2021, 09:14:35 AM »
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 ...

fearless

  • Member
  • ****
  • Posts: 539
    • Github
Re: instead of in WM_CREATE: whats right message instead?
« Reply #7 on: October 22, 2021, 09:34:03 AM »
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.
fearless

Lian Li PC-O11DW Case, ASUS Crosshair VIII Hero, AMD Ryzen 9 5950X, 32GB DDR4, MSI RX 5700XT, NZXT Kraken Z73, Seasonic 1000W PSU

My Github  Twitter  My Gitbook

Biterider

  • Member
  • ****
  • Posts: 780
  • ObjAsm Developer
    • ObjAsm
Re: instead of in WM_CREATE: whats right message instead?
« Reply #8 on: October 22, 2021, 05:09:37 PM »
Hi fearless
That is really cool https://fearless.gitbook.io/creating-controls-in-assembler/  :thumbsup: :thumbsup: :thumbsup:

Biterider

fearless

  • Member
  • ****
  • Posts: 539
    • Github
Re: instead of in WM_CREATE: whats right message instead?
« Reply #9 on: October 22, 2021, 06:45:09 PM »
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

Lian Li PC-O11DW Case, ASUS Crosshair VIII Hero, AMD Ryzen 9 5950X, 32GB DDR4, MSI RX 5700XT, NZXT Kraken Z73, Seasonic 1000W PSU

My Github  Twitter  My Gitbook

jj2007

  • Member
  • *****
  • Posts: 11768
  • Assembler is fun ;-)
    • MasmBasic
Re: instead of in WM_CREATE: whats right message instead?
« Reply #10 on: October 22, 2021, 07:13:01 PM »

fearless

  • Member
  • ****
  • Posts: 539
    • Github
Re: instead of in WM_CREATE: whats right message instead?
« Reply #11 on: October 22, 2021, 07:38:41 PM »
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
fearless

Lian Li PC-O11DW Case, ASUS Crosshair VIII Hero, AMD Ryzen 9 5950X, 32GB DDR4, MSI RX 5700XT, NZXT Kraken Z73, Seasonic 1000W PSU

My Github  Twitter  My Gitbook

daydreamer

  • Member
  • *****
  • Posts: 1813
  • green elevator
Re: instead of in WM_CREATE: whats right message instead?
« Reply #12 on: October 23, 2021, 12:43:02 AM »
thanks greenhorn :thumbsup:
thanks fearless  :thumbsup:
seem like I need to make several wndproc version:labyrinth,tactics grid

SIMD fan and macro fan
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."

BugCatcher

  • Member
  • **
  • Posts: 72
Re: instead of in WM_CREATE: whats right message instead?
« Reply #13 on: October 23, 2021, 03:14:18 AM »
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

  • Member
  • *****
  • Posts: 1813
  • green elevator
Re: instead of in WM_CREATE: whats right message instead?
« Reply #14 on: October 23, 2021, 06:21:19 PM »
But at her thanks :thumbsup:
What about start with mdi instead?
SIMD fan and macro fan
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."