半成品,要下班了,记录下
0x1 调用函数
BOOL PackExeFile(HWND hwndDlg)
{
HWND hEditShell = GetDlgItem(hwndDlg,IDC_EDIT_SHELL);
HWND hEditSrc = GetDlgItem(hwndDlg,IDC_EDIT_SRC);
TCHAR shellPath[256]={0};
TCHAR srcPath[256]={0};
GetDlgItemText(hwndDlg,IDC_EDIT_SHELL,shellPath,256);
...
直接上代码吧,写的时候遇到了点问题, 找到根源以后,就搞定了,
注意define的 语法, 错的挺郁闷的
// 20180110_01.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#define FileKey 0x86
//加载PE文件到内存中,并获取文件长...
测试进程之间互相读取信息
// 20180106_06.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <stdio.h>
#include <windows.h>
int main(int argc, char* argv[])
{
TCHAR szFileName[] = "c://ipmsg.exe";
STARTUPINFO si={0};
si.cb = sizeof(STARTUPIN...
主要是两个子进程之间的控制:
0x1 代码一
// 20180106_01.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <stdio.h>
#include <windows.h>
int main(int argc, char* argv[])
{
//printf("Hello World!\n");
//开启IE
/*
BOOL...
0x01 进程创建
// 20180104_02.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <Windows.h>
/*
BOOL CreateProcess(
LPCTSTR lpApplicationName, // name of executable module
LPTSTR lpCommandLine, // command...
0x1 项目介绍
字母区写上一段字母 大小在50个以内, 可以自己定义,缓冲区每次只能有一个字母, 4个编辑框可以分别吃字母,最后4个吃货的所有字母加起来等于输入的字母和
0x2 难点
多种线程控制的结合使用, 缓冲区的控制, 吃货区的控制
0x3 项目展示
0x4 项目代码
// 20180102_01.cpp : Defines the entry point for the application.
//
#include "stdafx.h...
几天没写代码, 感觉就好久了,要测试一个小项目,总结一下前段时间的学习的多线程的控制
主要分四个
临界区: 解决简单的多线程公用问题, 多个同时使用,注意死锁的问题
互斥体: 解决多开的问题, 可以跨进程,进行多线程的操作
事件:可以跨进程, 同时解决了,进程先后执行的问题
信号量: 可以控制,同时是几个线程执行的情况!
简单的自己的总结, 今天把 一个详细的综合案例放上来!!
// 20171228_01.cpp : Defines the entry point for the application.
//
#include "stdafx.h"
#include <windows.h>
#include <stdio.h>
#include "resource.h"
HWND hEdit1;
HWND hEdit2;
HWND hEdit3;
HWND hEdit4;
HANDLE hThread1;
HANDLE hThread2;
HANDLE hThread3;
HANDLE hThread4...
关键技术: 创建两个事件 CreateEvent, 创建一个事件 CreateEvent 是无法解决问题的
// 20171228_01.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <stdio.h>
#include <windows.h>
CRITICAL_SECTION cs;
DWORD g_Number = 0;
int g_Max = 10;
HAND...
CreateEvent 的官方定义如下:
HANDLE WINAPI CreateEvent(
_In_opt_ LPSECURITY_ATTRIBUTES lpEventAttributes, //安全属性
_In_ BOOL bManualReset, //设置信号复位方式为自动恢复为无信号状态(FALSE)还是手动恢复为无信号状态(TRUE)
_In_  ...
// 20171227_01.cpp : Defines the entry point for the application.
//
#include "stdafx.h"
#include "resource.h"
#include <stdio.h>
#include <windows.h>
HWND hEdit_hong;
HWND hEdit1;
HWND hEdit2;
HWND hEdit3;
int HongNum = 0;
HANDLE hThead_Main;
HANDLE hMutex;
DWOR...
// 20171227_01.cpp : Defines the entry point for the application.
//
#include "stdafx.h"
#include "resource.h"
#include <stdio.h>
#include <windows.h>
HWND hEdit_hong;
HWND hEdit1;
HWND hEdit2;
HWND hEdit3;
int HongNum = 0;
HANDLE hThead_Main;
CRITICAL_SECTION cs;
...
1 使用HWND
查找窗口:
HWND h_wnd = ::FindWindow(_T("MainForm"), NULL);
1
创建窗口:
HWND hwnd = WindowEx::Create(NULL, L"", WS_POPUP, WS_EX_TOOLWINDOW);
1
2 使用HANDLE
单例运行:
bool SingletonRun(const wchar_t *application)
{
assert(application);
if (applicati...
// 20171226_02.cpp : Defines the entry point for the application.
//
#include "stdafx.h"
#include "resource.h"
#include <stdio.h>
#include <windows.h>
HWND hEdit;
CRITICAL_SECTION cs1;
CRITICAL_SECTION cs2;
DWORD WINAPI ThreadProc1(
LPVOID lpParameter // thread data...
// 20171226_02.cpp : Defines the entry point for the application.
//
#include "stdafx.h"
#include "resource.h"
#include <stdio.h>
#include <windows.h>
HWND hEdit;
CRITICAL_SECTION cs;
DWORD WINAPI ThreadProc1(
LPVOID lpParameter // thread data
)
{
TCHAR numStr[10...