成人免费xxxxx在线视频软件_久久精品久久久_亚洲国产精品久久久_天天色天天色_亚洲人成一区_欧美一级欧美三级在线观看

通過調用Windows API隱藏GoogleEarth界面

開發 后端
本文在《C#調用GoogleEarth Com API》的基礎上展示如何調用Windows API隱藏GoogleEarth的界面。

繼《C#調用GoogleEarth Com API》,我又帶給大家第二篇文章。這一篇文章在第一篇的基礎上,展示如何調用Windows API隱藏GoogleEarth的界面,并將GoogleEarth的地圖顯示在自定義的窗體上。廢話少說,直接上代碼。

[[4987]]

1、主窗口代碼:   

// 功能:GE實例(二)
// 描述:GE COM API 網址:http://earth.google.com/comapi/index.html
// 作者:溫偉鵬
// 日期:2009-02-08

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using EARTHLib;

namespace GEDemo
{
public partial class Form2 : Form
{
/// < summary>
/// 用來關閉GoogleEarth的消息定義
/// < /summary>
static readonly Int32 WM_QUIT = 0x0012;

private IntPtr GEHWnd = (IntPtr)5;
private IntPtr GEHrender = (IntPtr)5;
private IntPtr GEParentHrender = (IntPtr)5;
/// < summary>
/// 定義GE應用程序類
/// < /summary>
private ApplicationGEClass GeApp;

public Form2()
{
InitializeComponent();
}

protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);

if (!this.DesignMode)
{
GeApp = new ApplicationGEClass();

GEHWnd = (IntPtr)GeApp.GetMainHwnd();

NativeMethods.SetWindowPos(GEHWnd, NativeMethods.HWND_BOTTOM, 0, 0, 0, 0,
NativeMethods.SWP_NOSIZE + NativeMethods.SWP_HIDEWINDOW);

GEHrender = (IntPtr)GeApp.GetRenderHwnd();
GEParentHrender = (IntPtr)NativeMethods.GetParent(GEHrender);

NativeMethods.MoveWindow(GEHrender, 0, 0, this.Width, this.Height, true);

NativeMethods.SetParent(GEHrender, this.Handle);
}
}

protected override void OnClosing(CancelEventArgs e)
{
base.OnClosing(e);

NativeMethods.PostMessage(GeApp.GetMainHwnd(), WM_QUIT, 0, 0);
}
}
}

2、NativeMethods類定義:


// 功能:Windows API調用
// 描述:大家可以參照MSDN
// 作者:溫偉鵬
// 日期:2009-02-08

using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;

namespace GEDemo
{
public class NativeMethods
{
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int x, int y, int cx, int cy, UInt32 uflags);

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

#region 預定義

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

#endregion

public delegate int EnumWindowsProc(IntPtr hwnd, int lParam);

[DllImport("user32", CharSet = CharSet.Auto)]
public extern static IntPtr GetParent(IntPtr hWnd);

[DllImport("user32", CharSet = CharSet.Auto)]
public extern static bool MoveWindow(IntPtr hWnd, int X, int Y, int nWidth, int nHeight, bool bRepaint);

[DllImport("user32", CharSet = CharSet.Auto)]
public extern static IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);

[DllImport("user32.dll", ExactSpelling = true, CharSet = CharSet.Auto)]
public static extern IntPtr GetWindow(IntPtr hWnd, int uCmd);

public static int GW_CHILD = 5;
public static int GW_HWNDNEXT = 2;
}
}

3、執行效果: 

現在,調用Windows API隱藏GoogleEarth界面的效果就達到了。

【編輯推薦】

  1. ??C#程序中的數據顯 示:自定義標簽和XML、XSL??
  2. ??C#自定義事件是如何生成的??
  3. ??C# 自定義控件dll文件的生成步驟??
  4. ??C#自定義快捷鍵的實現??
  5. ??C#自定義事件的步驟介紹??


責任編輯:book05 來源: cnblogs
相關推薦

2009-08-05 15:10:19

C#調用GoogleE

2016-10-14 08:45:19

Windows 10隱藏密碼

2009-08-03 13:34:57

C#調用Windows

2009-07-31 16:12:10

Windows APIC#

2009-08-17 13:18:01

C#調用Windows

2009-08-05 15:51:38

GoogleEarthGoogleEarth

2009-11-03 12:52:38

VB.NET Wind

2009-08-25 16:16:27

C#調用Windows

2009-08-17 13:49:20

C#中調用Window

2009-08-17 13:26:20

C#調用Windows

2016-10-25 14:47:29

Windows隱藏鏈接lynx

2023-01-27 14:56:38

Windows 11微軟Windows 10

2009-03-24 09:15:42

Windows 7使用技巧微軟

2009-12-07 13:42:26

windows api

2013-01-25 14:35:18

Windows 7

2023-03-10 08:59:30

2009-05-19 10:24:55

2023-06-14 15:35:26

2016-08-11 16:15:07

Windows 10Windows Def任務欄

2013-12-04 09:43:51

點贊
收藏

51CTO技術棧公眾號

主站蜘蛛池模板: 成人午夜网站 | 少妇一级淫片免费播放 | 日本一区二区不卡 | 日韩精品一区二区三区久久 | 久久99久久| www.日韩在线 | 久久久av| 日韩在线观看一区 | 欧美日韩视频在线第一区 | 日韩在线观看网站 | 欧美一区二区三区在线免费观看 | 91免费在线看 | 日韩精品免费一区二区在线观看 | 91免费在线看 | 四虎永久免费影院 | 久久久久久国产精品免费免费男同 | 免费同性女女aaa免费网站 | 狠狠干狠狠操 | 国产精品免费一区二区三区四区 | 国产日韩欧美在线 | 久久视频精品 | 在线看av的网址 | www.亚洲精品| 国产在线激情视频 | 国产激情在线播放 | 欧美激情精品久久久久久变态 | 成人av一区二区在线观看 | 国产96在线 | 国产视频久久 | 亚洲成人免费观看 | 婷婷免费视频 | 久久亚洲一区二区 | 国产九九精品 | 成人不卡| 日韩在线小视频 | 中文字幕精品视频 | 国产精品成人一区二区三区夜夜夜 | 欧美精品久久久 | 亚洲精品国产电影 | 国产精品欧美精品 | 亚洲超碰在线观看 |