News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Caps lock on Warnning while in edit box

Started by hfheatherfox07, April 18, 2011, 05:53:30 PM

Previous topic - Next topic

hfheatherfox07

I just got thinking ...
My original question was to do with activating the caps lock on message when I am in an edit box ( when the cursor is in the edit box...or when I move the cursor to that edit box and the caps lock are on)
...not controlling the edit box color....
Does this do that?



dedndave

no - lol
but, if you look at the link qWord gave you about tool tips, you will find what you want

http://msdn.microsoft.com/en-us/library/bb760250(v=vs.85).aspx

jj2007

Quote from: qWord on April 18, 2011, 11:24:41 PM
ok
the MDICLIENT-class requires  an pointer to the CLIENTCREATESTRUCT through lpParam.
sry for confusing you people.
[By Creating an normal window, it should work (the WndProc must also adjusted)]
Works like a charm now.

Quote    ; our main-window
.data
    mcc CLIENTCREATESTRUCT <>
.code
    mov edi,rv(CreateWindowEx,0,"MDICLIENT",0,WS_VISIBLE or WS_SYSMENU,100,100,100,50,0,0,hInstance, addr mcc)

hfheatherfox07

Quote from: dedndave on April 19, 2011, 12:06:46 AM
no - lol
but, if you look at the link qWord gave you about tool tips, you will find what you want

http://msdn.microsoft.com/en-us/library/bb760250(v=vs.85).aspx

Sorry I missed that... that helped ... I goggled "Tooltip OnClick MASM" ( I had no Idea that Is called 'Tooltip' ) and It brought me here :

http://www.masm32.com/board/index.php?topic=4861.0

So that Is covered...

But how do I activate the caps on when I click into the edit box and my caps are on???

If you look at my first attachment ... I tried WM_LMBUTTONCLICK but it works when I click any were , even on buttons when my caps lock is on.....

hfheatherfox07

Quote from: jj2007 on April 19, 2011, 12:23:14 AM
Quote from: qWord on April 18, 2011, 11:24:41 PM
ok
the MDICLIENT-class requires  an pointer to the CLIENTCREATESTRUCT through lpParam.
sry for confusing you people.
[By Creating an normal window, it should work (the WndProc must also adjusted)]
Works like a charm now.

Quote    ; our main-window
.data
    mcc CLIENTCREATESTRUCT <>
.code
    mov edi,rv(CreateWindowEx,0,"MDICLIENT",0,WS_VISIBLE or WS_SYSMENU,100,100,100,50,0,0,hInstance, addr mcc)

That works... :U

hfheatherfox07

I am very sorry to say that I got carried a way with the example that was posted ( I never refuse a code example... I think I have the MASM bug)
but my original question was not answered ....

In my original question I ask how to activate the caps lock message ONLY when I am in 1 edit box .... that is why my example has 2 edit boxes ... So I can make sure that it only works in one ! Otherwise when I use WM_LBUTTONDBLCLK  it will activate on buttons and statics as well ...

So how do I capture that edit box????


dedndave

for one thing, i would not use a timer
rather, i would handle WM_KEYDOWN or WM_KEYUP with a call to GetAsyncKeyState
or - you can probably just examine wParam/lParam to see if it was caps lock

at that point, you may be able to examine hWnd to verify which edit box you are in
but - because the focus will only be in one box at a time, you shouldn't get it twice   :P
i am somewhat new to GUI stuff, and i haven't done a lot with dialogs yet
hope that helps, though

hfheatherfox07

I tried some thing similar ... I thought you needed a timer in order to activate the key state?

dedndave

i think that's the advantage of using the Async function - you can call it at any time

dedndave

no need to use that funtion
here are the messages i get when tapping the caps lock key several times



wParam = VK_CAPITAL (14h)

that doesn't tell you the caps lock state though - lol
give me a minute.....

the attachment is the above PNG image renamed to ZIP

hfheatherfox07

I am not sure how to do that... I must capture control only when I am in the edit box....
I am back to my first question... I have no Idea how to do that... :(

dedndave

well - i would handle WM_KEYDOWN, in this case and use GetAsyncKeyState
caps lock state toggles when the key is pressed
in many other cases, i would use WM_KEYUP

you should get that message only once no matter which box you are in
try examining hWnd to see which box has focus
or handling WM_SETFOCUS and WM_KILLFOCUS messages to keep track

hfheatherfox07

That does not single out the edit box only ..
it does not have to be caps lock it could be when you  WM_LMBUTTONCLICK inoke any message ...

I need to know how to single out the edit box... I tried Non client area but that gave me the window :(


dedndave

let me play with your code a little.....

jj2007

GetFocus? Not elegant but it should work.