Hi I am trying to create the "Caps lock is on" Warning while in edit box
The same one that you get when you log in and your caps Lock are on:
I imagine it is like invoking "Shell about"... but I can not find any thing on
How to invoke it??
I was successful in recreating it by taking a snap shot of the screen and then converting it in to a region...but that is not the right way to do it... see "CAPSLOCK_ON Message_2.zip" inside "CapsLock Project.zip"
I am looking for three things to happen when the cursor is in ONE of the edit boxes:
1. If I press Caps lock on while in the edit box, turn on and off! The "caps lock Caps lock is on" Warning
2. If the caps Lock are on before I click into the edit box than the warning should come on.
3. How to invoke that message
I have included in the "CapsLock Project.zip" "CapsLock State.zip" which deals with
Determining if the caps lock key was pressed by using:
Invoke GetKeyState,VK_CAPITAL
And I have also tackled whether the caps are on by using:
INVOKE GetKeyState,VK_CAPITAL
see "Edit Box With CAPS ON Warnning.zip" inside "CapsLock Project.zip"
Although I can not get the warning to come on only when I am in the edit box...
I dunno why?
I apologize in advance for the mess in the .asm of the edit box with all my notes ...but it is a work in progress
Thank you...
One attachment with 4 zips inside? ::)
hi,
here an edit that change its background color, if CAPS LOCK is toggeld on.
Quoteinclude masm32rt.inc
WndProc proto hWnd:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
IDT_CHECK_CAPSLOCK EQU 100
.data?
hInstance HINSTANCE ?
pOrgProc PVOID ?
capslock DWORD ?
.code
main proc
LOCAL msg:MSG
mov hInstance,rv(GetModuleHandle,0)
; our main-window
mov edi,rv(CreateWindowEx,0,"MDICLIENT",0,WS_VISIBLE or WS_SYSMENU,100,100,100,50,0,0,hInstance,0)
mov pOrgProc,rv(SetWindowLong,edi,GWL_WNDPROC,WndProc)
; edit control
mov esi,rv(CreateWindowEx,0,"EDIT",0,WS_VISIBLE or WS_CHILD,0,0,100,50,edi,0,hInstance,0)
; create timer
invoke SetTimer,edi,IDT_CHECK_CAPSLOCK,25,0
.while 1
invoke GetMessage,ADDR msg,0,0,0
.break .if !eax || eax == -1
invoke TranslateMessage,ADDR msg
invoke DispatchMessage,ADDR msg
.endw
exit
main endp
WndProc proc hWnd:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
.if uMsg == WM_CLOSE
invoke PostQuitMessage,0
.elseif uMsg == WM_CTLCOLOREDIT
.if capslock
invoke SetBkColor,wParam,07171FFh
invoke CreateSolidBrush,07171FFh
.else
invoke SetBkColor,wParam,0ffffffh
invoke CreateSolidBrush,0ffffffh
.endif
ret
.elseif uMsg == WM_TIMER
.if wParam == IDT_CHECK_CAPSLOCK
mov edx,rv(GetKeyState,VK_CAPITAL)
.if edx & 1 && !capslock
mov capslock,1
invoke InvalidateRect,hWnd,0,TRUE
.elseif !(edx & 1) && capslock
mov capslock,0
invoke InvalidateRect,hWnd,0,TRUE
.endif
.else
@@: jmp @F
.endif
.else
@@: invoke CallWindowProc,pOrgProc,hWnd,uMsg,wParam,lParam
ret
.endif
xor eax,eax
ret
WndProc endp
end main
Thanks for the fast reply....
@ qWord
That asm keeps crashing ? I can not assemble it?
I am going to try to assemble a version with a rsrc.rc
How to translate:
; create timer
invoke SetTimer,edi,IDT_CHECK_CAPSLOCK,25,0
.while 1
invoke GetMessage,ADDR msg,0,0,0
to work with "hedit1"
Thanks.....
Quote from: hfheatherfox07 on April 18, 2011, 09:38:47 PMThat asm keeps crashing ? I can not assemble it?
what erros does masm throw?
What I meant was that I can not assemble a successful .exe out of it the it assembles fine from the sense that it compiles , but it crashes...
Please see the 2 screen shots that I took ...one I assemble it with a BAT file ...same thing ( at the end of the bat I tried asm.exe to run it from the bat)
hi,
Currently i can't see the problem - have you test the program I've attached in my previous post?
it crashes here, as well - access violation
something to do with the first CreateWindowEx
it says in the docs, that if you use WS_SYSMENU, you should also specify WS_CAPTION
however, that does not fix it :P
the other parms look ok, so far as i can tell
i am running XP sp3
Quote from: qWord on April 18, 2011, 10:23:51 PM
hi,
Currently i can't see the problem - have you test the program I've attached in my previous post?
yes I have and I get the same results ???
I never had this problem before ... I will try It again on a different computer tonight....
this is strange....
Do you have a version with a resource ?
I am trying to achieve this :
(http://www.humanized.com/weblog/images/caps_lock_indication.png)
mhh, ok
her on Win7-x64 it works fine. Eventually the subclassing is the problem - new version attached.
still a crash :bg
i put a message box after CreateWindowEx to show the handle
it never gets that far
sry - I've upload the same file again - pleas redownload from previous post :bg
EDIT: hfheatherfox07 look here: About Tooltip Controls (http://msdn.microsoft.com/en-us/library/bb760250(v=vs.85).aspx)
i put a message box after CreateWindowEx to show the handle
it never gets that far
so, it's not subclassing
i tried adding....
push ICC_WIN95_CLASSES
push sizeof INITCOMMONCONTROLSEX
INVOKE InitCommonControlsEx,esp
pop ecx
pop edx
no luck
maybe it needs a manifest
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)]
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?
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
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)
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.....
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
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????
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
I tried some thing similar ... I thought you needed a timer in order to activate the key state?
i think that's the advantage of using the Async function - you can call it at any time
no need to use that funtion
here are the messages i get when tapping the caps lock key several times
(http://www.masm32.com/board/index.php?action=dlattach;topic=16480.0;id=9097)
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
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... :(
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
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 :(
let me play with your code a little.....
GetFocus? Not elegant but it should work.
hi,
I've played a bit with tooltip's (attachment) - currently the Tooltip only appears while the mouse is over the edit control (the EDIT must have the focus). Also it will not work correct when caps lock is on while program start - you need to press CAPS twice times to show the warning.
Maybe somebody will get it work proper...
Quote from: qWord on April 19, 2011, 08:00:43 PM
hi,
I've played a bit with tooltip's (attachment) - currently the Tooltip only appears while the mouse is over the edit control (the EDIT must have the focus). Also it will not work correct when caps lock is on while program start - you need to press CAPS twice times to show the warning.
Maybe somebody will get it work proper...
Sorry it does not work at all for me
i am trying to waddle through the if.else.endif stuff - lol (not my cup of tea)
at the same time, trying to figure out how a dialog box works
in the mean time....
it looks like you want to use GetKeyState instead of GetAsyncKeyState
bit 0 of the result tells you the caps state
Quote from: dedndave on April 19, 2011, 08:40:25 PM
i am trying to waddle through the if.else.endif stuff - lol (not my cup of tea)
at the same time, trying to figure out how a dialog box works
in the mean time....
it looks like you want to use GetKeyState instead of GetAsyncKeyState
bit 0 of the result tells you the caps state
Actully I need to use both .... but for now I want to get one working
The idea is that If I click into that edit box and my caps are on it will invoke that message
and if I am in that edit box and I turn my caps lock on then it will invoke that message
I have seen this done in a VB example (no source)
@ qWord
Re: your post here :
http://www.masm32.com/board/index.php?PHPSESSID=faf058b6f7a48b76b16d2cdf2af10712&topic=12464.0
can you fix this so when i am over the static with the cursor I can do some thing like change color???
Here is one option:
CASE WM_NOTIFY
mov edx, lParam ; Pointer to NOTIFY structure
mov eax, [edx.NMHDR.code]
.if eax==TTN_SHOW
mov ebx, [edx.NMHDR.hwndFrom] ; tooltip window handle
mov edx, [edx.NMHDR.idFrom]
.if edx==hEdit
invoke GetKeyState, VK_SHIFT
.if sword ptr ax>=0
invoke MoveWindow, ebx, -999, -999, 100, 100, 0
.endif
pop esi
or eax, -1
jmp Bye
.endif
.endif
Attached a working example. Press Shift and move the mouse into the edit field.
maybe i am wrong, here
not being experienced with dialogs :bg
it does not appear that the main dialog window is receiving any WM_KEYDOWN messages
i suspect that is because they are going to the edit box that has focus, instead
my first approach would be to subclass the edit controls so that you could intercept their messages
that way, you could know which has focus, and receive WM_KEYDOWN messages
i am sure there is a better way to do it
Bill (or any number of other members) could slap this out in a heart beat :P
@jj2007 Do you have a source for that example??? I need one for an edit box ...edit boxes are different than buttons ... how do I know if that is a button or a static with Notify ( I have made those before )
I am so lost
ok, now i get it (thanks again to Jochen)
handle WM_NOTIFY
get the edit box handle and/or code from the NMHDR structure
then, you can look for NM_SETFOCUS or NM_KEYDOWN (examining the GetKeyState,VK_CAPITAL value)
i am a little lost in dialog boxes, not knowing what to return
and, i feel naked with no DefWindowProc :bg
I d have to see a working example , right now I spent so much time on this my head is spining
i may play with it after my nap
i have no "tasks" to perform this afternoon - lol
i wanted to get my feet wet with dialog boxes, anyways
Quote from: hfheatherfox07 on April 19, 2011, 09:10:24 PM
I d have to see a working example , right now I spent so much time on this my head is spining
I did attach a working example above, except that Shift instead of CapsLock is used (the reason being that my CapsLock button is disabled :bg)
> Do you have a source for that example???
\masm32\RichMasm\Res\SkelWinMB.asc - part of the MasmBasic (http://www.masm32.com/board/index.php?topic=12460) library. Open in RichMasm, add the WM_NOTIFY handler shown above, press F6. Or look at the attachment (but you still need the MB library).
i will give a quickie explanation for you (from a n00b, mind you)
when the dialog main window receives a WM_NOTIFY message...
grab wParam - it is the address of a NMHDR structure
in the NMHDR structure, you can get the handle of the edit box that sent the notification
mov edx,wParam
mov ecx,[edx].NMHDR.hwndFrom
or, better yet, the ID
mov ecx,[edx].NMHDR.idFrom
seeing as you have assigned the ID numbers, you can use that to tell which control sent the WM_NOTIFY
you can also get the code
mov eax,[edx].NMHDR.code
now, you know which edit box sent which notification
codes we may be interested in are NM_SETFOCUS and NM_KEYDOWN
and, you will want to use
INVOKE GetKeyState,VK_CAPITAL
and eax,1
to get the caps lock toggle state
you may want to add one of those in the init code to initialize a capslock state var
here are the msdn links...
http://msdn.microsoft.com/en-us/library/bb775583%28v=vs.85%29.aspx
http://msdn.microsoft.com/en-us/library/bb775514%28v=vs.85%29.aspx
http://msdn.microsoft.com/en-us/library/bb775497%28v=vs.85%29.aspx#notifications
that last one has all the NM_ code values near the bottom
Actually, the tooltip's ID is identical to the control's handle. It is not logical, it's Microsoft :bg
.if eax==TTN_SHOW
mov ebx, [edx.NMHDR.hwndFrom] ; tooltip window handle
mov edx, [edx.NMHDR.idFrom]
.if edx==hEdit
sounds easy enough
i am off for a nap
i bet JJ has it up and running before i get up :P
if not, i will take a crack at it
see u all in a few days ...will be gone tomorrow
let me start by saying, it isn't nearly as simple as it first appeared - lol
Edit Controls do not send notifications to the parent window via WM_NOTIFY
instead, they use WM_COMMAND
the documentation is a little confusing
from the Edit Control docs...
Quote
wParam = control identifier
lParam low word = control handle
lParam high word = notification code
from the WM_COMMAND docs...
QuotewParam low word = control identifier
wParam high word = notification code
lParam = control handle
i think the WM_COMMAND doc is correct and the Edit Control doc is incorrect
at least, that's how it appears by looking at the doc for EN_SETFOCUS
the notifications sent by an Edit Control to the parent are:
EN_CHANGE 300h
EN_ERRSPACE 500h
EN_HSCROLL 601h
EN_KILLFOCUS 200h
EN_MAXTEXT 501h
EN_SETFOCUS 100h
EN_UPDATE 400h
EN_VSCROLL 601h
so - focus is there, but no KEYDOWN
it looks like sub-class or super-class to get the caps lock state that way
a timer would probably be easier, but doesn't seem like a very clean way to do it
i might try using a keyboard hook, as Michael suggested to me in another thread
http://www.masm32.com/board/index.php?topic=16427.msg136108#msg136108
hi,
I've end up in creating an owner drawn control - full working example (OllyDbg-tested :bg) attached.
qWord
looks good :U
i have a working hook, at least
have to go take care of dad for a while :P
hook code...
KeyboardProc PROC nCode:SDWORD,wParam:WPARAM,lParam:LPARAM
test nCode,80000000h
jz kproc0
INVOKE CallNextHookEx,hhk,nCode,wParam,lParam
ret
kproc0: mov eax,VK_CAPITAL
cmp eax,wParam
jnz kproc1
test lParam,40000000h
jnz kproc1
INVOKE GetKeyState,eax
and eax,1
xchg eax,CapsState
kproc1: ret
KeyboardProc ENDP
init code...
INVOKE GetCurrentThreadId
INVOKE SetWindowsHookEx,WH_KEYBOARD,KeyboardProc,NULL,eax
mov hhk,eax
exit code...
INVOKE UnhookWindowsHookEx,hhk
thanks to MichaelW for example code :U
i have to add a SendMessage or something to the hook code to notify the DlgProc
here's what i have so far
everything seems to be working correctly
i just need to replace the message boxes with tooltips
maybe i will get a chance to do it later today
this morning, i am installing a new garage door opener for mom :P
updated the attachment with a smaller icon file
the icon file could be improved upon :P
41 Kb icon file - 4 Kb code/data/rsrc/PE
146 x 68 24-bit ??????? :eek
(http://www.masm32.com/board/index.php?action=dlattach;topic=16480.0;id=9112)
the attachment is the above PNG image renamed as ZIP
i removed the 146x68 icon image and updated the attachment above (CapsLock2)
the 146x68 24-bit image for the masm32 sdk icon is used for the installer, i believe :P
ok - here is one with tooltips
i tried to add a manifest file, but the app either crashes with a config error or does not display tooltips :P
i have had a similar problem before, but do not recall what the solution was
i tried 3 different sizes for TOOLINFO struct, so that's not it
it's not msvcrt - i can remove that altogether, as i use no crt functions, nor mas32 lib
anyways, here it is with the manifest commented out in the resource file
this is my first whack at tooltips
if you ask me, they aren't very flexible
but then, maybe that's my fault because this is my first whack at tooltips :lol
maybe we can get one of the manifest geniuses to look at this one ( hint, hint, Edgar :bg )
it would be really nice to know what causes this, too:
(http://img687.imageshack.us/img687/6734/cfgerr.png)
.... or, it may not :P
I get the tooltop (with or without the manifest) but only if I mouse over the edit with focus.
yes - i wrote it that way :bg
under XP MCE2005, sp3, i get no tooltips if i add the manifest
i have a slightly different manifest file that causes the above error
i also tried WS_EX_TOPMOST when creating the tooltips
the way it's written, the edit control that has focus - and, of course, caps lock must be on
you may also notice slightly different messages in the two controls
if i were to use this in an app, i'd probably only have the tooltip in the bottom edit control
user ID entry would be visible and password entry would be obfuscated with "*"
Sorry to you and qWord but they are ugly tooltips :lol
do you have an example of pretty ones ? :bg
i'd like to know how they change the font, too
in the windows user login password box, the "Caps Lock is On" text is bold
anyways, it was a learning experience
i needed a break from my other project, and i had been wanting to play with dialogs a little
i got my feet wet :U
Hi,
qWord, yours looks good and works well. Dave, your capslock2
works well except to clear the message you need the mouse,
the enter key does not work. Your capslock3 seems very erratic
and does not work well.
Regards,
Steve N.
P.S. Had the caps lock on when I started this, and was not warned.
;-)
YOU'RE RIGHT, sTEVE :lol
in fact, none of the keys work
i must have a problem with my hook :(
ok - now i get everything except enter
ok - that's the way the original poster made the edit controls
i guess, when they hit enter in the first box, it sends them to the second
when they hit enter in the second box, i will close the dialog
have to add the code for that later
the fix for the keyboard hook is to always exit via the call to CallNextHookEx
well - normally, to see whether an edit box has pressed enter, i would have to go through
a bunch of code, sorting out structure data, etc
but, seeing as how i...
1) have a keyboard hook in place
2) keep track of the focus, anyways
i could just let the hook send a message to the dialog proc and act according to the focus :bg
but, probably "cleaner" if i do it the right way - lol
Quote from: dedndave on April 22, 2011, 11:35:17 AM
in the windows user login password box, the "Caps Lock is On" text is bold
Bold enough?
(http://www.masm32.com/board/index.php?action=dlattach;topic=16480.0;id=9134)
i can see that without my glasses, Jochen :bg
but, what i meant to say was - they have 2 different fonts in the same tooltip
i.e., how do you change fonts in mid-stream :P
(http://www.masm32.com/board/index.php?action=dlattach;topic=16480.0;id=9135)
i tried using SetWindowText
supposedly, tooltips have a "titlebar"
i see they also have an icon
i must be mashing the wrong buttons
the attachment is the above PNG image renamed as ZIP
Quote from: dedndave on April 22, 2011, 04:48:12 PM
but, what i meant to say was - they have 2 different fonts in the same tooltip
That sounds quite impossible ::)
(http://www.masm32.com/board/index.php?action=dlattach;topic=16480.0;id=9136)
:P
you beat me to it - lol
TTM_SETTITLE
i wanted a way to force a tooltip to show
little trick - send the tooltip a WM_MOUSEHOVER message with wParam and lParam set to 0 :P
i have it working pretty well, now
i am just playing with the TTDT_INITIAL and TTDT_RESHOW delay times
trying to figure out the common controls/manifest problem :(
this might be effective
call Random
push eax
push sizeof INITCOMMONCONTROLSEX
INVOKE InitCommonControlsEx,esp
pop ecx
pop edx
it's bound to work, eventually :P
in an attempt to "marshall" some help on the manifest file, i have created a new thread
the first post includes the download of my latest attempt
if you comment out the manifest line in the resource file and build it, it works fairly well
http://www.masm32.com/board/index.php?topic=16538.0
ok - my final attempt :bg
the caps lock warning only comes on for the "password" edit control :U
a whole bunch of code has been eliminated - lol
Hi,
Not working here. (No warning. The rest seems to work.)
The name is modified if that matters.
Sorry,
Steve N.
yah - i was afraid the ES_PASSWORD balloon tip might not work on win 2k
maybe i'll put the other tip back in there - i already have the code written - lol
i don't understand what you mean by "The name is modified" :P
Hi,
For various reasons (some of which either don't make sense
to me or are unknown), ZIPped files get renamed to 8.3 on this
machine. So capslock5.exe gets truncated. I did not see where
that would make a difference in this case, but it has screwed up
things before. So I mentioned it just to be complete.
Cheers,
Steve
ahhhh - that is probably the WinZip version number :P
it makes no difference, in this case
well - i am not really sure how to make one that works with win2k through win7
other than owner-drawn, i guess
i have a version with the ES_PASSWORD style on edit control #2
and it's subclassed to disable the balloon tip
now, you just have to add your own tooltip in there that works on different windows versions :P
kind of like a kit - some assembly required :lol
at this point, i am going to drop this little toy and move on with my other project
Quote from: dedndave on April 25, 2011, 12:46:45 PM
ok - my final attempt :bg
the caps lock warning only comes on for the "password" edit control :U
a whole bunch of code has been eliminated - lol
Hi all... I am back ... Sorry I was away longer than expected...
Thank you so much for all the reply's....
I just came and got to my emails and from I can tell from downloading the attachments... this one works!
I have not had the chance to assemble my self yet but It seems to work great ! Thanks...
Thank you again....
And sorry for my absence in this...
:bg
Dave,
There is a vulgarity that would do the job fine, subclass the edit control and filter the characters as they are typed. Use GetAsynchKeyState() to test if the "Shift" key is pressed and if its not squark a warning about the caps lock being on.
Hutch,
i can get the key state - and the focus - no problem there
what i cannot do is control the tooltip - lol
i can create it, set the icon and delay times, and a whole bunch of other stuff
but, i can't force it to pop up
it wants a mousemove message, i think - i might be able to synthesize that message
and - the cursor has to be over the control, and it has to have focus for that
the activate message merely enables/disables - it does not force it to pop up
they don't really give you a simple on/off switch
qWord may have the right idea - owner-drawn :P
hfheatherfox07,
that version does work - on anything with XP or newer
i think to go back to win2k, you may have to do something a little different
even on XP, i was not able to find a way to get the ES_PASSWORD tooltip handle
i tried enumerating windows, but that tooltip did not show up
that means - you can't get a lot of control on it
things like setting delay times or balloon width require the tooltip handle
Humm... I am a little confused here....
I read everything people write.... I was so excited by seeing example 5 of dedndave that I decided to assemble my own "Cap locks on Example" tool tip with snippets form dedndave......
I decided that I will start from scratch..... I saw that dedndave mentioned the password format for the edit box..... So I made a new exe with 2 edit boxes again( 2 so I can make sure that the caps lock on comes on only in the desired 1)...
and I added a Manifest... I compiled the exe.....
I must have left my Caps Locks on ....because when I tried the edit boxes that message that I wanted came on?????
I looks like this is a standard API thing with edit boxes that have "password" as the format instead of "Normal" or "Numbers" etc...
It looks like 2 things are needed to get that caps lock on message:
1. The edit box control must be set to "password" ( I use ResEd by the way )
2. A Manifest
As you can see my ASM is empty, there is no getkeystate or tootip... I did not even initiate the edit boxes
P.S
Here is Microsoft's Manifest:
http://msdn.microsoft.com/en-us/library/aa375635%28v=vs.85%29.aspx
and Microsoft's Assembly Manifests:
http://msdn.microsoft.com/en-us/library/aa374219%28v=vs.85%29.aspx
@ dedndave please see this it deals with Manifest and Win2K Compatibility:
http://www.vbmonster.com/Uwe/Forum.aspx/vb/30889/Manifest-Requires-Win2K-Compatibility
can you use a resource editor and take out a working Manifest from an app on computer that you want this working on and add that Manifest as well as the XPManifest...
by the way will you post a copy of that older Manifest?
wow - ES_PASSWORD+xml -> it works! Also the warning comes in the users language :bg
:thumbu
ok - i am a bit confused as to what your problem is :P
the difference between my manifest and the one at that link is the version identity
yes - you can extract a manifest from an EXE with ResHacker or similar
you want me to post an "older mainfest"
i am not sure which "older" one you are talking about - lol
i have tried all kinds of things
in your last example code, the only problem i see is the margin needs to be set on edit control #2
to make sure they are the same, i sent this message to both edit controls
INVOKE SendMessage,hEdit,EM_SETMARGINS,EC_LEFTMARGIN or EC_RIGHTMARGIN,0
also, different versions use a different "mask character" to hide the password
so, i set it to "*"
INVOKE SendMessage,hEdit2,EM_SETPASSWORDCHAR,'*',0
it is not a "password format", per se
i used the ES_PASSWORD edit control "style"
this requires common controls version 6 or higher to work (XP or newer)
and, it also requires a manifest to work correctly with XP
and - InitCommonControlsEx
when using common controls version 6 or higher, the older InitCommonControls does nothing
i hope that answers all your questions
if not - please ask again :P
the problem i see with using the ES_PASSWORD style is that it does not appear to work under win2k
so - if you want it to work under win2k (and, i guess win98), you have to make your own tooltip window
it's not that hard to do
but, now you are faced with a new problem :bg
that is getting the tooltip to pop up when you want it to
specifically, when edit box 2 has focus, and you turn caps lock on - it does not pop up until the mouse moves
the mouse has to be over the edit control (not the same as keyboard focus)
i am sure, with some fine-tuning, you can make it work
another possible problem is eliminating the WS_PASSWORD style tooltip - lol
i can't find a way to get the handle of that bugger
No problems here ....
I thought It was not working for you on an older version of windows...
ES_PASSWORD and a Manifest works great for me...
Thank you all for all your help... :U
Made this one.
If you unsubclassing, you need uncomment some source.
very cool :U