开发学院软件开发C语言 C# 调用 Google Earth Com API开发(二) 阅读

C# 调用 Google Earth Com API开发(二)

 2009-05-22 08:29:53 来源:WEB开发网   
核心提示: 2、NativeMethods类定义:1://功能:WindowsAPI调用2://描述:大家可以参照MSDN3://作者:温伟鹏4://日期:2009-02-085:6:usingSystem;7:usingSystem.Collections.Generic;8:usingSystem

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# 调用 Google Earth Com API开发(二)

系列文章:

C#调用 GoogleEarth COM API开发(一)

C# 调用 Google Earth Com API开发(三)

上一页  1 2 

Tags:调用 Google Earth

编辑录入:爽爽 [复制链接] [打 印]
[]
  • 好
  • 好的评价 如果觉得好,就请您
      0%(0)
  • 差
  • 差的评价 如果觉得差,就请您
      0%(0)
赞助商链接