Home > Back-end >  CB openkmlfile problems using Google earth API
CB openkmlfile problems using Google earth API

Time:10-09

In CBuilder cut openkmlfile using Google earth API doesn't work, but several other function called work, who met this kind of situation? How to solve?
The code is as follows:
TApplicationGE * ApplicationGE1;
.
: : CoInitialize (NULL);
ApplicationGE1 - & gt; IsInitialized ();
M_hMain=(HWND) ApplicationGE1 - & gt; GetMainHwnd ();
M_hView=(HWND) ApplicationGE1 - & gt; GetRenderHwnd ();
ShowWindow ((HWND) m_hMain, SW_HIDE);
: : SetParent ((HWND) m_hView Form1 - & gt; Panel1 - & gt; Handle);
: : SetWindowPos ((HWND) m_hView HWND_TOPMOST, 100400200100, SWP_SHOWWINDOW);
: : MoveWindow (m_hView, 0, 0, Form1 - & gt; Panel1 - & gt; Width, Form1 - & gt; Panel1 - & gt; Height, true);
.
ApplicationGE1 - & gt; SetCameraParams,1,4000,0,0,20 (108.65, 34.5, 500);//normal
ApplicationGE1 - & gt; OpenKmlFile ((*) would be "c: \ \ a.k ml", 1);//no reaction
Who can give the solution, we should be grateful!

CodePudding user response:

Are never used Google Earth API, but from the COM this consideration, this line of code:
ApplicationGE1 - & gt; OpenKmlFile ((*) would be "c: \ \ a.k ml", 1);
To:
ApplicationGE1 - & gt; OpenKmlFile (WideString (" c: \ \ a.k ml), 1);
You give it a try,

CodePudding user response:

Char szPath [MAX_PATH];
Memset (szPath, 0, MAX_PATH);
GetCurrentDirectory (MAX_PATH, szPath);
Strcat (szPath, \ \ "my site. KMZ");
Cstrings path (szPath);
G_IApplicationGE. OpenKmlFile (path, TRUE);

(g_IApplicationGE is: g_IApplicationGE CreateDispatch (CLSID_ApplicationGE);//bind g_IApplicationGE and GE program)
  • Related