代码之家  ›  专栏  ›  技术社区  ›  Alex

使用c++访问internet explorer

c++
  •  4
  • Alex  · 技术社区  · 17 年前

    正如主题所说,我想知道是否有一个工具或教程可以帮助我访问IE,进入某个URL,在该网站上做一些操作。所以我会有一个程序来帮我做,而不是每次都自己做。

    5 回复  |  直到 17 年前
        1
  •  1
  •   Ric Tokyo    17 年前

    Here 是一个用C++进行Internet Explorer自动化的项目

        2
  •  1
  •   Ric Tokyo    17 年前

    你真的应该重新表述你的问题。。你说你想做的是用程序登录到hotmail,检查pidgin代码,他们就这么做了。

    here , here 我认为你可以随意浏览代码和教程,直到你了解pidgin贡献者是如何做到的。

    here

    启动代码示例:

    00362 static void
    00363 msn_show_hotmail_inbox(PurplePluginAction *action)
    00364 {
    00365       PurpleConnection *gc;
    00366       MsnSession *session;
    00367 
    00368       gc = (PurpleConnection *) action->context;
    00369       session = gc->proto_data;
    00370 
    00371       if (session->passport_info.file == NULL)
    00372       {
    00373             purple_notify_error(gc, NULL,
    00374                                       _("This Hotmail account may not be active."), NULL);
    00375             return;
    00376       }
    00377 
    00378       purple_notify_uri(gc, session->passport_info.file);
    00379 }
    
    
    00652 void *
    00653 purple_notify_uri(void *handle, const char *uri)
    00654 {
    00655       PurpleNotifyUiOps *ops;
    00656 
    00657       g_return_val_if_fail(uri != NULL, NULL);
    00658 
    00659       ops = purple_notify_get_ui_ops();
    00660 
    00661       if (ops != NULL && ops->notify_uri != NULL) {
    00662 
    00663             void *ui_handle = ops->notify_uri(uri);
    00664 
    00665             if (ui_handle != NULL) {
    00666 
    00667                   PurpleNotifyInfo *info = g_new0(PurpleNotifyInfo, 1);
    00668                   info->type = PURPLE_NOTIFY_URI;
    00669                   info->handle = handle;
    00670                   info->ui_handle = ui_handle;
    00671 
    00672                   handles = g_list_append(handles, info);
    00673 
    00674                   return info->ui_handle;
    00675             }
    00676       }
    00677 
    00678       return NULL;
    00679 }
    
        3
  •  0
  •   Serafina Brocious    17 年前

    与其用IE来做这样的事情,不如找合适的 screen scraping 为您选择的语言提供库。你可以谷歌和搜索堆栈溢出找到许多这样的库。从这里开始,您将使用您的语言的web api向服务器发送数据。

        4
  •  0
  •   Michael    17 年前

    我用嵌入式浏览器来做这些事情。可以连接到正在运行的IE实例。请参阅 Connect to Running Instance of IE

     1. Get the Document Interface
         pWebBrowser->Document->QueryInterface(
              IID_IHTMLDocument2,(LPVOID*)&Doc);
     2. Get all the elements on the Document
         Doc->get_all(&Elements);
     3. enum the Elements
         Elements->get_length(&ulLen);
         for_each 
            Elements->item(item, index, &ppvElement);
     4. Detemine what element is desired. 
         * by classname
         * by ID etc.. here I used the classname
           ppvElement->get_className (&bstrElement);
     5. Insert Text for user / password
        ppvElement->put_innerText(wsUreser_or_Psswd)
     6. Find the Sign in button and click it.
        ppvElement->Click();
    
    

    你的结果可能不同。

    --

    迈克尔

        5
  •  0
  •   Codingday    17 年前

    dapper 两分钟后?显然有些人已经 done it