Results 1 to 11 of 11

Thread: Wanted - Spellchecker [Resolved]

  1. #1

    Thread Starter
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Wanted - Spellchecker [Resolved]

    As some of you are aware, this site used to have a built-in spellchecker, but it was turned off (I think) because it used up too much resources. Anyhow, is there anyone out there who is talented enough to write one that individual users like me could use when creating or editing a post? Here are what I see as the requirements:
    • It should be installable on my (or any user's) PC
    • It should be activated by clicking Ctrl-S while creating a new post or editing an old one. I want to use Ctrl-S rather than a right-click activation because I already use the VB-WORLD Forum Tag Editing Tools 1.0 which is activated via the right-click.
    • It should use Word in the background for spellchecking and the interaction between it and my post should be similar to the way the Word spellchecker interacts with a document. In other words, misspelled words in the post should be highlighted and replaced automatically at my option.
    • It should have its own custom dictionary, separate from CUSTOM.DIC, so that I can add words to it which are OK in a post and not have that affect my spellchecking of a Word doc.

  2. #2
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    There are lots of code samples of using word for checking spelling if one searches.
    So it shouldn't be too difficult.

    I also have dictionary lists.
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  3. #3

    Thread Starter
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431
    Originally posted by plenderj
    There are lots of code samples of using word for checking spelling if one searches.
    So it shouldn't be too difficult.
    I already use them (or similar) in my apps, but I know nothing about web apps, so it would be very difficult for me.

  4. #4
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    Well really you just need to use a keyboard hook to hook CTRL+S and then use sendkeys or something similar.
    I'll look into it ...
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  5. #5

    Thread Starter
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431
    Originally posted by plenderj
    Well really you just need to use a keyboard hook to hook CTRL+S and then use sendkeys or something similar.
    I'll look into it ...
    Did you find out anything?

  6. #6
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    CTRL S would be bad, since that's the Universal Save shortcut.

    It'd be cool if it would only be enabled if the VB Q and A window had focus, that way no matter what the shortcut key, it wouldn't interfere with any other programs.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  7. #7

  8. #8
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    I don't know how possible it'd be to actually do it. I gave it a try with this code:

    VB Code:
    1. Public Const WH_KEYBOARD = 2
    2. Public Const VK_SHIFT = &H10
    3.  
    4. Declare Function CallNextHookEx Lib "user32" (ByVal hHook As Long, _
    5.   ByVal ncode As Long, ByVal wParam As Long, lParam As Any) As Long
    6.  
    7. Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer
    8.  
    9. Declare Function SetWindowsHookEx Lib "user32" Alias "SetWindowsHookExA" _
    10.   (ByVal idHook As Long, ByVal lpfn As Long, ByVal hmod As Long, _
    11.   ByVal dwThreadId As Long) As Long
    12.  
    13. Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hHook As Long) As Long
    14.  
    15. Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" _
    16.   (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
    17. Private Declare Function GetForegroundWindow Lib "user32" () As Long
    18.  
    19. Public hHook As Long
    20.  
    21. Public Function KeyboardProc(ByVal idHook As Long, ByVal wParam As Long, _
    22.   ByVal lParam As Long) As Long
    23. Dim lHwnd As Long, strCaption As String
    24.    
    25.   If idHook < 0 Then
    26.     KeyboardProc = CallNextHookEx(hHook, idHook, wParam, ByVal lParam)
    27.   Else
    28.     If (GetKeyState(VK_SHIFT) And &HF0000000) And wParam = Asc("S") Then
    29.            
    30.       strCaption = String(100, Chr$(0))
    31.       lHwnd = GetForegroundWindow
    32.       GetWindowText lHwnd, strCaption, 100
    33.            
    34.       If InStr(1, strCaption, "VB Q and A") Then
    35.         MsgBox "Got ya!"
    36.       End If
    37.     End If
    38.    
    39.     KeyboardProc = CallNextHookEx(hHook, idHook, wParam, ByVal lParam)
    40.   End If
    41. End Function

    But IE seems to distrupt the hook.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  9. #9

  10. #10
    Lively Member
    Join Date
    Apr 2003
    Location
    Georgetown, Texas
    Posts
    114
    Just a suggestion, though you might think it takes too many keystrokes.

    1. Highlight your message and hit Ctrl+c (Edit, Copy)
    2. Hit the Word shortcut that you have put into a left, hiding folder
    3. Hit Ctrl+v (Edit, Paste) to paste your message into Word
    4. Hit the F7 key (Tools, Spelling and Grammer), and do your spell-checking.
    5. When finished, hit Ctrl+a (highlight all) and then Ctrl+c
    6. Go back to your forum (or wherever your were) and hit Ctrl+v.
    Done!

    Now, one of you good VB prorammers might just put the above together in a one- or two-keystroke code. Then we can all benefit!

  11. #11

    Thread Starter
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431
    I forgot I had asked this question. In the meantime I wrote one which can be used with the VB forum tool (see the Here is a valuable forum tool link in my signature) and/or appended to the context menu of the posting screen. I've attached the htm file.
    Attached Files Attached Files

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