
C++
luoqiang0831
这个作者很懒,什么都没留下…
展开
-
创建事件用线程等候接受 CreateEvent 14.4.29
// Event.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include "windows.h"#include "conio.h"HANDLE g_hEvent=NULL;HANDLE g_hEvent2=NULL;//发送事件DWORD WINAPI T转载 2014-04-29 13:26:16 · 308 阅读 · 0 评论 -
绘制字体颜色 字体间距、斜体,字体嵌入 背景颜色等14.4.22
#include "stdafx.h" HINSTANCE g_hInst = NULL; void onPaint(HWND hWnd,UINT nMsg,WPARAM wParam,LPARAM lParam){ PAINTSTRUCT ps={0}; HDC hDC=BeginPaint(hWnd,&ps); //设置文字颜色 COLORREF nO原创 2014-04-22 11:27:32 · 549 阅读 · 0 评论 -
载入位图,逻辑坐标等14.4.21
// Zuoye1.cpp : Defines the entry point for the application.//#include "stdafx.h"#include "resource.h"HINSTANCE g_hInst = NULL;void DrawBmp(HDC hDC){ //第一个参数是 位图资源所在程序句柄 //第二个参数位图的名称 //返回一个原创 2014-04-21 20:46:37 · 318 阅读 · 0 评论 -
MFC 文件写入 读取 Flush等操作14.5.9
// MFCSerialize.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include "afxwin.h"void Store( ){ //打开文件 CFile file; file.Open( "c:\\serial.dat",转载 2014-05-09 10:55:16 · 717 阅读 · 0 评论 -
消息对话框 有模式 和 无模式的 静态框 点击事件等14.4.22
#include "stdafx.h" #include "resource.h"HINSTANCE g_hInst = NULL; void onPaint(HWND hWnd,UINT nMsg,WPARAM wParam,LPARAM lParam){ PAINTSTRUCT ps={0}; HDC hDC=BeginPaint(h原创 2014-04-22 15:40:27 · 404 阅读 · 0 评论 -
MFC MAP operator操作14.5.9
// MFCMap.cpp : Defines the entry point for the console application.//#include "afxwin.h"#include "afxtempl.h"class CAnimal:public CObject{public: int m_nLeg;public: CAnimal(int Leg=4); CAn转载 2014-05-09 10:56:28 · 374 阅读 · 0 评论 -
tcp/ip UDP 服务器、客户端的连接 14.5.14
SockCilent:// SockClient.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include "windows.h"#include "conio.h"//socket头文件#include "winsock2.h"//socket库的lib#转载 2014-05-14 19:16:23 · 418 阅读 · 0 评论 -
简单的自绘制按钮 和下拉列表的消息事件等 14.4.24
// WndConst.cpp : Defines the entry point for the application.//#include "stdafx.h"#include "iostream"HINSTANCE g_hInst = NULL;HANDLE g_hStdOut=NULL;HWND hSD=NULL;void onCreate(HWND hWnd,转载 2014-04-24 13:40:28 · 509 阅读 · 0 评论 -
文件的打开、复制、写入、创建、删除、获取设置 文件属性 查找文件 遍历文件夹等14.4.26
// WndPath.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include "windows.h"#include "stdlib.h"void Create(){ //创建文件 FILE_ATTRIBUTE_HIDDEN 隐藏属性 HANDLE hFil转载 2014-04-26 12:34:10 · 465 阅读 · 0 评论 -
进程的创建 获取信息 进程模块信息 结束等候进程 windows工作等14.4.28
// WndProcInfo.cpp : Defines the entry point for the console application.//#include "stdafx.h"#define _WIN32_WINNT 0x0500#include "windows.h"#include "conio.h"#include "../psapi/psapi.h"#转载 2014-04-28 14:44:42 · 405 阅读 · 0 评论 -
MFC CTreeCtrl CListCtrl使用14.5.20
HCURSOR CMFCTreeDlg::OnQueryDragIcon(){ return (HCURSOR) m_hIcon;}void CMFCTreeDlg::InitListCtrl(){ //设置图标 m_imgNormal.Create(MAKEINTRESOURCE(IDB_NORMAL), 48,48,RGB(0,0,0)); m_imgSmall.Create转载 2014-05-20 12:02:35 · 460 阅读 · 0 评论 -
线程原子锁用法 14.4.29
// ThreadyzLock1.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include "windows.h"#include "conio.h"long g_Value=0;long g_Value2=0;DWORD WINAPI InterProcl(L转载 2014-04-29 11:58:58 · 475 阅读 · 0 评论 -
线程创建、挂起、执行 TLS等14.4.28
// WndThread.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include "windows.h"#include "conio.h"#include "stdlib.h"char *g_pszText1=NULL;//TlS 避免了同时多个线程 操作一个转载 2014-04-29 09:53:51 · 432 阅读 · 0 评论 -
线程同时执行一个函数 使用临界区 14.4.29
// CriticalSection.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include "windows.h"#include "conio.h"//定义一个临界区值CRITICAL_SECTION g_cs={0};void Print(){ //进入转载 2014-04-29 12:28:21 · 382 阅读 · 0 评论 -
MFC 规则动态库加载AFX_MANAGE_STATE(AfxGetStaticModuleState())
在MFC动态库函数写好后需要在转载 2014-05-20 12:43:12 · 1011 阅读 · 0 评论 -
简单接口框架 InterlockedDecrement 14.5.21
多线程在使用情况下得使用yuan转载 2014-05-21 22:07:36 · 498 阅读 · 0 评论 -
MFC array使用
// MFCArray.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include "afxwin.h"#include "afxtempl.h"class CAnimal{public: CAnimal(int leg=4); int m_nLeg;转载 2014-05-07 12:09:59 · 619 阅读 · 0 评论 -
MFC画笔\画刷\加载位图\加载外部图片(LoadImage)\调色板\区域绘制、 复杂图像绘制等14.5.6
void CMFCGdiView::OnPen() { CClientDC dc(this); //初始化画笔 CPen Pen(PS_SOLID,10,RGB(0,255,0)); //保存旧的画笔 CPen *cOldPen=dc.SelectObject(&Pen); //画一个矩形框 dc.Rectangle(10,10,200,2转载 2014-05-06 21:50:31 · 739 阅读 · 0 评论 -
线程互斥、等候、重置等14.4.29
// Mutex.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include "windows.h"#include "conio.h"HANDLE g_nMutex=NULL;int g_ncount=0;DWORD WINAPI ThreadProcl1(LPV转载 2014-04-29 20:07:16 · 343 阅读 · 0 评论 -
创建定时器 和简单的了解了一下APC消息队列 14.4.29
// WaitTimer.cpp : Defines the entry point for the console application.//#include "stdafx.h"#define _WIN32_WINNT 0x0400#include "windows.h"#include "conio.h"HANDLE g_hTimer=NULL;VOID CALLBA转载 2014-04-29 20:05:49 · 402 阅读 · 0 评论 -
MFC 刚开始接触特别头疼
// CmdMsg.cpp : Defines the entry point for the application.//#include "stdafx.h"class CCmdFrame:public CFrameWnd{public:DECLARE_MESSAGE_MAP()public: //OnCreate必须要大写 一模一样 否则显示不出来 afx_msg int转载 2014-04-30 20:06:41 · 340 阅读 · 0 评论 -
线程信号量 释放 信号量队列等14.4.29
// Semaphore.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include "windows.h"#include "conio.h"HANDLE g_hSemaphore=NULL;DWORD WINAPI ThreadSend(LPVOID pParam转载 2014-04-29 20:08:58 · 421 阅读 · 0 评论 -
MFC View
// MFCView.cpp : Defines the entry point for the application.//#include "stdafx.h"#include "resource.h"class CMyView:public CView{public: virtual void OnDraw(CDC *pDC); DECLARE_MESSAGE_MAP()转载 2014-05-03 12:21:02 · 379 阅读 · 0 评论 -
MFC状态栏设置
#include "stdafx.h"#include "resource.h"UINT g_nIndicator[]={ ID_SEPARATOR, ID_SEPARATOR, ID_INDICATOR_NUM,//数字 等等 参数自己设定 ID_INDICATOR_OVR, ID_INDICATOR_CAPS, ID_INDICATOR_SCRL,};class MF转载 2014-05-03 12:20:00 · 651 阅读 · 0 评论 -
MFC VIEW多窗口分割使用 和CHtml等等14.5.4
// MFCqf.cpp : Defines the entry point for the application.//#include "stdafx.h"#include "resource.h"UINT nIdicatiors[]={ ID_SEPARATOR, ID_INDICATOR_NUM, ID_INDICATOR_REC};//创建VIE转载 2014-05-04 22:51:19 · 700 阅读 · 0 评论 -
MFC运行时类信息定义 (主要是能判断他的类关系) 类似于类的类型鉴定14.5.5
// Dyramic.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include "Dyramic.h"#include "conio.h"#ifdef _DEBUG#define new DEBUG_NEW#undef THIS_FILEstatic char转载 2014-05-05 19:38:35 · 463 阅读 · 0 评论 -
MFC 类的动态创建(类似于工厂模式)
// DTCJ.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include "DTCJ.h"#include "conio.h"#ifdef _DEBUG#define new DEBUG_NEW#undef THIS_FILEstatic char THIS_转载 2014-05-05 19:41:59 · 468 阅读 · 0 评论 -
MFC加载CDocView 类似于文本编辑器使用14.5.5
// MFCDoc.cpp : Defines the entry point for the application.//CDocTemplate#include "stdafx.h"#include "resource.h"class CMyDocument : public CDocument{public: CMyDocument( ); //我们加入了很多的消息转载 2014-05-05 19:36:32 · 533 阅读 · 0 评论 -
C++ 右键弹出菜单 标题栏弹出菜单 2014.4.19笔记
// SysMenu.cpp : Defines the entry point for the application.//#include "stdafx.h"#include "../WinMsg/user_function.h"HINSTANCE g_hInst = NULL;HANDLE g_nConsole=NULL;void onCreat原创 2014-04-19 23:24:52 · 1205 阅读 · 0 评论 -
MFC多文档窗口创建 窗口内容同步OnUpdate 14.5.6
// MFCMdiEx.cpp : Defines the entry point for the application.//#include "stdafx.h"#include "resource.h"class MFCMyDocument:public CDocument{ DECLARE_DYNCREATE(MFCMyDocument)public: C转载 2014-05-06 19:01:15 · 939 阅读 · 0 评论 -
MFC 单文档模板创建CEditView CSingleDocTemplate 14.5.5
// MFCSdi.cpp : Defines the entry point for the application.//#include "stdafx.h"#include "resource.h"class MFCSdiDocument:public CDocument{public: DECLARE_DYNCREATE(MFCSdiDocument)};IMPLEME转载 2014-05-05 22:32:55 · 797 阅读 · 0 评论 -
MFC向导建DC\CDC\CMetaFileDC\oPaint等绘制 14.5.6
void CTest1View::OnCdc() { // TODO: Add your command handler code here //针对整个屏幕的DC绘画 以屏幕为坐标 CDC dc; //创建一个显示器DC dc.CreateDC("DISPLAY",NULL,NULL,NULL); dc.Rectangle(50,50,500,500)转载 2014-05-06 20:47:09 · 532 阅读 · 0 评论 -
Paint 图形绘制 折线 点 弧线绘制 画笔 画刷14.4.20
// Zuoye1.cpp : Defines the entry point for the application.//#include "stdafx.h"#include "resource.h"#include "iostream"HINSTANCE g_hInst = NULL;int g_x1pos,g_y1pos,g_x2pos,g_y2pos;int g_nDre原创 2014-04-20 23:16:23 · 557 阅读 · 0 评论 -
MFC多文档创建 CMultiDocTemplate CMDIChildWnd CMDIFrameWnd 14.5.5
// MFCSdi.cpp : Defines the entry point for the application.//#include "stdafx.h"#include "resource.h"class CMdiDocument:public CDocument{ //把这几个都写成可以动态创建的 DECLARE_DYNCREATE(CMdiDocument转载 2014-05-05 23:19:01 · 684 阅读 · 0 评论 -
组件接口调用IDL IUnknown 14.5.22
IDL math.idl文件如下:import "objidl.idl";[ object, uuid(C9BAF4B4-0637-404e-824A-631F5B80FED5)]//生成的时候要在项目设置里面MIDL选项里吧MKTYPLIB..兼容给取消interface IMath:IUnknown{ HRESULT Add(long nAdd1,long nAdd2,l转载 2014-05-22 22:40:36 · 419 阅读 · 0 评论