flat assembler
Message board for the users of flat assembler.

Index > Windows > TRACKBAR_CLASS -> problem...

Author
Thread Post new topic Reply to topic
dieboy



Joined: 30 Dec 2004
Posts: 41
Location: Poland, Elblag
dieboy
Hi!
I have this code in the WM_CREATE message:
Code:
[...]
        mov [imm.dwSize], sizeof.INITCOMMONCONTROLSEX
        mov [imm.dwICC], ICC_BAR_CLASSES
        invoke InitCommonControlsEx, imm
        invoke CreateWindowEx, 0, TRACKBAR_CLASS, NULL, WS_CHILD + WS_VISIBLE + TBS_HORZ, 5, 5, 100, 20, [mainhwnd], 0, [hinstance], NULL
        mov [htb], eax 
[...]
    

What's going one ? I have this error: VALUE OUT OF RANGE, instruction: pushd 'msctls_trackbar32'

_________________
...
Post 06 May 2005, 15:15
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
coconut



Joined: 02 Apr 2004
Posts: 326
Location: usa
coconut
i dont believe invoke macro can push the constant (from comctl32.inc) like that. perhaps try to define TRACKBAR_CLASS as 'msctls_trackbar32',0 first
Post 07 May 2005, 03:23
View user's profile Send private message Reply with quote
dieboy



Joined: 30 Dec 2004
Posts: 41
Location: Poland, Elblag
dieboy
THANK YOU, it works !
This is full source code (if someone need...):
Code:
format PE GUI 4.0
entry start

include '%fasminc%/win32a.inc'

section '.data' data readable writeable

  _title db 'Win32 program template',0
  _class db 'FASMWIN32',0

  mainhwnd dd ?
  hinstance dd ?
  htb dd ?
  tbclass db 'msctls_trackbar32', 0

  msg MSG
  wc WNDCLASS

  imm INITCOMMONCONTROLSEX

section '.code' code readable executable

  start:

        invoke  GetModuleHandle,0
        mov     [hinstance],eax
        invoke  LoadIcon,0,IDI_APPLICATION
        mov     [wc.hIcon],eax
        invoke  LoadCursor,0,IDC_ARROW
        mov     [wc.hCursor],eax
        mov     [wc.style],0
        mov     [wc.lpfnWndProc],WindowProc
        mov     [wc.cbClsExtra],0
        mov     [wc.cbWndExtra],0
        mov     eax,[hinstance]
        mov     [wc.hInstance],eax
        mov     [wc.hbrBackground],COLOR_BTNFACE+1
        mov     [wc.lpszMenuName],0
        mov     [wc.lpszClassName],_class
        invoke  RegisterClass,wc

        invoke  CreateWindowEx,0,_class,_title,WS_VISIBLE+WS_DLGFRAME+WS_SYSMENU,128,128,192,192,NULL,NULL,[hinstance],NULL
        mov     [mainhwnd],eax
        mov [imm.dwSize], sizeof.INITCOMMONCONTROLSEX
        mov [imm.dwICC], ICC_BAR_CLASSES
        invoke InitCommonControlsEx, imm
        invoke CreateWindowEx, 0, tbclass, NULL, WS_CHILD + WS_VISIBLE + TBS_HORZ, 5, 5, 100, 20, [mainhwnd], 0, [hinstance], NULL
        mov [htb], eax

  msg_loop:
        invoke  GetMessage,msg,NULL,0,0
        or      eax,eax
        jz      end_loop
        invoke  TranslateMessage,msg
        invoke  DispatchMessage,msg
        jmp     msg_loop

  end_loop:
        invoke  ExitProcess,[msg.wParam]

proc WindowProc, hwnd,wmsg,wparam,lparam
        push    ebx esi edi
        cmp     [wmsg],WM_DESTROY
        je      wmdestroy
  defwndproc:
        invoke  DefWindowProc,[hwnd],[wmsg],[wparam],[lparam]
        jmp     finish
  wmdestroy:
        invoke  PostQuitMessage,0
        xor     eax,eax
  finish:
        pop     edi esi ebx
        return
endp

section '.idata' import data readable writeable

  library kernel,'KERNEL32.DLL',\
          user,'USER32.DLL',\
          cmt,'COMCTL32.DLL'

  import kernel,\
         GetModuleHandle,'GetModuleHandleA',\
         ExitProcess,'ExitProcess'

  import user,\
         RegisterClass,'RegisterClassA',\
         CreateWindowEx,'CreateWindowExA',\
         DefWindowProc,'DefWindowProcA',\
         GetMessage,'GetMessageA',\
         TranslateMessage,'TranslateMessage',\
         DispatchMessage,'DispatchMessageA',\
         LoadCursor,'LoadCursorA',\
         LoadIcon,'LoadIconA',\
         PostQuitMessage,'PostQuitMessage'

  import cmt,\
         InitCommonControlsEx, 'InitCommonControlsEx'
    
Post 07 May 2005, 04:08
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
coconut



Joined: 02 Apr 2004
Posts: 326
Location: usa
coconut
InitCommonControls should work too, why use the Ex version?
Post 07 May 2005, 14:20
View user's profile Send private message Reply with quote
dieboy



Joined: 30 Dec 2004
Posts: 41
Location: Poland, Elblag
dieboy
I have accustomed Smile.
Post 09 May 2005, 06:56
View user's profile Send private message Visit poster's website ICQ Number 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-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.