The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: ragdog on July 17, 2010, 12:04:57 PM

Title: SubClass Vk_Back
Post by: ragdog on July 17, 2010, 12:04:57 PM
Hi

Can any help me by a problem with subclass and vk_Back by Wm_Keydown?


.elseif uMsg==WM_KEYDOWN
  mov eax,wParam
        .if al==VK_BACK
            invoke    CallWindowProc,EditOldProc,hEdit,uMsg,eax,lParam
       
        .else
            invoke CallWindowProc,EditOldProc,hEdit,uMsg,wParam,lParam
            ret
        .endif


How i can delete a sign from the edit?

Greets,
Title: Re: SubClass Vk_Back
Post by: MichaelW on July 17, 2010, 12:25:54 PM
If by "delete a sign from the edit" you mean delete a character, the normal behavior of the backspace key in an edit control is to delete the character to the left of the caret.

Also, I don't understand what you are trying to do. In your IF block both of the INVOKE statements will pass wParam to the old Edit procedure.
Title: Re: SubClass Vk_Back
Post by: ragdog on July 17, 2010, 01:37:45 PM
I trying to delte a character by keydown

Thanks
Title: Re: SubClass Vk_Back
Post by: MichaelW on July 17, 2010, 02:00:10 PM
To delete a character you could select the character with an EM_SETSEL message and then delete it with a WM_CLEAR or WM_CUT message. If you are doing this in a subclass procedure, are you trying to restrict the characters that the user can input?
Title: Re: SubClass Vk_Back
Post by: ragdog on July 17, 2010, 03:52:21 PM
Quoteare you trying to restrict the characters that the user can input?

Yes only numbers

Ok I try your solution

Thanks
Title: Re: SubClass Vk_Back
Post by: MichaelW on July 17, 2010, 04:04:29 PM
To restrict the input to numbers you can include the ES_NUMBER style, but note that this will allow only decimal numbers, no decimal point or hex digits, and that the user can still paste non-digits into the control.

If that is not acceptable, I posted a different solution where you have more control  here (http://www.masm32.com/board/index.php?topic=10411.msg76293#msg76293).
Title: Re: SubClass Vk_Back
Post by: ragdog on July 17, 2010, 05:03:35 PM
Thanks i have solved it