// LinkedList.h: interface for the LinkedList class. // ////////////////////////////////////////////////////////////////////// #if !defined(AFX_LINKEDLIST_H__4B3074E8_FF2A_4FDE_9798_A2DEC76350C0__INCLUDED_) #define AFX_LINKEDLIST_H__4B3074E8_FF2A_4FDE_9798_A2DEC76350C0__INCLUDED_ #if _MSC_V...

阅读全文>>

// Vector.h: interface for the Vector class. // ////////////////////////////////////////////////////////////////////// #if !defined(AFX_VECTOR_H__4269F728_802C_48DF_A3E7_71483AA2CDA7__INCLUDED_) #define AFX_VECTOR_H__4269F728_802C_48DF_A3E7_71483AA2CDA7__INCLUDED_ #if _MSC_VER > 1000 #p...

阅读全文>>

对于计算机程序设计而言,变量和对象在内存中的分配都是编译器在编译程序时安排好的,这带来了极大的不便,如数组必须大开小用,指针必须指向一个已经存在的变量或对象。对于不能确定需要占用多少内存的情况,动态内存分配解决了这个问题。     new和delete运算符是用于动态分配和撤销内存的运算符。 一、new用法 1.开辟单变量地址空间    使用new运算符时必须已知数据类型,new运算符会向系统堆区申请足够的存储空间,如果申请成功,就返回该内存块的首地址,如果申请不成功,...

阅读全文>>

很全面的总结, 转载:  https://wuyuans.com/2012/09/cpp-operator-overload 文章如下 c++的一大特性就是重载(overload),通过重载可以把功能相似的几个函数合为一个,使得程序更加简洁、高效。在c++中不止函数可以重载,运算符也可以重载。由于一般数据类型间的运算符没有重载的必要,所以运算符重载主要是面向对象之间的。 1.一般运算符重载 在进行对象之间的运算时,程序会调用与运算符相对应的函数进行处理,所以运算符重载有两种方式...

阅读全文>>

// 20171122_01.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include "windows.h" #include "stdlib.h" #include "iostream.h" #include <stdio.h> struct Base{ virtual void Fn1() { printf("Base:Fn1111\n"); } virtual void Fn2() { p...

阅读全文>>

// 20171122_01.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include "windows.h" #include "stdlib.h" #include "iostream.h" #include <stdio.h> struct Base{ int a; int b; virtual void Fn1() { printf("1111\n"); } virtual void Fn2...

阅读全文>>

1 \ 生成dll文件 myDll.h // MyDll.h: interface for the MyDll class. // ////////////////////////////////////////////////////////////////////// #if !defined(AFX_MYDLL_H__E6C7930C_99AF_46AF_B08E_42EDB1680395__INCLUDED_) #define AFX_MYDLL_H__E6C7930C_99AF_46AF_B08E_42EDB...

阅读全文>>

#include "stdio.h" #include "windows.h" unsigned char arr[]={ 0x55, 0x8B,0xEC, 0x83,0xEC,0x40, 0x53, 0x56, 0x57, 0x8D,0x7D,0xC0, 0xB9,0x10,0x00,0x00,0x00, 0xB8,0xCC,0xCC,0xCC,0xCC, 0xF3,0xAB, 0x8B,0x45,0x08, 0x03,0x45,0x0C, 0x5F, 0x5E, 0x5B, 0x8B,0xE5, 0x5D, 0...

阅读全文>>

最简单的代码: //裸函数 void __declspec(naked) testGyarmy() { __asm{ ret } } //加法 //裸函数加法 int __declspec(naked) testGyarmyPlus(int x,int y) { __asm{ //提升堆栈 push ebp mov ebp,esp sub esp,0x40 //保存现场 push ebx push esi push edi ...

阅读全文>>

vc++基础班[15]---通用对话框讲解 ------------------------------------------ Begin ---------------------------------------- ①、文件选择对话框; //单选; CFileDialog fileDlg(TRUE, NULL, NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT , _T("Text Files (*.txt)|*.txt|WinRar Files (*.rar)|*.rar|Data Files (*.xlc;*.xls)|*.xlc; ...

阅读全文>>

vc++基础班[14]---再论“逃跑”按钮的实现 ------------------------------------------ Begin ---------------------------------------- ①、CWnd::GetWindowRect 与 CWnd::GetClientRect 的区别:(获取当前窗口) GetWindowRect 函数:屏幕坐标系,同时包括窗口的标题栏与边框的大小; GetClientRect 函数:本身窗口坐标系,左上角坐标始终为(0, 0),不包括窗口标题与边框的大小; 全局的 SDK API 函数:(获取指定窗口) ...

阅读全文>>

头文件: (MyROEdit.h) #pragma once // CMyROEdit class CMyROEdit : public CEdit { DECLARE_DYNAMIC(CMyROEdit) public: CMyROEdit(); virtual ~CMyROEdit(); protected: DECLARE_MESSAGE_MAP() public: virtual BOOL PreTranslateMessage(MSG* pMsg); afx_msg void OnEnSetfocus(); }; ...

阅读全文>>

vc++基础班[13]---控件自定义消息的响应 ------------------------------------------ Begin ---------------------------------------- 控件自定义消息的响应: ①、响应按钮控件的右键消息; 1> 向工程当中添加一个派生自CButton类的子类CMyButton; 2> 为按钮绑定一个CMyButton类型的控件类型变量; 3> 响应CMyButton类的你想响应的消息; ②、响应Static控件的双击消息; ③、自定义编辑框控件只读、颜色不变灰。 -------...

阅读全文>>

vc++基础班[12]---注册全局系统热键 ------------------------------------------ Begin ---------------------------------------- ①、注册全局系统热键的优点: 即使程序的窗口不是当前活动窗口、或者窗口最小化、隐藏后,也都可以响应热键; 比如QQ软件的默认呼出热键:Ctrl+Alt+Z 就是注册了全局系统热键; ②、注册窗口全局系统热键的步骤: 1> 调用 RegisterHotKey 函数注册全局系统热键; BOOL RegisterHotKey(   &nb...

阅读全文>>

vc++基础班[11]---对话框程序响应组合按键 ------------------------------------------ Begin ---------------------------------------- ①、利用 GetKeyState 函数获得某一按键的按下、弹起状态; #define IsKeyPressed(nVirtKey)  ((GetKeyState(nVirtKey) & (1<<(sizeof(SHORT)*8-1))) != 0) #define IsKeyToggled(nVirtKey)  ((G...

阅读全文>>