Results 1 to 10 of 10

Thread: Undo error - well it's not working!

  1. #1

    Thread Starter
    Frenzied Member aikidokid's Avatar
    Join Date
    Aug 2002
    Location
    Bristol, UK
    Posts
    1,968

    Undo error - well it's not working!

    I have the following code,but when the user clicks on the undo menu item - nothing happens.

    Is there anything obvious I should or shouldn't be doing?

    VB Code:
    1. Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, _
    2.                     ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
    3. Private Const WM_USER = &H400
    4. Private Const EM_UNDO = &HC7
    5.  
    6. Private Sub mnuUndo_Click()
    7. UndoTextBox rtb1
    8. End Sub
    9.  
    10. Private Sub UndoTextBox(Txtbx As RichTextBox)
    11.     Dim X As Long
    12.    
    13.     X = SendMessage(Txtbx.hwnd, EM_UNDO, 0, 0)
    14. End Sub

    I am fairly new to API's so is this correct?
    If somebody helps you, take time to RATE the post. I do.

    "FAILURE IS NOT AN OPTION. It comes bundled with the software."

    Below are some of the threads that have helped me along the way:

    CodeBank submission:
    Listview Backcolor (without subclassing)

    Loading Treeview Nodes From A Database, Creating Registry Keys, Count Number of Lines in TextBox , Excellent RichTextBox Tricks & Tips
    Ideas & Screen Shots For A Code Library App
    How to do Data validation in Excel, Conditional Formating in Excel

  2. #2
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758
    Your code is correct and works for me.

    Do you set any properties of the RTB control? I never changed anything.

    It may depend on which OS, RTB version etc...

  3. #3

    Thread Starter
    Frenzied Member aikidokid's Avatar
    Join Date
    Aug 2002
    Location
    Bristol, UK
    Posts
    1,968
    Do you set any properties of the RTB control?
    None that I can see, it's used in it's default setting.

    It may depend on which OS, RTB version etc...
    Win XPPro
    RTB Version - MS Rich Textbox Control 6.0 (sp1)
    RICHTX32.OCX
    If somebody helps you, take time to RATE the post. I do.

    "FAILURE IS NOT AN OPTION. It comes bundled with the software."

    Below are some of the threads that have helped me along the way:

    CodeBank submission:
    Listview Backcolor (without subclassing)

    Loading Treeview Nodes From A Database, Creating Registry Keys, Count Number of Lines in TextBox , Excellent RichTextBox Tricks & Tips
    Ideas & Screen Shots For A Code Library App
    How to do Data validation in Excel, Conditional Formating in Excel

  4. #4
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431
    Originally posted by aikidokid
    None that I can see, it's used in it's default setting.



    Win XPPro
    RTB Version - MS Rich Textbox Control 6.0 (sp1)
    RICHTX32.OCX
    I use the same OS and control that you do and it doesn't work for me either. I've tried previously without success to implement the undo and it hasn't worked. Neither have supposedly working projects that I've downloaded from the web. I don't know what version of the ocx Bruce uses but I suspect it stopped working with the switch to VB6.

  5. #5

    Thread Starter
    Frenzied Member aikidokid's Avatar
    Join Date
    Aug 2002
    Location
    Bristol, UK
    Posts
    1,968
    Thanks Martin,

    Have you found any workaround for this?

    How do yoiu impliment the undo function in your apps then?
    If somebody helps you, take time to RATE the post. I do.

    "FAILURE IS NOT AN OPTION. It comes bundled with the software."

    Below are some of the threads that have helped me along the way:

    CodeBank submission:
    Listview Backcolor (without subclassing)

    Loading Treeview Nodes From A Database, Creating Registry Keys, Count Number of Lines in TextBox , Excellent RichTextBox Tricks & Tips
    Ideas & Screen Shots For A Code Library App
    How to do Data validation in Excel, Conditional Formating in Excel

  6. #6

  7. #7

    Thread Starter
    Frenzied Member aikidokid's Avatar
    Join Date
    Aug 2002
    Location
    Bristol, UK
    Posts
    1,968
    OK thanks. I will take a look over there.
    If somebody helps you, take time to RATE the post. I do.

    "FAILURE IS NOT AN OPTION. It comes bundled with the software."

    Below are some of the threads that have helped me along the way:

    CodeBank submission:
    Listview Backcolor (without subclassing)

    Loading Treeview Nodes From A Database, Creating Registry Keys, Count Number of Lines in TextBox , Excellent RichTextBox Tricks & Tips
    Ideas & Screen Shots For A Code Library App
    How to do Data validation in Excel, Conditional Formating in Excel

  8. #8
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758
    I don't know what version of the ocx Bruce uses
    XP Pro
    Visual Studio 6
    RTB Version - MS Rich Textbox Control 6.0 (sp4)
    Richtx32.ocx - ver 6.088.4

    I also have Visual Studio 2003 installed.

  9. #9

  10. #10

    Thread Starter
    Frenzied Member aikidokid's Avatar
    Join Date
    Aug 2002
    Location
    Bristol, UK
    Posts
    1,968
    This is the version I have installed: 6.1.97.82
    If somebody helps you, take time to RATE the post. I do.

    "FAILURE IS NOT AN OPTION. It comes bundled with the software."

    Below are some of the threads that have helped me along the way:

    CodeBank submission:
    Listview Backcolor (without subclassing)

    Loading Treeview Nodes From A Database, Creating Registry Keys, Count Number of Lines in TextBox , Excellent RichTextBox Tricks & Tips
    Ideas & Screen Shots For A Code Library App
    How to do Data validation in Excel, Conditional Formating in Excel

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width