Click here to Skip to main content
15,126,209 members
Home / Discussions / C#
   

C#

 
Questionhow can i show google earth in winform c# Pin
Member 1252559627-May-16 3:37
MemberMember 1252559627-May-16 3:37 
AnswerRe: how can i show google earth in winform c# Pin
Eddy Vluggen27-May-16 3:56
professionalEddy Vluggen27-May-16 3: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 4:52
MemberMember 1252559627-May-16 4:52 
GeneralRe: how can i show google earth in winform c# Pin
Eddy Vluggen27-May-16 5:31
professionalEddy Vluggen27-May-16 5:31 
GeneralRe: thank sir! Pin
Member 1252559627-May-16 5:48
MemberMember 1252559627-May-16 5:48 
GeneralRe: thank sir! Pin
Eddy Vluggen27-May-16 7:27
professionalEddy Vluggen27-May-16 7:27 
AnswerRe: how can i show google earth in winform c# Pin
Richard MacCutchan27-May-16 3:58
mveRichard MacCutchan27-May-16 3:58 
GeneralRe: anyway thank sir!i get setparent but need placemark,polygon,etc.. i m just beginner. :-O Pin
Member 1252559627-May-16 4:55
MemberMember 1252559627-May-16 4: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 5:17
mvePete O'Hanlon27-May-16 5:17 
QuestionWhat Does Complexity of Algorithm Mean??? Pin
Django_Untaken26-May-16 1:14
MemberDjango_Untaken26-May-16 1:14 
AnswerRe: What Does Complexity of Algorithm Mean??? Pin
Richard MacCutchan26-May-16 1:18
mveRichard MacCutchan26-May-16 1:18 
AnswerINCORRECT FORUM Pin
Pete O'Hanlon26-May-16 1:20
mvePete O'Hanlon26-May-16 1:20 
GeneralRe: What Does Complexity of Algorithm Mean??? Pin
harold aptroot26-May-16 1:52
Memberharold aptroot26-May-16 1:52 
QuestionHow to read process Output Message from process within the process ?? Pin
ArunRagam26-May-16 0:45
professionalArunRagam26-May-16 0:45 
QuestionAdvice needed Pin
osxman25-May-16 11:14
Memberosxman25-May-16 11:14 
GeneralRe: Advice needed Pin
CHill6025-May-16 11:56
mveCHill6025-May-16 11:56 
GeneralRe: Advice needed Pin
OriginalGriff25-May-16 20:38
mveOriginalGriff25-May-16 20:38 
GeneralRe: Advice needed Pin
osxman25-May-16 22:50
Memberosxman25-May-16 22:50 
GeneralRe: Advice needed Pin
Pete O'Hanlon25-May-16 22:56
mvePete O'Hanlon25-May-16 22:56 
GeneralRe: Advice needed Pin
OriginalGriff25-May-16 23:04
mveOriginalGriff25-May-16 23:04 
GeneralRe: Advice needed Pin
osxman25-May-16 23:12
Memberosxman25-May-16 23:12 
GeneralRe: Advice needed Pin
OriginalGriff25-May-16 23:17
mveOriginalGriff25-May-16 23:17 
GeneralRe: Advice needed Pin
osxman25-May-16 23:31
Memberosxman25-May-16 23:31 
GeneralRe: Advice needed Pin
Richard Deeming26-May-16 2:58
mveRichard Deeming26-May-16 2:58 
GeneralRe: Advice needed Pin
rickrose050626-May-16 4:11
Memberrickrose050626-May-16 4:11 

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.