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


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

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

  1. #1
    Join Date
    May 2004
    Posts
    70

    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
    Join Date
    May 2004
    Posts
    70
    i managed to work around this using SetTimer(999, 0, NULL):

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center