WPF 接收初始化 /// <summary> /// 初始化窗体句柄消息接收函数 /// </summary> private void InitailWinHand() { HwndSource hWndSource; WindowInteropHelper wih = new WindowInteropHelper(this);
c# 无边框窗体开发窗体伸缩功能 1 protected override void WndProc(ref Message m) 2 { 3 switch (m.Msg) 4 { 5 case 0x84: 6 base.WndProc(ref m); 7 Point lpint
class CSharp_Win32Api{#region User32.dll 函数/// <summary>/// 该函数检索一指定窗口的客户区域或整个屏幕的显示设备上下文环境的句柄, ///以后可以在GDI函数中使用该句柄来在设备上下文环境中绘图。hWnd:设备上下文环境被检索的窗口的句柄/// </summary>[DllImport("user3
Language Version: C# 8.0 WPF 捕获系统主题改变 通过System.Windows.Interop using System.Windows.Interop; // this is Window 可以写在构造方法里 this.SourceInitialized += Theme.ThemeManager.Window_SourceInitialized; // see "https://stackoverflow.com/question
好多开发者苦于很难在unity3d下实现RTMP直播推送,本次以大牛直播SDK(Github)的Windows平台RTMP推送模块(以推摄像头为例,如需推屏幕数据,设置相关参数即可)为例,介绍下unity3d的RTMP推送集成。 简单来说,Unity3D环境下,可以直接调用C#的接口封装,针对此,我们先做了一层封装 (nt_publisher_wr
原文:WPF 让窗口激活作为前台最上层窗口的方法 原文参照林大佬的博客WPF 让窗口激活作为前台最上层窗口的方法 我只提供下,我使用的代码 [DllImport("user32.dll")]private static extern IntPtr GetForegroundWindow();[DllImport("user32.dll")]private static extern uint
namespace System {/*参考://https://www.cnblogs.com/banhua/archive/2012/07/13/2590920.html*/ using System.Collections.Generic; using System.Text; using System.Runtime.InteropServices; class SystemUtil { [StructLayout(LayoutKind.Seque
现在有越来越多的人在使用C#语言做编程,但我发现好像用C#做音视频流媒体开发的比较少。我们的libEasyScreenLive目前支持Windows、Android平台,通过EasyScreenLive我们就可以避免接触到稍显复杂的音视频源采集,编码和流媒体推送以及RTSP/RTP/RTCP/RTMP服务流程。 本文就给大家介绍一
本文和C++使用PrintWindow进行窗口抓图对应,使用C#实现。 Win32封装同C#使用BitBlt进行窗口抓图。 PrintCaptureHelper.cs using System; namespace CaptureSharp { internal class PrintCaptureHelper { public IntPtr BitmapPtr => _hBitmap; public W
本文转自:https://docs.microsoft.com/zh-cn/dotnet/api/system.gc.suppressfinalize?redirectedfrom=MSDN&view=netframework-4.8#System_GC_SuppressFinalize_System_Object_ 请求公共语言运行时不要调用指定对象的终结器。 C# public static void SuppressFinalize (objec
ylbtech-ons.Producer.cs 1.返回顶部 1、 //------------------------------------------------------------------------------ // <auto-generated /> // // This file was automatically generated by SWIG (http://www.swig.org). // Version 3.0.12 // //
在给软件添加快捷键时,经常遇到其它软件或者系统已设置的快捷键,导致功能冲突。 HotKey函数 下面介绍一个user32.dll的RegisterHotKey以及UnregisterHotKey热键处理的函数 注册热键 RegisterHotKey function BOOL RegisterHotKey( HWND hWnd, //响应热键的窗口句柄,如果为空
线程安全性很重要。某些数据本来应该留给特定线程使用,并且如果忽略了这些信息,您有时会发现自己正在读取,写入或执行无效的内存,这当然会出现意外的结果。发生这种情况通常是由于以下两个原因造成的,一-由于其他线程正在主动修改我们的线程尝试访问的数据,从而导致无效的指针,字段等,或者
//定义一个委托 public delegate void RemoteConfigCallback(uint dwType, IntPtr lpBuffer, uint dwBufLen, IntPtr pUserData); //定义一个函数 private void ProcessUserInfoSearchCallback(uint dwType, IntPtr lpBuffer, uint dwBufLen, I
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Runtime.InteropServices; using System.Text; using System.Windows.Forms; namespace MouseHook20200119 {
本示例以植物大战僵尸为例, 实现功能为 每1秒让阳光刷新为 9999.本示例使用的游戏版本为 [植物大战僵尸2010年度版], 使用的辅助查看内存地址的工具是 CE. 由于每次启动游戏, 游戏中阳光地址都是变的, 唯一不变的基址1, 我们要通过CE工具找到基址1的地址, 可以算出阳光的地址.
https://files.cnblogs.com/files/xe2011/mciSendString2020111183816.rarmciSendString API[DllImport("WinMm.dll",CharSet = CharSet.Auto,CallingConvention = CallingConvention.Cdecl)] public static extern int mciSendString(string lpstrCommand,strin
记录目前两种实现方式 [DllImport("user32.dll")] private static extern bool PrintWindow(IntPtr hwnd, IntPtr hdcBlt, uint nFlags); public void WriteBmp(string bmpPath) { int screenWidth = webbrowser.Document.Body.ScrollRectan
参考:https://studygolang.com/articles/2712 package mainimport ( "syscall" "time" "unsafe")func IntPtr(n int) uintptr { return uintptr(n)}func StrPtr(s string) uintptr { return uintptr(unsafe.Pointer(syscall.Stri
原文:2019-11-29-WPF-从触摸消息转触摸事件 title author date CreateTime categories WPF 从触摸消息转触摸事件 lindexi 2019-11-29 08:47:55 +0800 2019-05-12 15:12:31 +0800 WPF 在 WPF 程序可能因为一些坑让程序触摸失效,如果此时还可以收到系统的触摸消息,那么可以通过
#region 无边框窗体移动改变大小 [DllImport("user32.dll")] public static extern bool ReleaseCapture(); [DllImport("user32.dll")] public static extern bool SendMessage(IntPtr hwnd, int wMsg, int wParam, int lP
public static void PtrMoveSize(ref IntPtr pData, int nLength) { if (IntPtr.Size == sizeof(Int64)) pData = new IntPtr(pData.ToInt64() + nLength); else pData = new IntPtr(pData.ToInt32(
WPF中Webbrowser控件使用HwndHost所以webbrowser会在所有控件的前方。所以webbrowser会覆盖所有同级的控件。 现在通过使用Win32API 可以避免这个情况。 最主要的就是这几个Win32API: [DllImport("user32.dll")] public static extern bool SetWindowRgn(IntPtr hWnd,
有时候需要将一个补挡住或者隐藏的窗口实时截取出窗口状态 常用的bitblt() 可以将源设备区域像素拷贝到目标区域,而在窗口挡住或者隐藏的情况下就无能为力了 这个时候可以用PrintWindow,不论是窗口被隐藏,或者被挡住都能截出想要的区域 IntPtr hscrdc = GetWindowDC(hWnd
和SharpDX坑爹的Variant刚正面 几个月前我写了和篇文章《.NET中生成动态验证码》文章,其实里面藏着一个大坑。运行里面的代码,会发现运行的gif图片并没有循环播放: 细心的网友也注意到了这个问题: ……但后来他备注说“已解决”,我当时也不知道该怎么解决的,所以我追问了一下,但他一直