随笔分类 - WIN API学习笔记
摘要:IntPtr hWnd = new WindowInteropHelper(Application.Current.MainWindow).Handle; IntPtr hWndProgMan = FindWindow("Progman", "Progr...
阅读全文
摘要:[StructLayout(LayoutKind.Sequential)] public struct WindowRect { public int left; public int top; publi...
阅读全文
摘要:压缩成一个CAB包的办法:type list.txt (生成一个文件列表)makecab /f list.txt /d compressiontype=mszip /d compressionmemory=21 /d maxdisksize=1024000000 /d diskdirectoryte...
阅读全文
摘要:[DllImport("kernel32.dll")] public static extern int WinExec(string exeName, int operType); public Form1() { ...
阅读全文
摘要:一:源起 1.何为CB/S的应用程序 C/S结构的应用程序,是客户端/服务端形式的应用程序,这种应用程序要在客户电脑上安装一个程序,客户使用这个程序与服务端通信,完成一定的操作。 B/S结构的应用程序,是浏览器/服务端形式的应用程序,这种应用程序不用在客户端部署任何东西,客户只需要通过浏览器与服务端
阅读全文
摘要:第一步:KSDLL2.idl文件中 dispinterface _DKSDLL2 { properties: methods: [id(1)] void CheckIt(); [id(2)] BSTR GetIt(); };第二步:KSDLL2Ctrl.h文件中protected: void CheckIt(void); BSTR GetIt();第三步:KSDLL2Ctrl.cpp文件中// 调度映射BEGIN_DISPATCH_MAP(CKSDLL2Ctrl, COleControl) DISP_FUNCTION_ID(CKSDLL2Ctrl, "CheckIt", d
阅读全文
摘要:using system;using system.runtime.interopservices;namespace myserviceinstaller{ class serviceinstaller { #region private variables private string _servicepath; private string _servicename; private string _servicedisplayname; #endregion private variables ...
阅读全文
摘要:#include <windows.h>#include "resource.h"#include <string>LRESULT CALLBACK MainWndProc(HWND,UINT,WPARAM,LPARAM);//窗口函数的函数原型int APIENTRY WinMain( //APIENTRY是__stdcall的宏定义 HINSTANCE hIn...
阅读全文
摘要:resource.h的代码为
阅读全文
摘要:#include <windows.h>LRESULT CALLBACK MainWndProc(HWND,UINT,WPARAM,LPARAM);//窗口函数的函数原型int APIENTRY WinMain( //APIENTRY是__stdcall的宏定义 HINSTANCE hInstance, //本模块的实例句柄 HINSTANCE hPrevInsta...
阅读全文
摘要:#include <windows.h>#include <iostream>#include <process.h>using namespace std;int g_nCount1 = 0;int g_nCount2 = 0;CRITICAL_SECTION g_cs;//临界区BOOL g_bContinue = TRUE;//线程结束标志UINT WIN...
阅读全文
摘要:#include <windows.h>#include <iostream>using namespace std;DWORD WINAPI ThreadIdle(LPVOID lpParam){ int i=0; while(i++<10) { cout<<"Idel thread is running"<<endl; } return ...
阅读全文
摘要:DLL项目的头文件 #ifdef KEYHOOKLIB_EXPORT //此宏将在CPP文件中定义#define KEYHOOKLIB_API __declspec(dllexport)#else#define KEYHOOKLIB_API __declspec(dllimport)#endif#define HM_KEY WM_USER+101BOOL KEYHOOKLIB_API WINAPI...
阅读全文
摘要:#include <windows.h>#include <iostream>#include "12dll.h"using namespace std;#pragma comment(lib,"12Dll")//要链接到什么库文件void main(){ //CMy12Dll a; cout<<fnMy12Dll()<<endl; char b; ...
阅读全文
摘要:#include <windows.h>#include <iostream>using namespace std;int main(){ //HWND hWnd = ::FindWindow("Notepad",NULL); HWND hWnd = ::FindWindow(NULL,"a.txt - 记事本"); if(hWnd != NULL) { ::SendM...
阅读全文
摘要:#include <windows.h>#include <iostream>using namespace std;DWORD WINAPI ThreadProc(LPVOID lpParam){ int i = 0; while(i<20) { cout<<i<<endl; i++; } return 0;}int main(){ HA...
阅读全文
摘要:#include <windows.h>#include <iostream>using namespace std;HANDLE g_hProcess;BOOL ChangeMemory(DWORD dwValue){ const DWORD dwOneGB = 1024*1024*1024;//1GB const DWORD dwOnePage = 4*1024;//4...
阅读全文
摘要:#include //系统会自动连接到指定的库文件lib#include //std io 标准输入输出接口#include using namespace std;int main(){ char szCommandLine[] = "cmd"; STARTUPINFO si = {sizeof(si)};// PROCESS_INFORMATION pi; si.dwFlags = STA...
阅读全文
摘要:#include <windows.h>//系统会自动连接到指定的库文件lib#include <tlhelp32.h>//声明快照函数的头文件#include <stdio.h>//std io 标准输入输出接口#include <iostream>using namespace std;int main(){ PROCESSENTRY32 p...
阅读全文
摘要:#include //系统会自动连接到指定的库文件lib#include #include //std io 标准输入输出接口#include using namespace std;int main(){ char szCommandLine[] = "cmd"; STARTUPINFO si = {sizeof(si)};// PROCESS_INFORMATION pi; si.dwFl...
阅读全文