Deprecated: The behavior of unparenthesized expressions containing both '.' and '+'/'-' will change in PHP 8: '+'/'-' will take a higher precedence in /home/iano/public_html/tpforums-vb5/forum/includes/class_core.php on line 5842

PHP Warning: Use of undefined constant MYSQL_NUM - assumed 'MYSQL_NUM' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: Use of undefined constant MYSQL_ASSOC - assumed 'MYSQL_ASSOC' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: Use of undefined constant MYSQL_BOTH - assumed 'MYSQL_BOTH' (this will throw an Error in a future version of PHP) in ..../includes/init.php on line 165

PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in ..../includes/functions_navigation.php on line 588

PHP Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in ..../includes/functions_navigation.php on line 612

PHP Warning: Use of undefined constant misc - assumed 'misc' (this will throw an Error in a future version of PHP) in ..../global.php(29) : eval()'d code(6) : eval()'d code on line 1

PHP Warning: Use of undefined constant index - assumed 'index' (this will throw an Error in a future version of PHP) in ..../global.php(29) : eval()'d code(6) : eval()'d code on line 1

PHP Warning: Use of undefined constant misc - assumed 'misc' (this will throw an Error in a future version of PHP) in ..../includes/class_bootstrap.php(1422) : eval()'d code(4) : eval()'d code on line 1

PHP Warning: Use of undefined constant index - assumed 'index' (this will throw an Error in a future version of PHP) in ..../includes/class_bootstrap.php(1422) : eval()'d code(4) : eval()'d code on line 1

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 85

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 85

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6

PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in ..../includes/class_core.php(4684) : eval()'d code on line 6
SendMessage Question
Results 1 to 9 of 9

Thread: SendMessage Question

  1. #1

    SendMessage Question

    When I put him to turn left, yes everything correct.

    Code:
        Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
            SendMessage(TibiaProcess.MainWindowHandle, WM_KEYDOWN, Keys.ControlKey, 0&)
            SendMessage(TibiaProcess.MainWindowHandle, WM_KEYDOWN, Keys.Left, 0&)
            SendMessage(TibiaProcess.MainWindowHandle, WM_KEYUP, Keys.Left, 0&)
            SendMessage(TibiaProcess.MainWindowHandle, WM_KEYUP, Keys.ControlKey, 0&)
        End Sub
    And when i put him to mount (ctrl+r), he doesn't work?
    Code:
     
        Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
            SendMessage(TibiaProcess.MainWindowHandle, WM_KEYDOWN, Keys.ControlKey, 0&)
            SendMessage(TibiaProcess.MainWindowHandle, WM_KEYDOWN, Keys.R, 0&)
            SendMessage(TibiaProcess.MainWindowHandle, WM_KEYUP, Keys.R, 0&)
            SendMessage(TibiaProcess.MainWindowHandle, WM_KEYUP, Keys.ControlKey, 0&)
        End Sub
    Thx all.

  2. #2
    Senior Member
    Join Date
    Jan 2012
    Posts
    417
    you need simulate it according to WM_KEYUP or WM_KEYDOWN on msdn, this way you won't fail: http://msdn.microsoft.com/pt-br/libr...=vs.85%29.aspx

    it require knowledge about bitwise operations.

    If you don't understand what I'm talking about, see how (Farsa?) TibiaApi does to hit (Ctrl+L).
    http://code.google.com/p/tibiaapi/so...nHelper.cs#158

  3. #3
    There are modifier codes you need to send with the R key that tell it "Bro, CTRL be pressed."

  4. #4
    You might also need to send a WM_CHAR with the value for CTRL+R (something like 'R'-'A'+1)

  5. #5
    hey @Blequi i tested code of tibiaapi here:

    Code:
            SendMessage(TibiaProcess.MainWindowHandle, WM_KEYDOWN, Keys.ControlKey, 1 Or (&H26 << 16))
            SendMessage(TibiaProcess.MainWindowHandle, WM_KEYDOWN, CInt(Keys.R), 1 Or (&H26 << 16))
            SendMessage(TibiaProcess.MainWindowHandle, WM_CHAR, 12, 1 Or (&H26 << 16))
            SendMessage(TibiaProcess.MainWindowHandle, WM_KEYUP, CInt(Keys.R), 1 Or (&H26 << 16))
            SendMessage(TibiaProcess.MainWindowHandle, WM_KEYUP, Keys.ControlKey, 1 Or (&H26 << 16))
    What is the number of R? For L is 12, and for R?

  6. #6
    Quote Originally Posted by JulinhoPiuPiu View Post
    hey @Blequi i tested code of tibiaapi here:

    Code:
            SendMessage(TibiaProcess.MainWindowHandle, WM_KEYDOWN, Keys.ControlKey, 1 Or (&H26 << 16))
            SendMessage(TibiaProcess.MainWindowHandle, WM_KEYDOWN, CInt(Keys.R), 1 Or (&H26 << 16))
            SendMessage(TibiaProcess.MainWindowHandle, WM_CHAR, 12, 1 Or (&H26 << 16))
            SendMessage(TibiaProcess.MainWindowHandle, WM_KEYUP, CInt(Keys.R), 1 Or (&H26 << 16))
            SendMessage(TibiaProcess.MainWindowHandle, WM_KEYUP, Keys.ControlKey, 1 Or (&H26 << 16))
    What is the number of R? For L is 12, and for R?
    http://lmgtfy.com/?q=virtual+key+codes

    EDIT: It's even simpler then that, looking at what you mean. It's not a virtual key code. It's the alphabetical index. L is the 12th letter in the alphabet.

  7. #7
    Thank you, is 18, this code is for mount:
    Code:
      SendMessage(TibiaProcess.MainWindowHandle, WM_KEYDOWN, Keys.ControlKey, 1 Or (&H26 << 16))
            SendMessage(TibiaProcess.MainWindowHandle, WM_KEYDOWN, CInt(Keys.R), 1 Or (&H26 << 16))
            SendMessage(TibiaProcess.MainWindowHandle, WM_CHAR, 18, 1 Or (&H26 << 16))
            SendMessage(TibiaProcess.MainWindowHandle, WM_KEYUP, CInt(Keys.R), 1 Or (&H26 << 16))
            SendMessage(TibiaProcess.MainWindowHandle, WM_KEYUP, Keys.ControlKey, 1 Or (&H26 << 16))

  8. #8
    Senior Member
    Join Date
    Apr 2008
    Posts
    689
    next time, you can use spy++ to capture what is sent to the client and then send the exact same messages

  9. #9

Posting Permissions

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