Posts
All the articles I've posted.
IE获取元素样式
Published: at 04:01 PMIE浏览器获取元素样式,通过正常方式获取不了。 这种方法获取不了: CComPtr<IHTMLStyle> pHtmlStyle; if (FAILED(mpHtmlElement->getstyle(&pHtmlStyle)) && pHtmlStyle = NULL) { if (FAIL...
QProcess 7z.exe 解压进度
Published: at 07:04 PM我们使用一个简单的方法来实现,使用7z提供的sdk实现太麻烦了。 7z命令行 使用7z的命令行来解压要获取进度必须要读取到stdout里面的进度信息,关键参数是:-bsp1,只有这样才能在readyReadStandardOutput信号中不断读...
降权启动应用
Published: at 10:08 PM如果应用是管理员权限,它再去启其他进程时也会是管理员权限,那么怎样降权呢?让它以普通用户的权限来启动,下面代码提供了一种实现方法。 注意!!! WTSQueryUserToken在普通会话下调用总是失败,但是在session 0上的...
beast websocket demo
Published: at 05:09 PMclient // client.cpp 此文件包含 "main" 函数。程序执行将在此处开始并结束。 // include <boost/beast/core.hpp> include <boost/beast/websocket.hpp> include <boost/asio/connect.hpp> include <boo...
隐式共享的QJsonArray对象,非const遍历会导致一次内存拷贝
Published: at 12:25 PM隐式共享的QJsonArray对象,非const遍历会导致一次内存拷贝 直接看一个例子,先初始化一个大的arr,然后将其赋值给arr2和arr3,此时我们观察对象的d指针所指向的内存。 arr2和arr指向的内存是一致的,arr3和obj"arr"...
visual studio修改堆栈保留大小和提交大小
Published: at 11:27 AM如果程序中使用的堆栈超过1M(默认)你就需要进行这个设置,但是设置太大又会造成虚拟内存过高。如果你明确的知道哪一个线程使用的 堆栈多高,可以只针对那个线程进行设置,这样不会影响到整个程序。 Qt线程设置堆栈大小...
bat常用命令
Published: at 07:59 PM当前所执行bat文件的路径 cd "%dp0" 设置变量 set DIR=%dp0 使用变量,注意路径中可能有空格要加双引号 %DIR% 强制杀死进程 taskkill /f /im "进程名" 删除文件 del "文件路径...
golang 下载大文件进度
Published: at 07:19 PM使用io.Copy将下载的部分内容不断写入文件,重载io.Reader的Read函数,使用Read读取数据和大小,通过http的ContentLength获取total大小。 package goutil import ( "io" "net/http" "os" ) type ChunkRe...
boost命令行解析
Published: at 09:42 AM对于一些工具程序使用命令行是非常普遍的,也是很方便的。但是原始的main函数只提供了一个简单的参数使用方法,要想提供一些 更丰富的命令交互还需要自己来解析。 boost有提供这个功能用起来还是蛮方便的,下面就是简...
Qt怎样将gif作为窗口背景
Published: at 07:45 PM很多窗口会在背景展示一些动态的信息,此时用gif是比较合适的,Qt窗口使用gif作用背景步骤如下: 1. 定义一个movie对象 QScopedPointer<QMovie> movie; 2. 设置movie movie.reset(new QMovie(path)); ...