C# 调用 Google Earth Com API开发(二)
2009-05-22 08:29:53 来源:WEB开发网2、NativeMethods类定义:
1: // 功能:Windows API调用
2: // 描述:大家可以参照MSDN
3: // 作者:温伟鹏
4: // 日期:2009-02-08
5:
6: using System;
7: using System.Collections.Generic;
8: using System.Text;
9: using System.Runtime.InteropServices;
10:
11: namespace GEDemo
12: {
13: public class NativeMethods
14: {
15: [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
16: public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int x, int y, int cx, int cy, UInt32 uflags);
17:
18: [DllImport("user32.dll", CharSet = CharSet.Auto)]
19: public static extern IntPtr PostMessage(int hWnd, int msg, int wParam, int lParam);
20:
21: #region 预定义
22:
23: public static readonly IntPtr HWND_BOTTOM = new IntPtr(1);
24: public static readonly IntPtr HWND_NOTOPMOST = new IntPtr(-2);
25: public static readonly IntPtr HWND_TOP = new IntPtr(0);
26: public static readonly IntPtr HWND_TOPMOST = new IntPtr(-1);
27: public static readonly UInt32 SWP_NOSIZE = 1;
28: public static readonly UInt32 SWP_NOMOVE = 2;
29: public static readonly UInt32 SWP_NOZORDER = 4;
30: public static readonly UInt32 SWP_NOREDRAW = 8;
31: public static readonly UInt32 SWP_NOACTIVATE = 16;
32: public static readonly UInt32 SWP_FRAMECHANGED = 32;
33: public static readonly UInt32 SWP_SHOWWINDOW = 64;
34: public static readonly UInt32 SWP_HIDEWINDOW = 128;
35: public static readonly UInt32 SWP_NOCOPYBITS = 256;
36: public static readonly UInt32 SWP_NOOWNERZORDER = 512;
37: public static readonly UInt32 SWP_NOSENDCHANGING = 1024;
38:
39: #endregion
40:
41: public delegate int EnumWindowsProc(IntPtr hwnd, int lParam);
42:
43: [DllImport("user32", CharSet = CharSet.Auto)]
44: public extern static IntPtr GetParent(IntPtr hWnd);
45:
46: [DllImport("user32", CharSet = CharSet.Auto)]
47: public extern static bool MoveWindow(IntPtr hWnd, int X, int Y, int nWidth, int nHeight, bool bRepaint);
48:
49: [DllImport("user32", CharSet = CharSet.Auto)]
50: public extern static IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
51:
52: [DllImport("user32.dll", ExactSpelling = true, CharSet = CharSet.Auto)]
53: public static extern IntPtr GetWindow(IntPtr hWnd, int uCmd);
54:
55: public static int GW_CHILD = 5;
56: public static int GW_HWNDNEXT = 2;
57: }
58: }
3、执行效果:
系列文章:
C#调用 GoogleEarth COM API开发(一)
C# 调用 Google Earth Com API开发(三)
- ››Google运作经理Bryan Power给出的GOOGLE求职意见
- ››Google用户体验的十大设计原则
- ››Google Analytics(分析)能为网站带来什么
- ››Google goggles图片搜索 如何优化一个wap网站
- ››Google Docs将增加iPhone和Android编辑功能
- ››Google Android操作系统内核编译图文教程
- ››google map api 与jquery结合使用--控件,监听器...
- ››google map api 与jquery结合使用(2) --标注,浮...
- ››google map api 与jquery结合使用(3) --图标样式...
- ››Google 首页代码分析及简评
- ››Google财经更新iPhone和Android版本
- ››Google否认Android应用认证体系被破解
更多精彩
赞助商链接