flat assembler
Message board for the users of flat assembler.

Index > Windows > Slider Volume

Author
Thread Post new topic Reply to topic
semiono



Joined: 31 Aug 2007
Posts: 198
Location: section '.code' executable
semiono 16 Apr 2024, 00:44
Code:
format   pe gui
entry    start
include 'win32ax.inc'
;--------------
.data
ID_TRACK  =   1
hTrack    dd  0
buff      db  0
;--------------
.code
start:    invoke  InitCommonControls
          invoke  DialogBoxParam, 0, 100, 0, DialogProc, 0
          invoke  ExitProcess, 0
 
proc  DialogProc hwnddlg, msg, wparam, lparam
 
          cmp     [msg],WM_COMMAND
          je      @exit
          cmp     [msg],WM_CLOSE
          je      @close
          cmp     [msg],WM_INITDIALOG
          jne     @next
 
; WM_INITDIALOG
@init:
; Получить дескриптор контрола
          invoke  GetDlgItem,[hwnddlg],ID_TRACK    ;// ListView
          mov     [hTrack],eax
          jmp     @next
 
; WM_CLOSE/COMMAND"
@exit:    cmp     [wparam],BN_CLICKED shl 16 + IDCANCEL
          jne     @next
@close:   invoke  EndDialog,[hwnddlg], 0
@next:    xor     eax,eax
          ret
endp
;-------------
section '.idata' import data readable writeable
library  kernel32,'kernel32.DLL',user32,'user32.DLL',comctl32,'comctl32.dll'
include  'api\kernel32.inc'
include  'api\user32.inc'
include  'api\comctl32.inc'
;-------------
section '.rsrc' data resource readable
directory  RT_DIALOG, dialogs
resource   dialogs, 100, LANG_ENGLISH + SUBLANG_DEFAULT, mainform
 
dialog mainform,' TrackBar ',150,100,150,35, DS_3DLOOK++DS_SYSMODAL+WS_CAPTION+WS_SYSMENU,,,'Verdana',8
  dialogitem TRACKBAR_CLASS,'',ID_TRACK, 010,010,120,15,WS_VISIBLE+WS_BORDER
enddialog    

Hi, everyone! I have this example I found from web. Please, help!
How to link this control with some byte to work with?
I need increase or decrease some "mem" limited 0 – 7Fh (common for midi data)

should be better win64ax.inc code

Very Happy

_________________
Windows 9, FL Studio 19
Post 16 Apr 2024, 00:44
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4227
Location: vpcmpistri
bitRAKE 16 Apr 2024, 01:29
Code:
invoke SendMessage, [hTrack], TBM_SETRANGE, 1, 0x007F_0000

invoke SendMessage, [hTrack], TBM_GETPOS, 0, 0
mov [position], eax    
... it's all SendMessage and the language of the control (i.e. the constant values and expected WPARAM/LPARAM).

https://learn.microsoft.com/en-us/windows/win32/controls/trackbar-controls

_________________
¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup
Post 16 Apr 2024, 01:29
View user's profile Send private message Visit poster's website Reply with quote
semiono



Joined: 31 Aug 2007
Posts: 198
Location: section '.code' executable
semiono 16 Apr 2024, 20:25
I thank you!

Code:
invoke wsprintf,zzzz,'%d',[position]
invoke MessageBoxTimeout,HWND_DESKTOP,zzzz,'',MB_TOPMOST,LANG_NEUTRAL,5000
    

How can I check result? Always zero, zero.. ?
Very Happy
Post 16 Apr 2024, 20:25
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4227
Location: vpcmpistri
bitRAKE 16 Apr 2024, 21:40
semiono wrote:
How can I check result? Always zero, zero.. ?
... I don't know what you are referring to. The message TBM_GETPOS always returns the value for me. Just send that message when you want the value.

_________________
¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup
Post 16 Apr 2024, 21:40
View user's profile Send private message Visit poster's website Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4227
Location: vpcmpistri
bitRAKE 17 Apr 2024, 04:42
In 64-bit, if you had a whole screen of sliders, this update method seems optimal:
Code:
; notification processing allows id use throughout lifecycle of controls
; updating several trackbar variables ...
.WM_NOTIFY:
        cmp [r9 + NMHDR.code], TRBN_THUMBPOSCHANGING
        jnz .default
        mov ecx, [r9 + NMHDR.idFrom]
        mov eax, [r9 + NMTRBTHUMBPOSCHANGING.dwPos]
        ; store the new position of moving slider
        mov [positions + (rcx-TRB_BASE)*4], eax
        xor eax, eax ; allow control to move
        retn    
... but that's just me.

_________________
¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup
Post 17 Apr 2024, 04:42
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.