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?
the source code is missing.
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
Program always have to return from WM_CREATE.
Note, after creategrid:invoke SendMessage, hWnd, WM_LBUTTONDOWN, 0, 0
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:
how is it possible to have a secondary window with many buttons and use show/hide when needed?
subclass existing window?
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 (https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setwindowlongptra) 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 (http://www.catch22.net/tuts/win32/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 ...
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.
Hi fearless
That is really cool https://fearless.gitbook.io/creating-controls-in-assembler/ (https://fearless.gitbook.io/creating-controls-in-assembler/) :thumbsup: :thumbsup: :thumbsup:
Biterider
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
Quote from: Biterider on October 22, 2021, 05:09:37 PM
Hi fearless
That is really cool https://fearless.gitbook.io/creating-controls-in-assembler/ (https://fearless.gitbook.io/creating-controls-in-assembler/) :thumbsup: :thumbsup: :thumbsup:
A book on controls - cool indeed :thumbsup:
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
thanks greenhorn :thumbsup:
thanks fearless :thumbsup:
seem like I need to make several wndproc version:labyrinth,tactics grid
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
But at her thanks :thumbsup:
What about start with mdi instead?
what about have one main app and use many files to move away from hardcoded data and launch tactics program when needed and it reads first from a file with "pointers",which setup of enemies its time to meet
it updates data to files while it runs and when returning to main app,the little squad you are commanding are updated with loss/gains from the fight
got rotate proc working,so part 3x3 of labyrinth can "rotate",so it can have 4 ways possible moves thru labyrinth
Magnus,
WM_CREATE in only used in one place and it is only called once, in the WndProc.