Sign in to follow this  

Help with win32 and undo command

This topic is 4813 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I found this command case ID_UNDO: if (SendMessage(edit_box, EM_CANUNDO, 0, 0)) SendMessage(edit_box, WM_UNDO, 0, 0); else { MessageBox(edit_box, "Nothing to undo.", "Undo notification", MB_OK); } break; in the win32 sdk but every time I type something in my edit window it will not undo it. it just goes to the message box. does any one know how to use this command?

Share this post


Link to post
Share on other sites
ID_UNDO is for the menu not for the command I know it is the EM_UNDO but it wont work. I can right click and undo but if I try to use the menu Edit->Undo it wont work

Thanks for the help I should Of clarified to begin with

Share this post


Link to post
Share on other sites
All this is doing is receiving the Undo command from the user and forwarding it to edit_box. If edit_box is an instance of your own class, you will have to tell it how to undo things (unless you inherited it from some other class that understands the message).

Share this post


Link to post
Share on other sites
This is my edit box

edit_box = CreateWindow("EDIT",NULL,WS_CHILD | WS_VISIBLE | ES_AUTOHSCROLL |
ES_AUTOVSCROLL | ES_LEFT | ES_MULTILINE | ES_NOHIDESEL |
WS_VSCROLL | WS_HSCROLL | WS_BORDER | ES_WANTRETURN,
0, 0, rect.right, rect.bottom, hwnd, (HMENU)IDR_MENU1,
GetModuleHandle(NULL), NULL);


it is in
LRESULT CALLBACK WinProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)

not sure what else to do.

Share this post


Link to post
Share on other sites
Never mind I found the issue. It was a stupid mistake.

See here
LRESULT CALLBACK WinProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
{
static HWND edit_box;//had this
// Do stuff depending on the "message"
switch(message)
{
case WM_CREATE:
{
//here

when I moved it It started working. can any one explain why?

Share this post


Link to post
Share on other sites

This topic is 4813 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this