call webbrowser.Navigate within a thread via post message to UI thread

This is a discussion on call webbrowser.Navigate within a thread via post message to UI thread within the Windows Programming forums, part of the Platform Specific Boards category; call webbrowser.Navigate within a thread via post message to UI thread i wan to navigate to a website using my ...

  1. #1
    Registered User
    Join Date
    Mar 2004
    Posts
    114

    call webbrowser.Navigate within a thread via post message to UI thread

    call webbrowser.Navigate within a thread via post message to UI thread

    i wan to navigate to a website using my webbrowser2 activeX i made. but i need to run threads to execute a webbrowser.Navigate. because webbrowser.Navigate can only be called by the main user interface thread, inorder to use it from within a browser, i would be using the postmessage command to the main thread with a custom message

    heres my custom message

    Code:
    // my custom messages
    #define WM_GOWEBSITE (WM_APP + 1)
    here is the handler for WM_GOWEBSITE
    Code:
    void Dlg::On_WebsiteVisit() 
    {
    	m_webbrowser.Navigate("yahoo.com", NULL, NULL, NULL, NULL);
    	return;
    
    }
    from within my thread, this is how i posted WM_GOWEBSITE
    Code:
    	
    	th_thread->PostMessage( WM_GOWEBSITE , 0,0);
    after running debug , i am very sure the message got posted. But the problem now in the release version is that the page simply does not load.hovering my mouse over the activeX control i get the "half cursor,half hour glass" mouse cursor. the debug version is fine.

    does anyone know what is going on?
    can anyone please help me? thanks in advance!

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,530
    Moved.
    Please keep your windows specific questions on the windows board.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered User
    Join Date
    Mar 2004
    Posts
    114
    i managed to work around this using SetTimer(999, 0, NULL):

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help (Trying to post message)
    By mrkm in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 10-06-2003, 04:05 PM
  2. Replies: 12
    Last Post: 05-17-2003, 05:58 AM
  3. How to make a thread sleep or std::recv timeout?
    By BrianK in forum Linux Programming
    Replies: 3
    Last Post: 02-26-2003, 09:27 PM
  4. How to bind a thread to same message queue as original?
    By genghis in forum Windows Programming
    Replies: 3
    Last Post: 06-01-2002, 02:10 PM
  5. New Thread with same Message Queue?
    By genghis in forum Windows Programming
    Replies: 2
    Last Post: 01-31-2002, 05:17 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21