随笔分类 -  c语言

摘要:#include <locale.h> void main(){ setlocale(LC_ALL, "chs"); printf("当前程序运行的工作目录:%ws",path); } 代码页编码 936 注意:setlocale(LC_ALL, "chs"); 一定要放在输出的前面 std::co 阅读全文
posted @ 2021-04-05 11:10 乘舟凉 阅读(253) 评论(0) 推荐(0)
摘要:DWORD GetModuleFileNameA( HMODULE hModule, // in 进程路径 LPSTR lpFilename, // out 存储文件路径的缓冲区首地址 DWORD nSize //in 缓冲区的大小); 头文件: windows.h 使用案例一:获取本进程的文件路径 阅读全文
posted @ 2021-04-04 18:00 乘舟凉 阅读(750) 评论(0) 推荐(0)
摘要:/** 名称:DllMain 功能: dll被操作是系统会自动调用 参数:HANDLE hModule dll的句柄 DWORD ul_reason_for_call 调用原因 LPVOID lpReserved 如果是动态加载则为NULL 静态加载则为非NULL 返回值:BOOL 如果为False 阅读全文
posted @ 2021-04-04 17:05 乘舟凉 阅读(278) 评论(0) 推荐(0)
摘要:#ifdef __cplusplus //如果是c++文件,就将endif内的代码用c编译器编译 extern "C" { #endif __declspec(dllexport) void SetProcName(LPCTSTR szProcName)//__declspec(dllexport) 阅读全文
posted @ 2021-04-04 14:03 乘舟凉 阅读(1365) 评论(0) 推荐(0)
摘要:函数指针对我来说一直是老大难得问题,今天我终于对于他有了一点点理解。 一般情况下,对于函数指针大多数是下面两种情况: 1.void (*PFN_SetProcName)(LPCTSTR szProcName); 2.typedef void (*PFN_SetProcName)(LPCTSTR sz 阅读全文
posted @ 2021-04-03 11:22 乘舟凉 阅读(69) 评论(0) 推荐(0)
摘要:1.CString 实质上是宽字符 LPCTSTR filter = _T("Dll files(.dll)|*.dll||"); //Dll files(.dll)为描述 *.dll 显示的类型 最后的|| 为结束的意思 可以追加 如:"Dll files(.dll)|*.dll|(Text fi 阅读全文
posted @ 2021-03-07 23:04 乘舟凉 阅读(117) 评论(0) 推荐(0)
摘要:源码: #include "stdio.h" #include <Windows.h> #include "conio.h" LRESULT CALLBACK KeyboardProc(int code,WPARAM wParam,LPARAM lParam)//钩子过程 { printf("1") 阅读全文
posted @ 2020-11-29 12:10 乘舟凉 阅读(292) 评论(0) 推荐(0)
摘要:1 #include <stdio.h> 2 #include <conio.h> 3 #include <windows.h> 4 #define DEF_DLL_NAME "keyHook.dll" 5 #define DEF_FUN_NAME "keyboardPrc@12" 6 7 8 9 阅读全文
posted @ 2020-11-28 14:54 乘舟凉 阅读(420) 评论(0) 推荐(0)