我的Google地球遇到问题 [英] Having problems with my Google Earth

查看:85
本文介绍了我的Google地球遇到问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
我需要这方面的帮助.
当前,我有一个Google Earth WPF应用程序,但是有这个问题.
它不会显示任何错误,但不会加载"Google地球".
为什么会这样?
有人可以帮帮我吗?
谢谢.

我有以下编码:

xx.cs

使用系统;
使用System.Linq;
使用System.Xml.Linq;
使用System.Windows;
使用System.Windows.Input;
使用System.Collections.Generic;
使用System.Text;
使用System.Windows.Data;
使用System.Windows.Documents;
使用System.Windows.Media;
使用System.Windows.Media.Imaging;
使用System.Windows.Navigation;
使用System.Windows.Shapes;
使用System.Windows.Controls;
使用System.Runtime.InteropServices;
使用System.Runtime.ExceptionServices;
使用System.Data;
使用EARTHLib;

命名空间xx
{
///< summary>
///xx.xaml的交互逻辑
///
公共局部类xx:页面
{
[DllImport("user32.dll")]
静态外部int SetParent(int hWndChild,int hWndParent);
IApplicationGE iGeApp;

[DllImport("user32.dll",EntryPoint ="GetDC")]
公共静态外部IntPtr GetDC(IntPtr ptr);

[DllImport("user32.dll",EntryPoint ="GetWindowDC")]
公共静态外部IntPtr GetWindowDC(Int32 ptr);

[DllImport("user32.dll",EntryPoint ="IsChild")]
公共静态外部布尔IsChild(int hWndParent,int hwnd);

[DllImport("user32.dll",EntryPoint ="ReleaseDC")]
公共静态外部IntPtr ReleaseDC(IntPtr hWnd,IntPtr hDc);

[DllImport("user32.dll",CharSet = CharSet.Auto)]
公共外部静态布尔SetWindowPos(int hWnd,IntPtr hWndInsertAfter,int X,int Y,int cx,int cy,uint uFlags);

[DllImport("user32.dll",CharSet = CharSet.Auto)]
公共静态外部IntPtr PostMessage(int hWnd,int msg,int wParam,int lParam);

//PInvoke声明
[DllImport("user32.dll",EntryPoint ="CreateWindowEx",CharSet = CharSet.Auto)]
内部静态外部IntPtr CreateWindowEx(int dwExStyle,
字符串lpszClassName,
字符串lpszWindowName,
诠释风格,
int x,int y,
int宽度,int高度,
IntPtr hwndParent,
IntPtr hMenu,
IntPtr hInst,
[MarshalAs(UnmanagedType.AsAny)]对象pvParam);

readonly IntPtr HWND_BOTTOM =新的IntPtr(1);
readonly IntPtr HWND_NOTOPMOST =新的IntPtr(-2);
readonly IntPtr HWND_TOP =新的IntPtr(0);
readonly IntPtr HWND_TOPMOST =新的IntPtr(-1);
静态只读UInt32 SWP_NOSIZE = 1;
静态只读UInt32 SWP_NOMOVE = 2;
静态只读UInt32 SWP_NOZORDER = 4;
静态只读UInt32 SWP_NOREDRAW = 8;
静态只读UInt32 SWP_NOACTIVATE = 16;
静态只读UInt32 SWP_FRAMECHANGED = 32;
静态只读UInt32 SWP_SHOWWINDOW = 64;
静态只读UInt32 SWP_HIDEWINDOW = 128;
静态只读UInt32 SWP_NOCOPYBITS = 256;
静态只读UInt32 SWP_NOOWNERZORDER = 512;
静态只读UInt32 SWP_NOSENDCHANGING = 1024;
静态只读Int32 WM_CLOSE = 0xF060;
静态只读Int32 WM_QUIT = 0x0012;

私有IntPtr GEHrender =(IntPtr)0;
私有IntPtr GEParentHrender =(IntPtr)0;

内部const int
WS_CHILD = 0x40000000,
WS_VISIBLE = 0x10000000,
LBS_NOTIFY = 0x00000001,
HOST_ID = 0x00000002,
LISTBOX_ID = 0x00000001,
WS_VSCROLL = 0x00200000,
WS_BORDER = 0x00800000;

受保护的HandleRef BuildWindowCore(HandleRef hwndParent)
{
//启动google Earth
InitializeComponent();

EARTHLib.ApplicationGE ge = null;
ge = new ApplicationGEClass();

ge.LoadKmlData("/Resources/Etc/GoogleEarth.kml");

int googleearth = ge.GetRenderHwnd();

IntPtr hwndControl = IntPtr.Zero;
IntPtr hwndHost = IntPtr.Zero;
int hostHeight = 200;
int hostWidth = 300;

hwndHost = CreateWindowEx(0,"static",",
WS_CHILD | WS_VISIBLE,
0,0,
hostHeight,hostWidth,
hwndParent.Handle,
(IntPtr)HOST_ID,
IntPtr.Zero,
0);

int oldPar = SetParent(googleearth,(int)hwndHost);
//检查我是否现在是孩子
如果(IsChild(hwndHost.ToInt32(),googleearth)){
System.Console.WriteLine(现在是孩子");
}

返回新的HandleRef(this,hwndHost);
}

受保护的void DestroyWindowCore(HandleRef hwnd)
{
抛出新的NotImplementedException();
}

}
}

xaml编码:
xx.xaml

Hi all,
I need help in this.
Currently I have a Google Earth WPF application, but i have this problem.
It does not show any errors, but the Google Earth doesn''t load.
Why is this happening?
Can someone please help me?
Thanks.

I have the following codings:

xx.cs

using System;
using System.Linq;
using System.Xml.Linq;
using System.Windows;
using System.Windows.Input;
using System.Collections.Generic;
using System.Text;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Controls;
using System.Runtime.InteropServices;
using System.Runtime.ExceptionServices;
using System.Data;
using EARTHLib;

namespace xx
{
/// <summary>
/// Interaction logic for xx.xaml
///
public partial class xx : Page
{
[DllImport("user32.dll")]
static extern int SetParent(int hWndChild, int hWndParent);
IApplicationGE iGeApp;

[DllImport("user32.dll", EntryPoint = "GetDC")]
public static extern IntPtr GetDC(IntPtr ptr);

[DllImport("user32.dll", EntryPoint = "GetWindowDC")]
public static extern IntPtr GetWindowDC(Int32 ptr);

[DllImport("user32.dll", EntryPoint = "IsChild")]
public static extern bool IsChild(int hWndParent, int hwnd);

[DllImport("user32.dll", EntryPoint = "ReleaseDC")]
public static extern IntPtr ReleaseDC(IntPtr hWnd, IntPtr hDc);

[DllImport("user32.dll", CharSet = CharSet.Auto)]
public extern static bool SetWindowPos(int hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags);

[DllImport("user32.dll", CharSet = CharSet.Auto)]
public static extern IntPtr PostMessage(int hWnd, int msg, int wParam, int lParam);

//PInvoke declarations
[DllImport("user32.dll", EntryPoint = "CreateWindowEx", CharSet = CharSet.Auto)]
internal static extern IntPtr CreateWindowEx(int dwExStyle,
string lpszClassName,
string lpszWindowName,
int style,
int x, int y,
int width, int height,
IntPtr hwndParent,
IntPtr hMenu,
IntPtr hInst,
[MarshalAs(UnmanagedType.AsAny)] object pvParam);

readonly IntPtr HWND_BOTTOM = new IntPtr(1);
readonly IntPtr HWND_NOTOPMOST = new IntPtr(-2);
readonly IntPtr HWND_TOP = new IntPtr(0);
readonly IntPtr HWND_TOPMOST = new IntPtr(-1);
static readonly UInt32 SWP_NOSIZE = 1;
static readonly UInt32 SWP_NOMOVE = 2;
static readonly UInt32 SWP_NOZORDER = 4;
static readonly UInt32 SWP_NOREDRAW = 8;
static readonly UInt32 SWP_NOACTIVATE = 16;
static readonly UInt32 SWP_FRAMECHANGED = 32;
static readonly UInt32 SWP_SHOWWINDOW = 64;
static readonly UInt32 SWP_HIDEWINDOW = 128;
static readonly UInt32 SWP_NOCOPYBITS = 256;
static readonly UInt32 SWP_NOOWNERZORDER = 512;
static readonly UInt32 SWP_NOSENDCHANGING = 1024;
static readonly Int32 WM_CLOSE = 0xF060;
static readonly Int32 WM_QUIT = 0x0012;

private IntPtr GEHrender = (IntPtr)0;
private IntPtr GEParentHrender = (IntPtr)0;

internal const int
WS_CHILD = 0x40000000,
WS_VISIBLE = 0x10000000,
LBS_NOTIFY = 0x00000001,
HOST_ID = 0x00000002,
LISTBOX_ID = 0x00000001,
WS_VSCROLL = 0x00200000,
WS_BORDER = 0x00800000;

protected HandleRef BuildWindowCore(HandleRef hwndParent)
{
// start google earth
InitializeComponent();

EARTHLib.ApplicationGE ge = null;
ge = new ApplicationGEClass();

ge.LoadKmlData("/Resources/Etc/GoogleEarth.kml");

int googleearth = ge.GetRenderHwnd();

IntPtr hwndControl = IntPtr.Zero;
IntPtr hwndHost = IntPtr.Zero;
int hostHeight = 200;
int hostWidth = 300;

hwndHost = CreateWindowEx(0, "static", "",
WS_CHILD | WS_VISIBLE,
0, 0,
hostHeight, hostWidth,
hwndParent.Handle,
(IntPtr)HOST_ID,
IntPtr.Zero,
0);

int oldPar = SetParent(googleearth, (int) hwndHost);
// check to see if I''m now a child
if (IsChild(hwndHost.ToInt32(), googleearth)) {
System.Console.WriteLine("now a child");
}

return new HandleRef(this, hwndHost);
}

protected void DestroyWindowCore(HandleRef hwnd)
{
throw new NotImplementedException();
}

}
}

xaml coding:
xx.xaml

<Page x:Class="Visualization_Dashboard.Location_visualization"

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

  xmlns:wf="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"

  xmlns:ax="clr-namespace:AxShockwaveFlashObjects;assembly=AxInterop.ShockwaveFlashObjects"

  Title="Hosting Google Earth API in a WPF .NET Application"

  Height="1024" Width="1280" ShowsNavigationUI="False">

</Page>

推荐答案

由于太阳耀斑.

严重的是,如果不提供代码/xaml之类的详细信息以及您可能会注意到的不加载"以外的其他症状,您将无法获得太多帮助.
because of a solar flare.

Seriously you can''t expect much help without giving some details like code/xaml and what other symptomps you may have noticed ohter than "it doesn''t load"


这篇关于我的Google地球遇到问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆