Hi all,
May I know what is Alt key scan code, VK_ALT :confused: or 04ch :confused:
Any how to retrieve the cursor (input cursor not mouse cursor) position in edit control in x,y coordinate. --> I want to pop up a window in where the user typing,
so I need to know how to retrieve the x,y coordinate to move the window to.

Thanks
Posted on 2003-12-17 08:13:17 by QS_Ong
1) VK_MENU

Interestingly named enough, it accesses the window's drop-down menu + first letter on menu item, when pressed.. I didn't know it was VK_MENU until I searched on google.. here's the link:

http://delphi.about.com/library/blvkc.htm

Yes it's for delphi but the VK codes are identical.

2) I don't know and would like to know the answer to that one also.
Posted on 2003-12-17 09:13:33 by drarem
I beleive scan code for ALT key is 58h. You can read it from lParam.

If you look at API it tells of the point structure but all that was needed is these variables:

.data

pt dd 0
x dd 0
y dd 0
hexptx dd 0
hexpty dd 0

displayPnt db "X coordinate: %08x",0Dh,0Ah
db "Y coordinate: %08x",0Dh,0Ah
CODE1 db "Caret Parameters:",0


.data?

Pntbuffer db 8192 dup(?)


position:
test shiftKey,10h
jz DoNothing
invoke GetCaretPos,addr pt
mov eax,x ; pt=y "pt or x"
mov hexptx,eax
mov eax,pt
mov hexpty,eax
invoke wsprintf,addr Pntbuffer,addr displayPnt,hexptx,hexpty invokeMessageBox,hEdit,addrPntbuffer,addrCODE1,MB_OK+MB_ICONINFORMATION
xor eax,eax
mov shiftKey,eax
invoke SetFocus,hEdit

hope this helps
Posted on 2003-12-17 09:22:50 by mrgone
Hi,
58h is scan code for x, and VK_MENU work if I press Ctrl & Alt key together. If I press only Alt it wouldn't work.
What I want is when the user press Alt-F8, it activate something, so I have to scan if user press Alt key.

Thanks
Posted on 2003-12-19 07:23:53 by QS_Ong
QS_Ong ,
May I know what is Alt key scan code, VK_ALT or 04ch
Any how to retrieve the cursor (input cursor not mouse cursor) position in edit control in x,y coordinate. --> I want to pop up a window in where the user typing,
so I need to know how to retrieve the x,y coordinate to move the window to.

The vertical blinking bar is a caret, not a cursor. If you want its position, check out the GetCaretPos API. Those VK_xxx definitions are virtual key codes that appear in the wParam parameter of WM_KEYDOWN, WM_KEYUP, WM_SYSKEYDOWN, and WM_SYSKEYUP messages. I can send you a program that demonstrates how they can be coded from Charles Petzold's book, Programming Windows. Ratch
Posted on 2003-12-19 11:21:51 by Ratch
You have to subclass your window so that you get first crack and the keys.
Posted on 2003-12-19 12:00:19 by mrgone
Hi,
I scan the code in the message loop. See file C--IDE.C--, line 135. Work OK for ctrl & shift key. If I don't open a file or new file it does not work.
:confused:
Any idea:)

Thanks
Posted on 2003-12-20 05:30:47 by QS_Ong
QS_Ong,
I thought this was a ASM forum. So why am I receiving C code from you? Anyway, because you specifically pointed out a spot in your code, I can help you.

In reviewing your previous posts on this thread, I have concluded that you are clueless about what is supposed to be going on. You need to beg, borrow, buy, or steal a book like Charles Petzolds's Programming Windows. Then read it. You should also have the documentation for the Windows APIs.

First of all, don't program with scan codes. Those are the hardware codes that come from the keyboard. They COULD be different for different keyboards, especially for specific language keyboards. Unless you want to support every different keyboard made, use the virtual key codes starting with VK_ for consistency. But that's only if you really need to read the key codes.

Second of all, you should not try to intercept SPECIFIC windows messages in your message loop; at least not the ones you are interested in for this particular problem. You should look for them in your CALLBACK code where they are processed by you, the user. This code is called by various names like WndProc, dispatcher, event handler, etc.

Third of all, you should know what you are looking for. This is where the book and documentation are essential. Let's take it from the beginning. Suppose you want to look for a single character like 'a' from the keyboard. All you need do is process WM_CHAR and look for ASCII 'a' in wParam. Next, suppose you want to process ALT+ some other key. ALT in Windows means a system command, so you should process the WM_SYSCHAR message and look for the ASCII character in wParam. If you look for a ALT+key in WM_CHAR, you will never find it. No need to get involved with scan codes, virtual codes, ALT key codes, what comes first or last, subclassing, or anything else. Keep it simple. Windows does most of that work for you by translating the keys and sending you the character messages. I am sending you a utility program, not an example, so you can see what happens when a key is pressed. Ratch
Posted on 2003-12-20 11:08:45 by Ratch