Results 1 to 4 of 4

Thread: SendKeys Problem VB6

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2011
    Location
    varies from time to time
    Posts
    9

    Question SendKeys Problem VB6

    What is wrong with SendKeys?

    Most of the times, it executes the code as desired... but 30% times, it does not execute the code properly... I tried increasing priority of my program upto 'Realtime'... It increases it's efficiency a little bit... But, how can I make it work perfectly? It is a computer and it ought to do things as we desire... the code I'm using is...

    .........................................
    Clipboard.Clear
    Clipboard.SetText Acc32
    SendKeys "(^v)"
    DoEvents
    SendKeys "({TAB})", True
    DoEvents
    Clipboard.Clear
    Clipboard.SetText Pas32
    SendKeys "(^v)"
    DoEvents
    SendKeys "({ENTER})", True
    DoEvents
    .........................................

    Suppose Acc32 is "[email protected]" and Pas32 is "TempPass", then the output varies as:

    [email protected]Pass [Enter] ---- Missed the tab key
    [email protected] [Tab] v [Enter] ---- Missed the control key
    [email protected] [Tab] TempPass ---- Missed the Enter key
    xyzTempPass [Enter] ---- Super-Weird
    [email protected] [Tab] TempPass [Enter] ---- Desired


    What should I do? Any help will be appreciated... Thank You

  2. #2
    Lively Member Lidya212's Avatar
    Join Date
    Jul 2011
    Location
    Manado City
    Posts
    73

    Re: SendKeys Problem VB6

    Hi i'm using Text1 and Text2 to hold the clipboard text and it works all the time for me, here's my code
    Code:
    Dim Acc32, Pas32
    Acc32 = "[email protected]"
    Pas32 = "TempPass"
    
    Clipboard.Clear
    Clipboard.SetText Acc32
    Text1.SetFocus
    SendKeys "^(v)", True
    SendKeys "({TAB})", True
    Clipboard.Clear
    Clipboard.SetText Pas32
    SendKeys "^(v)", True
    SendKeys "({ENTER})", True
    in my opinion, your code not works 100% coz Text1.SetFocus, the control to hold your clipboard data is not in Focused state. Try to comment my Text1.Setfocus, and you'll have the same result with your result.

  3. #3

    Thread Starter
    New Member
    Join Date
    Jul 2011
    Location
    varies from time to time
    Posts
    9

    Re: SendKeys Problem VB6

    Hello Lidya, thanks for your kind reply but I never said that I have a textbox in my program... I am sending the keys to Internet Explorer and yes, it has focus else the output never even had those xyz things...

    The problem is with SendKeys function and I need an alternative or improvement to Sendkeys...

    Thanks anyways

  4. #4
    Lively Member Lidya212's Avatar
    Join Date
    Jul 2011
    Location
    Manado City
    Posts
    73

    Re: SendKeys Problem VB6

    Quote Originally Posted by ATH3IST View Post
    Hello Lidya, thanks for your kind reply but I never said that I have a textbox in my program... I am sending the keys to Internet Explorer and yes, it has focus else the output never even had those xyz things...

    The problem is with SendKeys function and I need an alternative or improvement to Sendkeys...

    Thanks anyways
    oh i see, now the problems is not only with the SendKeys function but also my eyes, i just giving you an example...
    btw, take a look at this and this threads working by pro...

    and this is coding by newbie but it's work for me
    Code:
    'Just input the title of your IE browser in text1
    AppActivate Text1.Text
    
    Dim Acc32, Pas32
    Acc32 = "MyLogin"
    Pas32 = "MyPass"
    
    Clipboard.Clear
    Clipboard.SetText Acc32
    SendKeys "^(v)", True
    SendKeys "({TAB})", True
    Clipboard.Clear
    Clipboard.SetText Pas32
    SendKeys "^(v)", True
    SendKeys "({ENTER})", True
    hope this help

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