网络继存的google map api 教程调用多数是基于web应用程序的,开发的桌面应用程序如果想要使用google map进行交互怎么做那?桌面应用程序不需要服务器还需要申请key? 刚做这方面,希望有人给与指点,这里现行谢过了 

解决方案 »

  1.   

    1. winform里内嵌一个webbrowser就可以常规方式使用google map;
    2. 自己画地图,后台可以调用google map的地址解析服务把地址转换成坐标;
    两种方式都需要申请key
      

  2.   

    网上找了个差不多的例子
    http://hi.baidu.com/fncm/blog/item/07e834f78a6d3726730eec6b.html
    方法应该是兄台说的第一个把,但是这个例子用得好象是google的key,还有既然是桌面应用程序这个key
    是必需的?
      

  3.   

    地图数据是google服务器上的,又不在你本地,你说要不要key?
      

  4.   

    看来是必须要key了,
    1. winform里内嵌一个webbrowser就可以常规方式使用google map;
    webbrowserd调用google map的方法能告诉的具体点吗(应该是调用js函数吧)?
      

  5.   

    你可以查官方文档啊,简单应用是很方便的
    http://code.google.com/intl/zh-CN/apis/maps/documentation/
      

  6.   

    那都是web应用程序,我要做的桌面应用程序(mfc/C#),我不知道winform里内嵌一个webbrowser怎么和那googlemap交互
      

  7.   

    可以做一个web的应用发布出来,然后在webbrowser带参数调用你的web应用,一般交互应该都可以实现
      

  8.   

    简单的作个webbrowser和js交互的例子GetIDsOfNames方法却总是出错,帮我看看好?  HINSTANCE hInst = ::LoadLibrary( _T("OLEACC.DLL") ); 
        char* queryAddress;
        IDispatch *spScript;
        DISPID dispid = NULL;
        HRESULT   hr;    queryAddress = "c:\\g.html";
        m_gmap.Navigate(queryAddress,NULL,NULL,NULL,NULL);
    CString str_fun_name = L"mod_list";    CComBSTR bstrMember(str_fun_name); 
    IHTMLDocument2 *spDoc  =(IHTMLDocument2*)m_gmap.GetDocument();

        hr =spDoc->get_Script(&spScript); 
       //这里出错了
        if ( FAILED(hr) ) 

    MessageBox("spScript error"); 

    spScript->lpVtbl
        hr = spScript->GetIDsOfNames(IID_NULL, &bstrMember,1,LOCALE_SYSTEM_DEFAULT, ispid);
    //这里出错了:ispid =-1
    if(FAILED(hr)) 

    CString str_error; 
    str_error.Format("GetIDsOfNames 的dispid=%d",dispid); 
    MessageBox(str_error); 
    return; 
    }
    ..... 
    以下是html的代码
    [code=HTML]
    <html> 
    <head> 
    <script> 
    function mod_list(class_name,str_text_orgi,str_text_current) 

      alert(class_name);
    alert(str_text_orgi);
    alert(str_text_current);
      if(class_name=="app")
    { document.write("app"+str_text_orgi+"replease"+str_text_current+" <br/>"); } 
    else if(class_name=="ip") 
    { document.write("ip"+str_text_orgi+"replease"+str_text_current+" <br/>"); 
    } } 
    </script> 
    </head> 
    <body> 
    aaaa
    </body> 
    </html> 
    [/HTML]
      

  9.   

    有个地方写错了,再来一次
      
    HINSTANCE hInst = ::LoadLibrary( _T("OLEACC.DLL") ); 
        char* queryAddress;
        IDispatch *spScript;
        DISPID dispid = NULL;
        HRESULT   hr;    queryAddress = "c:\\g.html";
        m_gmap.Navigate(queryAddress,NULL,NULL,NULL,NULL);
        CString str_fun_name = L"mod_list";    CComBSTR bstrMember(str_fun_name); 
        IHTMLDocument2 *spDoc  =(IHTMLDocument2*)m_gmap.GetDocument();
        
        hr =spDoc->get_Script(&spScript); 
       //这里正确    
        if ( FAILED(hr) ) 
        { 
        MessageBox("spScript error"); 
        } 
        spScript->lpVtbl
        hr = spScript->GetIDsOfNames(IID_NULL, &bstrMember,1,LOCALE_SYSTEM_DEFAULT, ispid);
    //这里出错了:ispid =-1
    if(FAILED(hr)) 
        { 
        CString str_error; 
        str_error.Format("GetIDsOfNames 的dispid=%d",dispid); 
        MessageBox(str_error); 
        return; 
        }
    .....
     
    以下是html的代码 
    <html> 
    <head> 
    <script> 
    function mod_list(class_name,str_text_orgi,str_text_current) 

      alert(class_name); 
    alert(str_text_orgi); 
    alert(str_text_current); 
      if(class_name=="app") 
    { document.write("app"+str_text_orgi+"replease"+str_text_current+" <br/>"); } 
    else if(class_name=="ip") 
    { document.write("ip"+str_text_orgi+"replease"+str_text_current+" <br/>"); 
    } } 
    </script> 
    </head> 
    <body> 
    aaaa 
    </body> 
    </html> 
    [/HTML] 
      

  10.   

       webBrowserMap.DocumentText = "<iframe width='1086' height='670' scrolling='no' frameborder='0' src='http://kel.o.cn/map.jsp?w=1086&h=670&x=546552&y=540880&z=5&m=1&b=1&popstr='></iframe>";