win32API的一些使用经验
来源:互联网 发布:cc域名转入 编辑:程序博客网 时间:2024/05/16 14:34
c#程序里调用系统API:
//利用系统api回收垃圾
[System.Runtime.InteropServices.DllImport("kernel32.dll")] public static extern bool SetProcessWorkingSetSize(IntPtr proc, int min, int max); public void FlushMemory() { GC.Collect(); GC.WaitForPendingFinalizers(); if (Environment.OSVersion.Platform == PlatformID.Win32NT) { SetProcessWorkingSetSize(System.Diagnostics.Process.GetCurrentProcess().Handle, -1, -1); } }
c#脚本里:
//用于unity的C#脚本,使用一些系统函数如:SetWindowPos,GetWIndowLong,FindWindowEx等,用来获取摸个线程的窗体然后改变窗体的位置:
[DllImport("user32.dll")] static extern bool SetWindowPos(IntPtr hWnd, int hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags); [DllImport("user32.dll")] static extern IntPtr GetForegroundWindow(); [DllImport("user32.dll", EntryPoint = "GetWindowLong")] static extern IntPtr GetWindowLong(IntPtr hWnd, int nIndex); const uint SWP_SHOWWINDOW = 0x0040; [DllImport("user32.dll")] public static extern System.IntPtr FindWindowEx(System.IntPtr parent, System.IntPtr childe, string strclass, string strname); IntPtr p = FindWindowEx(System.IntPtr.Zero, System.IntPtr.Zero, null, "线程的名称"); SetWindowPos(p, -1, 左上角.x, 左上角.y, (int)screenPosition.width, (int)screenPosition.height, SWP_SHOWWINDOW); SetWindowLong(p, -16, 369164288);
c++
//利用系统API设置窗体的位置和属性(TOPMOST)
static HWND handle = NULL;handle = WindowFromDC(wglGetCurrentDC());SetWindowLong(handle,-16,369164288);SetWindowPos(handle,HWND_TOPMOST,screenX,screenY,screenwidth,screenheight,SWP_SHOWWINDOW);
0 0
- win32API的一些使用经验
- Win32API 的使用实例
- Win32API的使用实例WndProc
- 使用OpenCV的一些经验
- 使用dotnetnuke的一些经验
- OgreMax的一些使用经验
- zTree使用的一些经验
- 使用cocos2dx的一些经验
- 使用 React 的一些经验
- 一些使用Scrapy的经验
- svn的一些使用经验
- 使用linux的一些经验
- SparkRDD的一些使用经验
- Wireshark的一些使用经验
- DevCPP不支持一些Win32API的解决办法.
- win32API学习中遇到的一些问题
- Java的一些类的使用经验
- Java的一些类的使用经验
- 离开的最后感慨,最好的话语
- MVC(BundleConfig) 压缩捆绑技术,减少页面请求,优化客户体验。
- OSX本地搭建svn服务器
- Head First HTML与CSS读书笔记 (三)A、FROM、TABLE、LIST、盒模型
- 机器学习之概念学习
- win32API的一些使用经验
- 备份至网络(SqlServer 2005)
- OBJECTIVE-C中nsstring的writetofile atomically参数解释
- 如何在Axis2中添加SOAP头
- PHP用文件操作函数,批量处理客户名单
- intellij idea 优化设置
- android状态栏一体化(沉浸式状态栏)
- MAC地址和IP地址的区别与联系(计算机网络篇)
- struts 拦截器来过滤用户的权限