News:

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

problem on using WM_CHAR

Started by Arash, April 11, 2008, 03:12:19 PM

Previous topic - Next topic

Arash

Hi

i want to use WM_CHAR message in my program, i am newbie in assembly
this is part of my Dialog Procedure that use WM_CHAR, but i don't know why doesn't work


CalcProc PROC hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM
...
...
.elseif uMsg == WM_CHAR
;push wParam
;pop InChar
invoke MessageBox, hWnd, addr szTest, addr szTest, MB_OKĀ  ; this is just for debugging
;invoke UpdateNumber, hWnd, wParam
...
...
CalcProc ENDP


sorry for my bad English, if i mistake
thx

hutch--

Hi Arash,

Sorry about deleting your previous membership but unless you post we must do this to ensure the forum is not spammed.

Tell us what you want to do with the WM_CHAR message. Normally it is used in what is called a "subclass" of a control like an edit control so you can filter the characters being entered.

Let us know what you are trying to do and we can probably help you.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Arash

Hi hutch--

it doesn't matterĀ  :wink

I wish to create a simple calculator same as windows calculator
and i would like to limiting entered figures by user by counting WM_CHAR message.
could you please tell me how can i do that


hutch--

Arash,

Here is a simple example on how to subclass an edit control and filter the input characters so you only can enter numbers.

In the WM_CREATE message in the WndProc the edit control is created and the following lines subclass the edit control. The subclass procedure is at the end of the file and it shows how to filter the WM_CHAR message.

[attachment deleted by admin]
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Arash

Thanks hutch for your example, it's help me a lot