Results 1 to 9 of 9

Thread: Using Commands in a program

  1. #1

    Thread Starter
    Addicted Member Garrett19212's Avatar
    Join Date
    Jan 2005
    Location
    US
    Posts
    220

    Using Commands in a program

    How would i "sign in" in msn.
    Im trying to make a program that does stuff for msn. First all i want to know is how would you sign in threw this program i am making.
    Last edited by Garrett19212; Jan 6th, 2005 at 05:51 PM.

  2. #2

    Thread Starter
    Addicted Member Garrett19212's Avatar
    Join Date
    Jan 2005
    Location
    US
    Posts
    220

    Re: Using Commands in a program

    wow is it just me or are people ignoring my threads now?

  3. #3
    Addicted Member
    Join Date
    Nov 2004
    Posts
    171

    Re: Using Commands in a program

    I have no idea what the conventional method would be, but possibly try out some kind of sendkeys method? It is kind of a longshot, and not very reliable, so don't consider this advice unless you can't find anything else...
    Last edited by sherminatortim; Jan 10th, 2005 at 06:42 AM.
    Sherminator ~ I'll be back.

  4. #4

    Thread Starter
    Addicted Member Garrett19212's Avatar
    Join Date
    Jan 2005
    Location
    US
    Posts
    220

    Re: Using Commands in a program

    How would i use a sendkey?

  5. #5
    Addicted Member
    Join Date
    Nov 2004
    Posts
    171

    Re: Using Commands in a program

    I could give you a small tutorial on the subject, but the quality would not be half of what you could get on this forum. Search for "sendkey" or "send key" and it should bring up everything you need to know on the subject. Like I said, though, it is not the best option that you could use. In case you don't already know, Sendkey simply sends a certain sequence of keys to the active window. In this case, that should be the msn messenger. You would first send your username, then a tab, then your password, then enter. This would, theoretically log you in. The reason that this method is unreliable, though, is that if your program starts sending the keys before the messenger is fully loaded, the messenger will not recieve everything. Just a pre-warning...
    Sherminator ~ I'll be back.

  6. #6
    Frenzied Member ice_531's Avatar
    Join Date
    Aug 2002
    Location
    Sitting w/ Bob Status: -Next -To- Null- Friend: Philip
    Posts
    1,152

    Re: Using Commands in a program

    Well Garrett, i'd suggest you visit the API forums on VBF

    I'm sure we'd be glad to help you there

    Also have a looksy at my hwnd example project in the API FAQ thread...i used an example of grabbing msn chat text to get a windows handle by partial caption. Might show you a bit of how you interact with other applications.

    :::`DISCLAIMER`:::
    Do NOT take anything i have posted to be truthful in any way, shape or form.
    Thank You!

    --------------------------------
    "Never heard about "hiking" poles. I usualy just grab a stick from the nature, and use that as a pole." - NoteMe
    "Finaly I can look as gay as I want..." - NoteMe
    Languages: VB6, BASIC, Java, C#. C++

  7. #7
    Registered User HellRaider's Avatar
    Join Date
    Sep 2003
    Posts
    70

    Re: Using Commands in a program

    Hello
    I copied this out of vb5's booksonline, hope it helps with the sendkeys idea if you want to use it.

    Sends one or more keystrokes to the active window as if typed at the keyboard.
    Syntax
    SendKeys string[, wait]

    The SendKeys statement syntax has these named arguments:
    Part Description

    string Required. String expression specifying the keystrokes to send.
    Wait Optional. Boolean value specifying the wait mode. If False (default), control is returned to the procedure immediately after the keys are sent. If True, keystrokes must be processed before control is returned to the procedure.

    Remarks
    Each key is represented by one or more characters. To specify a single keyboard character, use the character itself. For example, to represent the letter A, use "A" for string. To represent more than one character, append each additional character to the one preceding it. To represent the letters A, B, and C, use "ABC" for string.
    The plus sign (+), caret (^), percent sign (%), tilde (~), and parentheses ( ) have special meanings to SendKeys. To specify one of these characters, enclose it within braces ({}). For example, to specify the plus sign, use {+}. Brackets ([ ]) have no special meaning to SendKeys, but you must enclose them in braces. In other applications, brackets do have a special meaning that may be significant when dynamic data exchange (DDE) occurs. To specify brace characters, use {{} and {}}.
    To specify characters that aren't displayed when you press a key, such as ENTER or TAB, and keys that represent actions rather than characters, use the codes shown below:
    Key Code

    BACKSPACE {BACKSPACE}, {BS}, or {BKSP}
    BREAK {BREAK}
    CAPS LOCK {CAPSLOCK}
    DEL or DELETE {DELETE} or {DEL}
    DOWN ARROW {DOWN}
    END {END}
    ENTER {ENTER}or ~
    ESC {ESC}
    HELP {HELP}
    HOME {HOME}
    INS or INSERT {INSERT} or {INS}
    LEFT ARROW {LEFT}
    NUM LOCK {NUMLOCK}
    PAGE DOWN {PGDN}
    PAGE UP {PGUP}
    PRINT SCREEN {PRTSC}
    RIGHT ARROW {RIGHT}
    SCROLL LOCK {SCROLLLOCK}
    TAB {TAB}
    UP ARROW {UP}
    F1 {F1}
    F2 {F2}
    F3 {F3}
    F4 {F4}
    F5 {F5}
    F6 {F6}
    F7 {F7}
    F8 {F8}
    F9 {F9}
    F10 {F10}
    F11 {F11}
    F12 {F12}
    F13 {F13}
    F14 {F14}
    F15 {F15}
    F16 {F16}

    To specify keys combined with any combination of the SHIFT, CTRL, and ALT keys, precede the key code with one or more of the following codes:
    Key Code

    SHIFT +
    CTRL ^
    ALT %

    To specify that any combination of SHIFT, CTRL, and ALT should be held down while several other keys are pressed, enclose the code for those keys in parentheses. For example, to specify to hold down SHIFT while E and C are pressed, use "+(EC)". To specify to hold down SHIFT while E is pressed, followed by C without SHIFT, use "+EC".
    To specify repeating keys, use the form {key number}. You must put a space between key and number. For example, {LEFT 42} means press the LEFT ARROW key 42 times; {h 10} means press H 10 times.
    Note You can't use SendKeys to send keystrokes to an application that is not designed to run in Microsoft Windows. Sendkeys also can't send the PRINT SCREEN key {PRTSC} to any application.

    EG.

    VB Code:
    1. Dim ReturnValue, I
    2. ReturnValue = Shell("Calc.exe", 1)  ' Run Calculator.
    3. AppActivate ReturnValue     ' Activate the Calculator.
    4. For I = 1 To 100    ' Set up counting loop.
    5.     SendKeys I & "{+}", True    ' Send keystrokes to Calculator
    6. Next I  ' to add each value of I.
    7. SendKeys "=", True  ' Get grand total.

  8. #8
    Frenzied Member ice_531's Avatar
    Join Date
    Aug 2002
    Location
    Sitting w/ Bob Status: -Next -To- Null- Friend: Philip
    Posts
    1,152

    Re: Using Commands in a program

    SendKeys just isn't as reliable as API calls would be in this situation, nor would they achieve all the work he wants to do
    :::`DISCLAIMER`:::
    Do NOT take anything i have posted to be truthful in any way, shape or form.
    Thank You!

    --------------------------------
    "Never heard about "hiking" poles. I usualy just grab a stick from the nature, and use that as a pole." - NoteMe
    "Finaly I can look as gay as I want..." - NoteMe
    Languages: VB6, BASIC, Java, C#. C++

  9. #9
    Addicted Member
    Join Date
    Nov 2004
    Posts
    171

    Re: Using Commands in a program

    Quote Originally Posted by sherminatortim
    I have no idea what the conventional method would be, but possibly try out some kind of sendkeys method? It is kind of a longshot, and not very reliable, so don't consider this advice unless you can't find anything else...
    Like I said before, the sendkeys is not very reliable. The best way for this would definately be to follow up on Ice 531's advice. I have not worked with API calls much, but they would far better serve your purpose here.
    Sherminator ~ I'll be back.

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