Results 1 to 9 of 9

Thread: problem to get Notepad's ImmGetContext

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2006
    Posts
    4

    problem to get Notepad's ImmGetContext

    VB Code:
    1. Private Declare Function ImmGetContext Lib "imm32.dll" (ByVal hwnd As Long) As Long
    2. Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal Classname As String, ByVal WindowName As String) As Long
    3.  
    4. Private Sub Command1_Click()
    5. dim hwnd as long,hIMC as long
    6. hwnd = FindWindow("Notepad", vbnullstring)
    7. if hwnd<>0 then
    8. hIMC=ImmGetContext(hwnd)
    9. msgbox hIMC
    10. end if
    11. end sub
    but hIMC always return 0,how can i get notepad 's ImmGetContext,anyone can help me?

  2. #2
    Super Moderator manavo11's Avatar
    Join Date
    Nov 2002
    Location
    Around the corner from si_the_geek
    Posts
    7,171

    Re: problem to get Notepad's ImmGetContext

    What is notepad's ImmGetContext? What is an ImmGetContext?


    Has someone helped you? Then you can Rate their helpful post.

  3. #3
    Member
    Join Date
    Oct 2006
    Posts
    53

    Re: problem to get Notepad's ImmGetContext

    I have never worked with IME so my knowledge is rather vague. First, is the IME program installed on your computer. If it is, I think it's the Notepad edit window that is provided with IME.

    As I said, my knowledge is vague.

  4. #4
    Super Moderator manavo11's Avatar
    Join Date
    Nov 2002
    Location
    Around the corner from si_the_geek
    Posts
    7,171

    Re: problem to get Notepad's ImmGetContext

    What is IME? What are you trying to do? Get the text in an open notepad window?


    Has someone helped you? Then you can Rate their helpful post.

  5. #5
    Member
    Join Date
    Oct 2006
    Posts
    53

    Re: problem to get Notepad's ImmGetContext


  6. #6

    Thread Starter
    New Member
    Join Date
    Sep 2006
    Posts
    4

    Re: problem to get Notepad's ImmGetContext

    ImmGetContext
    Returns the input context associated with the specified window.

    HIMC ImmGetContext(
    HWND hWnd
    );
    Parameters
    hWnd
    [in] Handle to the window for which to retrieve the input context.
    Return Values
    Returns the handle to the input context.

    Remarks
    An application should routinely use this function to retrieve the current input context before attempting to access information in the context.

    ------------------------------------------------------

    the problem is if hwnd isn't myself process,then this APIdoesn't work

    if i set hwnd = FindWindow("", "Form1") or hwnd=form1.hwnd or hwnd=text1.text
    it's both work
    if hwnd is external process's hwnd,then it's doesn't work
    anyone can help me?

  7. #7

    Thread Starter
    New Member
    Join Date
    Sep 2006
    Posts
    4

    Re: problem to get Notepad's ImmGetContext

    maybe can use c++ write a dll,this dll can get ImmGetContext,then use VB inject this dll to notepad,but i don't know how to write it in c++....

  8. #8
    Super Moderator manavo11's Avatar
    Join Date
    Nov 2002
    Location
    Around the corner from si_the_geek
    Posts
    7,171

    Re: problem to get Notepad's ImmGetContext

    So you want to get the text that is typed in a notepad instance, right? Try searching for the FindWindow, FindWindowEx and GetWindowText APIs.


    Has someone helped you? Then you can Rate their helpful post.

  9. #9

    Thread Starter
    New Member
    Join Date
    Sep 2006
    Posts
    4

    Unhappy Re: problem to get Notepad's ImmGetContext

    Quote Originally Posted by manavo11
    So you want to get the text that is typed in a notepad instance, right? Try searching for the FindWindow, FindWindowEx and GetWindowText APIs.
    no,i want get IME CandidateList's text,so your way doesn't work

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