Click here to Skip to main content
15,868,016 members
Home / Discussions / C#
   

C#

 
Questionhow can i show google earth in winform c# Pin
Member 1252559627-May-16 2:37
Member 1252559627-May-16 2:37 
AnswerRe: how can i show google earth in winform c# Pin
Eddy Vluggen27-May-16 2:56
professionalEddy Vluggen27-May-16 2:56 
GeneralRe: it is show SetParent but i wanna to show placemark,polygon,etc.. how can i create it?Guide me Sir :(( Pin
Member 1252559627-May-16 3:52
Member 1252559627-May-16 3:52 
GeneralRe: how can i show google earth in winform c# Pin
Eddy Vluggen27-May-16 4:31
professionalEddy Vluggen27-May-16 4:31 
GeneralRe: thank sir! Pin
Member 1252559627-May-16 4:48
Member 1252559627-May-16 4:48 
GeneralRe: thank sir! Pin
Eddy Vluggen27-May-16 6:27
professionalEddy Vluggen27-May-16 6:27 
AnswerRe: how can i show google earth in winform c# Pin
Richard MacCutchan27-May-16 2:58
mveRichard MacCutchan27-May-16 2:58 
GeneralRe: anyway thank sir!i get setparent but need placemark,polygon,etc.. i m just beginner. :-O Pin
Member 1252559627-May-16 3:55
Member 1252559627-May-16 3:55 
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;
using System.Diagnostics;
using System.Runtime.InteropServices;
using EARTHLib;
using UnityEngine;
using System.Resources;






namespace simulation
{
public partial class Frmexe : Form
{
[DllImport("user32.dll")]
private static extern int SetParent(
int hWndChild,
int hWndParent);

[DllImport("user32.dll")]
private static extern bool ShowWindowAsync(
int hWnd,
int nCmdShow);

[DllImport("user32.dll", SetLastError = true)]
private static extern bool PostMessage(
int hWnd,
uint Msg,
int wParam,
int lParam);

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


[DllImport("user32.dll")]
private static extern int SendMessage(
int hWnd,
uint Msg,
int wParam,
int lParam);

private const int HWND_TOP = 0x0;
private const int WM_COMMAND = 0x0112;
private const int WM_QT_PAINT = 0xC2DC;
private const int WM_PAINT = 0x000F;
private const int WM_SIZE = 0x0005;
private const int SWP_FRAMECHANGED = 0x0020;
private EARTHLib.ApplicationGE ge = null;

public Frmexe()
{
InitializeComponent();
ge = new ApplicationGE();
SendMessage(ge.GetMainHwnd(), WM_COMMAND, WM_PAINT, 0);
PostMessage(ge.GetMainHwnd(), WM_QT_PAINT, 0, 0);

SetWindowPos(ge.GetRenderHwnd(), HWND_TOP, 0, 0, (int)this.Width,
(int)this.Height-50, SWP_FRAMECHANGED);

SendMessage(ge.GetMainHwnd(), WM_COMMAND, WM_SIZE, 0);

ShowWindowAsync(ge.GetMainHwnd(), 0);
SetParent(ge.GetRenderHwnd(), this.Handle.ToInt32());
ResizeGoogleControl();

}




private void Frmexe_Resize(object sender, EventArgs e)
{
ResizeGoogleControl();
}
private void ResizeGoogleControl()
{
try
{

SendMessage(ge.GetMainHwnd(), WM_COMMAND, WM_PAINT, 0);
PostMessage(ge.GetMainHwnd(), WM_QT_PAINT, 0, 0);

SetWindowPos(ge.GetRenderHwnd(), HWND_TOP, 0, 0, (int)this.Width,
(int)this.Height-50, SWP_FRAMECHANGED);

SendMessage(ge.GetMainHwnd(), WM_COMMAND, WM_SIZE, 0);



}
catch { }

}

private void Frmexe_FormClosing(object sender, FormClosingEventArgs e)
{
System.Diagnostics.Process[] ge = System.Diagnostics.Process.GetProcessesByName("googleearth");
ge[0].Kill();
}

modified 27-May-16 10:30am.

GeneralRe: how can i show google earth in winform c# Pin
Pete O'Hanlon27-May-16 4:17
subeditorPete O'Hanlon27-May-16 4:17 
QuestionWhat Does Complexity of Algorithm Mean??? Pin
Django_Untaken26-May-16 0:14
Django_Untaken26-May-16 0:14 
AnswerRe: What Does Complexity of Algorithm Mean??? Pin
Richard MacCutchan26-May-16 0:18
mveRichard MacCutchan26-May-16 0:18 
AnswerINCORRECT FORUM Pin
Pete O'Hanlon26-May-16 0:20
subeditorPete O'Hanlon26-May-16 0:20 
GeneralRe: What Does Complexity of Algorithm Mean??? Pin
harold aptroot26-May-16 0:52
harold aptroot26-May-16 0:52 
QuestionHow to read process Output Message from process within the process ?? Pin
ArunRagam25-May-16 23:45
professionalArunRagam25-May-16 23:45 
QuestionAdvice needed Pin
osxman25-May-16 10:14
osxman25-May-16 10:14 
AnswerMessage Closed Pin
25-May-16 10:55
rickrose050625-May-16 10:55 
GeneralRe: Advice needed Pin
CHill6025-May-16 10:56
mveCHill6025-May-16 10:56 
GeneralRe: Advice needed Pin
OriginalGriff25-May-16 19:38
mveOriginalGriff25-May-16 19:38 
GeneralRe: Advice needed Pin
osxman25-May-16 21:50
osxman25-May-16 21:50 
GeneralRe: Advice needed Pin
Pete O'Hanlon25-May-16 21:56
subeditorPete O'Hanlon25-May-16 21:56 
GeneralRe: Advice needed Pin
OriginalGriff25-May-16 22:04
mveOriginalGriff25-May-16 22:04 
GeneralRe: Advice needed Pin
osxman25-May-16 22:12
osxman25-May-16 22:12 
GeneralRe: Advice needed Pin
OriginalGriff25-May-16 22:17
mveOriginalGriff25-May-16 22:17 
GeneralRe: Advice needed Pin
osxman25-May-16 22:31
osxman25-May-16 22:31 
GeneralRe: Advice needed Pin
Richard Deeming26-May-16 1:58
mveRichard Deeming26-May-16 1:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.