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搜索引擎的奥秘
- ››Google测试搜索结果页面右侧内容更丰富的信息栏
- ››调用已注册会员人数和最新会员名称
- ››Google Dart精粹:应用构建,快照和隔离体
- ››google的代码审查
- ››google analytics清晰追踪爬虫的爬行信息
- ››Google+中文用户在两千万Google+大军中是少数派
- ››Google AdWords最昂贵点击成本的20种关键词分类
- ››Google运作经理Bryan Power给出的GOOGLE求职意见
- ››Google用户体验的十大设计原则
- ››Google Analytics(分析)能为网站带来什么
- ››Google goggles图片搜索 如何优化一个wap网站
更多精彩
赞助商链接