![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
通用技能
蓝.天
to be or not to be do or die
展开
-
c++ 对文件的读写
下面直接贴出两个类,一个为写文件,一个为读文件。// Generates a temporary file name. bool GenerateNewFile(std::wstring& filepath){ UINT uRetVal = 0; std::wstring tempPath = getTempPath();//可改为windowsApi 同名函数 TCHAR szTempFileName[MAX_PATH]; if (!tempPath.em原创 2021-04-11 16:56:40 · 223 阅读 · 0 评论 -
WindowsApi使用(3)——检测电脑是否连接网络
用来检测本地电脑是否网络是否正常连接#include <Netlistmgr.h>bool CheckIsNetworkWorking(){ CoInitialize(NULL); IUnknown *pUnknown = NULL; BOOL bOnline = TRUE; HRESULT Result = CoCreateInstance(CLSID_NetworkListManager, NULL, CLSCTX_ALL, IID_IUnkn原创 2021-04-11 16:25:49 · 749 阅读 · 0 评论 -
windows api 封装的定时器
#pragma once#ifdef _WINDOWS#include <Windows.h>#else//请添加相应系统版本实现#endifnamespace gdc{ typedef void(*TimerCallback)(void *userData, unsigned long elapsed); /*! * @brief 定时器类 */ class GDCTimer { public: GD.原创 2021-03-24 23:21:18 · 528 阅读 · 0 评论 -
Windows API 使用(2)——加载动态库
bool gdc::utils::createDirectory(const std::wstring& dirPath){#ifdef _WINDOWS int res = _wmkdir(dirPath.c_str()); return (res == 0 || res == 17);#else std::string sPath = UnicodeToUtf8(dirPath); return (mkdir(sPath.c_str(), 0777) == ...原创 2021-03-09 23:02:38 · 231 阅读 · 0 评论 -
Windows API使用(1)——对文件的操作(获取名字或路径)
对文件的操作// struct tempfileInfo// {// long long accesstime;// std::string fileName;// };// std::wstring localPath = FileSystem::GetLocalAppDataDirPath(L"Glodon");// std::wstring localLogFolderPath = localPath + L"G原创 2021-03-08 16:15:08 · 1173 阅读 · 0 评论 -
如何编写cmke文件
最简单的cmake文件# CMakeLists.txt# CMake最低版本要求cmake_minimum_required(VERSION 3.5)# 项目名称project(test_1)# 生成可执行文件,test_1是可执行文件的名字,hello.c是源文件名称,如有其他源文件,可在后面添加add_executable(test_1 hello.cpp) ...原创 2021-03-07 23:17:59 · 611 阅读 · 0 评论 -
脚本文件BAT入门(1)
一、常用的命令原创 2021-03-06 23:08:51 · 472 阅读 · 0 评论 -
脚本文件BAT入门(2)
一、管理员运行脚本::在你的脚本前加上以下两句命令%1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 ::","","runas",1)(window.close)&&exitcd /d "%~dp0"::下面是你的程序tscancode.exe --enable=warning E:\Gbmp\gdc-sdk\src\Common 2>tscancode原创 2021-03-06 16:56:27 · 2430 阅读 · 0 评论