Consulting

Results 1 to 6 of 6

Thread: VBA winHTTP in async mode

  1. #1
    VBAX Newbie
    Joined
    Sep 2012
    Posts
    3
    Location

    VBA winHTTP in async mode

    Hi everybody,

    I tried to search the forum for a similar question, however, I was not able to find any async related questions.

    So I am trying to use winhttp to do async http request, I have declared the object with WithEvents and defined a couple of events howerver they are not triggered :/.

    I have checked with a packet sniffer that my server was sending the data as expected.

    I have joined the file to this post if someone can take a quick look .

    The calling code is the function Test in the module Module1 (I will refactor everything when I code this working ^^). The main logic for the event handling is in the class module AsyncMessageDispatcher.

    thanks !
    Attached Files Attached Files

  2. #2
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    Welcome to the forum!

    I don't know what you need. Can you say what the goal is? I hope that you added a dummy login and password to test. I don't know what testing should show.

    Have a look at this thread. You probably need to wait for a response. http://www.vbaexpress.com/forum/showthread.php?t=43237

  3. #3
    VBAX Newbie
    Joined
    Sep 2012
    Posts
    3
    Location
    Hi thanks for the reply !

    I am trying to write an instant messenger for Excel, not really useful but a fun project ! Excel will transfer messages to a nodejs backend using json.

    The login is just my username and of course the pasword is fake (I use something a bit more complicated).

    From the link you've posted, winHttp is used in synchronous mode (third parameter is false) if you set it to true it becomes asynchronous and event are supposed to be triggered to notify of certain events, such as reception of a response.

    Best regards

  4. #4
    Have a look at http://www.tushar-mehta.com/publish_...#_Toc173749363. It uses XMLhttp asynchronously.

  5. #5
    VBAX Newbie
    Joined
    Sep 2012
    Posts
    3
    Location
    Hi Crocus,

    thanks for the reply I did get xmlHTTP working previously in async mode, however, I was expecting winHttp to be more lightweight(as it doesn't require any of the XML parsing libs) but if it is the only way to go at the moment I think I will use that.

    Thanks !

  6. #6
    I found this code - http://stagesolutions.wordpress.com/...http-with-vba/ - which uses WinHttpRequest asynchronously, with event raising.

Posting Permissions

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