flat assembler
Message board for the users of flat assembler.
Index
> Windows > Redraw item over system button Goto page 1, 2 Next |
Author |
|
revolution 05 Aug 2020, 22:50
You didn't show how you are defining the button, or indeed anything, but there is a flag ownerdraw that you can set to draw your own graphics.
|
|||
05 Aug 2020, 22:50 |
|
Overclick 05 Aug 2020, 23:59
As I said it is a system button BS_PUSHBUTTON it cannot be BS_OWNERDRAW at same time. I need trick to renew my picture over it in time when it redraws itself.
|
|||
05 Aug 2020, 23:59 |
|
revolution 06 Aug 2020, 03:05
You might be able to sub-class it and capture the paint message.
|
|||
06 Aug 2020, 03:05 |
|
sinsi 06 Aug 2020, 04:27
Can't you use the BS_BITMAP style and set the image with BM_SETIMAGE when you initialise the dialog box?
|
|||
06 Aug 2020, 04:27 |
|
Overclick 06 Aug 2020, 12:46
BS_PUSHBUTTON buttons have its own nice animation that why I want to use them. Nothing I can do with them directly even change colors. Tell me how if you know.
revolution, does it mean I will prevent its own redrawing? I have to do something after it. Or maybe force my picture to be always on top somehow... sinsi, Resourse redactor don't let me to set BS_BITMAP or BS_ICON to BS_PUSHBUTTON, I'll try to force it... |
|||
06 Aug 2020, 12:46 |
|
revolution 06 Aug 2020, 12:50
Overclick wrote: revolution, does it mean I will prevent its own redrawing? I have to do something after it. Or maybe force my picture to be always on top somehow... |
|||
06 Aug 2020, 12:50 |
|
Overclick 06 Aug 2020, 13:38
revolution, Any example? How can I change class for given by res file item? Does it mean to create child window for button separately? BS_PUSHBUTTON have only WM_COMMAND messages doesn't it?
|
|||
06 Aug 2020, 13:38 |
|
Furs 06 Aug 2020, 14:43
Try to handle NM_CUSTOMDRAW notifications? Sounds like exactly what you're looking for. Make sure you use a manifest for buttons:
MSDN wrote: Custom draw is also supported for button controls if you have an application manifest to ensure that Comctl32.dll version 6 is available. |
|||
06 Aug 2020, 14:43 |
|
Overclick 06 Aug 2020, 18:45
Furs, seems you're right, I need to use CDDS_POSTPAINT or CDDS_ITEMPOSTPAINT.
How to find NMCUSTOMDRAW structure? I find NMHDR only. Or have I declare it first? Then how? Code: wmnotify: mov rax,[r9+8] ;r9 is [lParam] by default cmp rax,ID_ON je notify_id_on xor rax,rax ret notify_id_on: mov eax,[r9+16] cmp eax,NM_CUSTOMDRAW jne nothing mov eax,[r9+??????] cmp eax,CDDS_POSTPAINT jne nothing |
|||
06 Aug 2020, 18:45 |
|
Overclick 09 Aug 2020, 04:56
Code: wmnotify: mov rax,[r9+8] cmp rax,ID_ON je notify_id_on xor rax,rax ret notify_id_on: mov eax,[r9+16] cmp eax,NM_CUSTOMDRAW jne nothing mov eax,[r9+24] cmp eax,CDDS_PREPAINT jne @F mov rax,CDRF_NOTIFYPOSTPAINT ret @@: cmp eax,CDDS_POSTPAINT je @F mov rax,CDRF_NOTIFYPOSTPAINT ret @@: invoke GetDlgItem,[hWnd],1002 mov [hItem],rax invoke ShowWindow,[hItem],SW_HIDE invoke ShowWindow,[hItem],SW_SHOW mov rax,CDRF_SKIPDEFAULT ret Still nothing. dwDrawStage returns only CDDS_PREPAINT and CDDS_PREERASE messages but never CDDS_POSTPAINT even ordered by CDRF_NOTIFYPOSTPAINT. What am I doing wrong? |
|||
09 Aug 2020, 04:56 |
|
sinsi 09 Aug 2020, 05:08
You realize that BS_PUSHBUTTON=0, so it isn't really a style at all...BS_OWNERDRAW by itself is all you need.
|
|||
09 Aug 2020, 05:08 |
|
Overclick 09 Aug 2020, 05:52
How that working here then?
example |
|||
09 Aug 2020, 05:52 |
|
Overclick 09 Aug 2020, 06:15
https://docs.microsoft.com/en-us/windows/win32/controls/nm-customdraw-button
Buttons limited. Seems it's dead end. |
|||
09 Aug 2020, 06:15 |
|
sinsi 09 Aug 2020, 06:44
I don't understand what you are trying to do. Showing a button with an image should be as simple as using BS_BITMAP.
Using owner draw or custom draw gives you more control over the button's appearance but is a lot of code. |
|||
09 Aug 2020, 06:44 |
|
Overclick 09 Aug 2020, 07:17
sinsi, could you create nice animation for me? No? Of course it's easy to create some choppy button. But I prefer to use default one.
|
|||
09 Aug 2020, 07:17 |
|
sinsi 09 Aug 2020, 09:02
Ah, so animation.
|
|||
09 Aug 2020, 09:02 |
|
Furs 09 Aug 2020, 16:45
Overclick wrote: Furs, seems you're right, I need to use CDDS_POSTPAINT or CDDS_ITEMPOSTPAINT. |
|||
09 Aug 2020, 16:45 |
|
Overclick 10 Aug 2020, 02:26
Furs I find it by memory scan then it dawned on me it's one structure))
It doesn't send POSTPAINT any way. I have to find another solution or search for nice pictured ownerdraw buttons. |
|||
10 Aug 2020, 02:26 |
|
Furs 10 Aug 2020, 13:01
If you want to get CDDS_POSTPAINT, you have to return CDRF_NOTIFYPOSTPAINT from the CDDS_PREPAINT handler.
|
|||
10 Aug 2020, 13:01 |
|
Goto page 1, 2 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.