hi, I have 3 questions/problems I have creating this little app.I hope you guys understand my English
1.-::::Fonts::::
lets say, how can I change to font for button made with CreateWindowEX?
I saw about a post with creating fonts but i dont think that could work, isnt it?
Also, i tried to set a font (ms sans sarif, size 8) with the api send message (WM_SETFONT) but it didnt work or maybe I did it wrong.
2.-::::Combo box::::
How can i make like, make the app to search for items in 1 specified dir, and the the returned items is stored in the combo box (list box with auto scroll), the items might vary up to 400.
3.-::::Directories::::
is there a way to search for directories in a specified folder? (I.E. search all dirs in c:\widows\app\et\)
and how to make the result to be shown only with the folders found? (c:\widows\app\et\abc <--wrong, abc <--correct).
Thanks in advance, I hope you can answer this questions
Greetings.
Oops, almost forgot another problem.
I cannot change to any button made with CreateWindowEX using TAB key, i have WS_TABSTOP style set in Exstyle.
Here is the code:
---the prototype(or whatever is called)---
PushButton PROTO :DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD
---in .code-----
invoke PushButton,ADDR exit,hwnd,280,242,75,25,ID_EXIT
----Procedure---
PushButton proc lpText:DWORD,hParent:DWORD,
a:DWORD,b:DWORD,wd:DWORD,ht:DWORD,ID:DWORD
invoke CreateWindowEx,0,
ADDR btnClass,lpText,
WS_CHILD or WS_VISIBLE or WS_TABSTOP,
a,b,wd,ht,hParent,ID,
hInstance,NULL
ret
PushButton endp
thanks again.
1.-::::Fonts::::
lets say, how can I change to font for button made with CreateWindowEX?
I saw about a post with creating fonts but i dont think that could work, isnt it?
Also, i tried to set a font (ms sans sarif, size 8) with the api send message (WM_SETFONT) but it didnt work or maybe I did it wrong.
2.-::::Combo box::::
How can i make like, make the app to search for items in 1 specified dir, and the the returned items is stored in the combo box (list box with auto scroll), the items might vary up to 400.
3.-::::Directories::::
is there a way to search for directories in a specified folder? (I.E. search all dirs in c:\widows\app\et\)
and how to make the result to be shown only with the folders found? (c:\widows\app\et\abc <--wrong, abc <--correct).
Thanks in advance, I hope you can answer this questions
Greetings.
Oops, almost forgot another problem.
I cannot change to any button made with CreateWindowEX using TAB key, i have WS_TABSTOP style set in Exstyle.
Here is the code:
---the prototype(or whatever is called)---
PushButton PROTO :DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD
---in .code-----
invoke PushButton,ADDR exit,hwnd,280,242,75,25,ID_EXIT
----Procedure---
PushButton proc lpText:DWORD,hParent:DWORD,
a:DWORD,b:DWORD,wd:DWORD,ht:DWORD,ID:DWORD
invoke CreateWindowEx,0,
ADDR btnClass,lpText,
WS_CHILD or WS_VISIBLE or WS_TABSTOP,
a,b,wd,ht,hParent,ID,
hInstance,NULL
ret
PushButton endp
thanks again.
since your questions are not so specific, I can give only some
hints which way would be appropriate:
1. .-::::Fonts::::
WM_SETFONT should work, try to set a standard font from
GetStockObject. If this works, then there can be an error
in CreateFont
2. .-::::Combo box::::
There is a special feature with comboboxes, the CB_DIR message.
There a combobox displays all files of a given dir. Not very
comfortable, but maybe ok for you
3..-::::Directories::::
Take a look in the FindFirstFile and FindNextFile functions, they
can go trough a dir and file structure and give all neccessary info.
4. WS_TABSTOP
This feature is provided only from dialogboxes, not from stand
alone windows. You need to code this on your own, by shifting
the focus with SetFocus during WM_KEYDOWN (for instance).
hints which way would be appropriate:
1. .-::::Fonts::::
WM_SETFONT should work, try to set a standard font from
GetStockObject. If this works, then there can be an error
in CreateFont
2. .-::::Combo box::::
There is a special feature with comboboxes, the CB_DIR message.
There a combobox displays all files of a given dir. Not very
comfortable, but maybe ok for you
3..-::::Directories::::
Take a look in the FindFirstFile and FindNextFile functions, they
can go trough a dir and file structure and give all neccessary info.
4. WS_TABSTOP
This feature is provided only from dialogboxes, not from stand
alone windows. You need to code this on your own, by shifting
the focus with SetFocus during WM_KEYDOWN (for instance).
if you want the WS_TABSTOP style bit (and WS_GROUP) to be handled you have to include the IsDialogMessage() function in your message loop. Its the same as creating a modeless dialog with CreateDialog().
japheth
japheth
ok, i will do that thank you for your help.
btw, i managed to solve the problem with fonts :)
greetings
btw, i managed to solve the problem with fonts :)
greetings
Vital Zero,
I'm still trying to set a controls font using the WM_SETFONT.
Would it be posible if you could show a snippet?
Thanks, :alright:
I'm still trying to set a controls font using the WM_SETFONT.
Would it be posible if you could show a snippet?
Thanks, :alright:
well, here is the code I used, I got it from somewhere, but dont remember right now.
This code was to change the default font to the default used by dialog boxes, in a edit box made as a child window with CreateWindowEX, but I think it could work in a parent window.
;set this after your procedure as local variables
LOCAL hFnt :DWORD
LOCAL hCtl :DWORD
;set this right after API CreateWindowEx
mov hCtl, eax <--copy handle of window in hCtl
invoke GetStockObject,DEFAULT_GUI_FONT <--serif font
mov hFnt, eax <--copy handle of font in hFnt
;send WM_SETFONT msg
invoke SendMessage,hCtl,WM_SETFONT,hFnt,TRUE
mov eax, hCtl <--copy handle of window to eax
and here is the full code i used:
EditSl PROTO :DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD
;in .data
EditClass db "EDIT",0
;in winproc
.if uMsg ==WM_CREATE
invoke EditSl,ADDR player1,80,82,108,17,hWnd,700
.endif
;and I put this at the final in .code
;-----------------------------
;Edit Box Procedure
;-----------------------------
EditSl proc szMsg:DWORD,a:DWORD,b:DWORD,
wd:DWORD,ht:DWORD,hParent:DWORD,ID:DWORD
LOCAL hFnt :DWORD
LOCAL hCtl :DWORD
invoke CreateWindowEx,WS_EX_CLIENTEDGE,ADDR EditClass,szMsg,
WS_VISIBLE or WS_CHILDWINDOW or \
ES_NOHIDESEL,
a,b,wd,ht,hParent,ID,hInstance,NULL
mov hCtl, eax
invoke GetStockObject,DEFAULT_GUI_FONT
mov hFnt, eax
invoke SendMessage,hCtl,WM_SETFONT,hFnt,TRUE
mov eax, hCtl
ret
EditSl endp
Btw, this are the some of the valid fonts that you can change using wm_setfont (they come in api functions help file under GetStockObject function)
I hope this helps. :)
Greetings
This code was to change the default font to the default used by dialog boxes, in a edit box made as a child window with CreateWindowEX, but I think it could work in a parent window.
;set this after your procedure as local variables
LOCAL hFnt :DWORD
LOCAL hCtl :DWORD
;set this right after API CreateWindowEx
mov hCtl, eax <--copy handle of window in hCtl
invoke GetStockObject,DEFAULT_GUI_FONT <--serif font
mov hFnt, eax <--copy handle of font in hFnt
;send WM_SETFONT msg
invoke SendMessage,hCtl,WM_SETFONT,hFnt,TRUE
mov eax, hCtl <--copy handle of window to eax
and here is the full code i used:
EditSl PROTO :DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD
;in .data
EditClass db "EDIT",0
;in winproc
.if uMsg ==WM_CREATE
invoke EditSl,ADDR player1,80,82,108,17,hWnd,700
.endif
;and I put this at the final in .code
;-----------------------------
;Edit Box Procedure
;-----------------------------
EditSl proc szMsg:DWORD,a:DWORD,b:DWORD,
wd:DWORD,ht:DWORD,hParent:DWORD,ID:DWORD
LOCAL hFnt :DWORD
LOCAL hCtl :DWORD
invoke CreateWindowEx,WS_EX_CLIENTEDGE,ADDR EditClass,szMsg,
WS_VISIBLE or WS_CHILDWINDOW or \
ES_NOHIDESEL,
a,b,wd,ht,hParent,ID,hInstance,NULL
mov hCtl, eax
invoke GetStockObject,DEFAULT_GUI_FONT
mov hFnt, eax
invoke SendMessage,hCtl,WM_SETFONT,hFnt,TRUE
mov eax, hCtl
ret
EditSl endp
Btw, this are the some of the valid fonts that you can change using wm_setfont (they come in api functions help file under GetStockObject function)
I hope this helps. :)
Greetings