flat assembler
Message board for the users of flat assembler.
![]() Goto page 1, 2 Next |
Author |
|
baldr 13 Nov 2008, 17:33
Alessio,
Attach compilable source, that will help us to help you faster. |
|||
![]() |
|
bitRAKE 13 Nov 2008, 17:46
Code: tbButton TBBUTTON NEW, IDM_NEW, TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 TBBUTTON SELECT, IDM_SELECT, TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 TBBUTTON PREVIOUS,IDM_PREVIOUS,TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 TBBUTTON NEXT, IDM_NEXT, TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 TBBUTTON DEL, IDM_DEL, TBSTATE_ENABLED,TBSTYLE_BUTTON,0,0 TB_BUTTONS = ($-tbButton)/sizeof.TBBUTTON |
|||
![]() |
|
bitRAKE 13 Nov 2008, 17:49
Code: imul edx,ecx,sizeof.TBBUTTON mov [tbButton.iString + edx],eax |
|||
![]() |
|
Alessio 17 Nov 2008, 09:16
thank you
|
|||
![]() |
|
Teehee 29 Dec 2009, 15:43
I'm trying to create a toolbar, but something is wrong.
Code: .wm_create: invoke CreateWindowEx,0,TOOLBARCLASSNAME,NULL,WS_CHILD+WS_VISIBLE,\ 0,0,0,0,[hwnd],NULL,[wc.hInstance],NULL test eax, eax jnz @f invoke MessageBox,NULL,_error,NULL,MB_ICONERROR+MB_OK @@: jmp .finish0 Code: TOOLBARCLASSNAME db 'ToolbarWindow32',0 But CreateWindowEx is always returning 0. |
|||
![]() |
|
revolution 29 Dec 2009, 16:26
What does GetLastError tell you?
|
|||
![]() |
|
MHajduk 29 Dec 2009, 16:53
Teehee, are you sure that you call the 'InitCommonControls' function at the beginning of your code?
Code: format PE GUI 4.0 include 'win32ax.inc' (...) section '.code' code readable executable start: invoke InitCommonControls (...) .end start Code: TOOLBAR_CLASS equ 'ToolbarWindow32' |
|||
![]() |
|
Teehee 29 Dec 2009, 17:17
MHajduk wrote: Teehee, are you sure that you call the 'InitCommonControls' function at the beginning of your code? oh.. undocumented data. ![]() however, it seems obsolete. MSDN told to use InitCommonControlsEx. Now its working ![]() PS: There is a way to create Toolbar from resource? (like Menus) Edit: Link fixed. _________________ Sorry if bad english. Last edited by Teehee on 31 Dec 2009, 08:45; edited 2 times in total |
|||
![]() |
|
MHajduk 29 Dec 2009, 17:29
Teehee wrote: oh.. undocumented data. Code: %28 for '(' %29 for ')' Quote: oh.. undocumented data. ![]() |
|||
![]() |
|
Teehee 29 Dec 2009, 17:58
thanks again
![]() |
|||
![]() |
|
Teehee 31 Dec 2009, 08:38
I'm can't to shown the text in the ToolBar's buttons.
Button config: Code: toolButton1 TBBUTTON I_IMAGECALLBACK,0,TBSTATE_ENABLED,TBSTYLE_DROPDOWN+BTNS_SHOWTEXT,0,'New' Toolbar config: Code: invoke CreateWindowEx,0,TOOLBAR_CLASS,NULL,\ WS_VISIBLE+WS_BORDER+WS_CHILD+TBSTYLE_WRAPABLE+TBSTYLE_LIST+BTNS_SHOWTEXT+\ TBSTYLE_FLAT+TBSTYLE_TOOLTIPS,\ 0,0,0,0,eax,NULL,[wc.hInstance],NULL mov [hToolBar], eax invoke SendMessage,[hToolBar],TB_BUTTONSTRUCTSIZE,sizeof.TBBUTTON,0 invoke SendMessage,[hToolBar],TB_ADDBUTTONS,1,toolButton1 invoke SendMessage,[hToolBar],TB_SETEXTENDEDSTYLE,0,TBSTYLE_EX_DRAWDDARROWS invoke SendMessage,[hToolBar],TB_AUTOSIZE,0,0 What's happening?
_________________ Sorry if bad english. |
||||||||||
![]() |
|
MHajduk 31 Dec 2009, 10:12
Teehee wrote: I'm can't to shown the text in the ToolBar's buttons. Code: typedef struct _TBBUTTON { int iBitmap; int idCommand; BYTE fsState; BYTE fsStyle; DWORD dwData; int iString; } TBBUTTON, NEAR* PTBBUTTON, FAR* LPTBBUTTON; typedef const TBBUTTON FAR* LPCTBBUTTON; MSDN wrote:
BTW, see the first post in this thread. ![]() |
|||
![]() |
|
Teehee 31 Dec 2009, 10:31
edit:
Well, MSDN says: MSDN wrote: iString Also, here says: Quote: Using TB_ADDSTRING is not the only way to add strings to a toolbar. You can display a string in a button by passing a string pointer in the iString field of the TBBUTTON structure that is passed to TB_ADDBUTTONS. Additionally, you can use TB_SETBUTTONINFO to assign text to a toolbar button. ![]() end edit. ---- And now i'm having troubles with TBN_DROPDOWN notification. I don't know how to get it. I did: Code: .wm_notify: mov eax, [lparam] mov [TB_nmt], eax ; TB_nmt NMTOOLBAR mov eax, [hToolBar] cmp [TB_nmt.hdr.hwndFrom], eax jne @f invoke MessageBox,NULL,_error,NULL,MB_ICONERROR+MB_OK @@: jmp .finish0 but i don't know what's wrong, it's always jumping the messagebox. |
|||
![]() |
|
Teehee 31 Dec 2009, 13:44
Ok, I found iString trouble.
Code: _txt1 db 'example',0 ... toolButton TBBUTTON I_IMAGECALLBACK,0,TBSTATE_ENABLED,\ BTNS_BUTTON+TBSTYLE_DROPDOWN+BTNS_SHOWTEXT+BTNS_WHOLEDROPDOWN,0,\ _txt1 ; <--- here is the trouble. if I move _txt1 to iString in the code, it works: Code: mov [toolButton.iString],_txt1 invoke SendMessage,[hToolBar],TB_ADDBUTTONS,1,toolButton ; Works! _________________ Sorry if bad english. |
|||
![]() |
|
MHajduk 31 Dec 2009, 17:58
Most probably, whole this mess with 'TBBUTTON' structure is caused by different definitions of it for 32-bit and 64-bit versions of Windows. I suppose that you use 64-bit system, so you can't use 32-bit version of the 'TBBUTTON' structure (which I mentioned above).
Let's see how these definitions look like in the 'COMCTL32.INC' and 'COMCTL64.INC' files. 32-bit version: Code: ; COMCTL32.INC struct TBBUTTON iBitmap dd ? idCommand dd ? fsState db ? fsStyle db ? dw ? ; 2 bytes dwData dd ? iString dd ? ends Code: ; COMCTL64.INC struct TBBUTTON iBitmap dd ? idCommand dd ? fsState db ? fsStyle db ? dp ? ; 6 bytes dwData dd ? iString dd ? ends Anyway, try to do this: Code: _txt1 db 'example',0 ... toolButton TBBUTTON I_IMAGECALLBACK,\ ; iBitmap 0,\ ; idCommand TBSTATE_ENABLED,\ ; fsState \ BTNS_BUTTON + TBSTYLE_DROPDOWN + \ ; fsStyle BTNS_SHOWTEXT + BTNS_WHOLEDROPDOWN,\ ; \ 0,\ ; padding data 0,\ ; dwData _txt1 ; iString ![]() Last edited by MHajduk on 31 Dec 2009, 18:24; edited 1 time in total |
|||
![]() |
|
Teehee 31 Dec 2009, 18:06
it works. But i'm not working with 64-bit
![]() _________________ Sorry if bad english. |
|||
![]() |
|
MHajduk 31 Dec 2009, 18:22
OK, seems that I'm slightly distracted today - you just always have to initialize this unnamed member of the structure 'TBUTTON'. OS version doesn't matter here.
![]() |
|||
![]() |
|
Teehee 31 Dec 2009, 18:25
Hmm, ok. Thanks you.
![]() |
|||
![]() |
|
Teehee 31 Dec 2009, 18:38
oh, please, do not forget this:
Quote:
|
|||
![]() |
|
Goto page 1, 2 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.