随笔分类 - VC++/QT
摘要:m_p.SetRange(0,1000);m_p.SetStep(1);for (int i=0;i<1001;i++){m_p.SetPos(i);Sleep(10);MSG msg;while(PeekMessage(&msg,NULL,0,0,PM_REMOVE)){TranslateMessage(&msg);DispatchMessage(&msg);}}AfxMessageBox("OK");
阅读全文
摘要:string类的构造函数:string(const char *s); //用c字符串s初始化string(int n,char c); //用n个字符c初始化string类的字符操作:const char &operator[](int n)const;const char &at(int n)const;char &operator[](int n);char &at(int n);operator[]和at()均返回当前字符串中第n个字符的位置,但at函数提供范围检查,当越界时会抛出out_of_range异常,下标运算符[]不提供检查访问。const c
阅读全文
摘要://MDLL.h#include "If.h"typedef struct _SS{ int a; int b;}SS;class CMDLL :public IfC{public: CMDLL(void); int a() { SS s; x=30; s.a=10; return s.a; } int b() { return 20; } int hh;};//Fa.h#include "If.h"class MDLL_API CFa{public:CFa(void);~C...
阅读全文
摘要:在头文件中声明函数例如 afx_msg void onNum(UINT uID)在.cpp文件中添加函数体 void CCalculatorDlg::OnNum(UINT uID) { UINT index=uID-IDC_NUM_0; CString num; num.Format(_T("%d"),index); AfxMessageBox(num); }添加消息映射 ON_CONTROL_RANGE(BN_CLICKED,IDC_NUM_0,IDC_NUM_9,OnNum) 第一个参数 事件 第二个参数 控件的第一个id 第三个参数 空间的最后一个id 第四个参...
阅读全文
摘要:int maxlen=1024*1024; std::vector<byte> buf; FILE* f= fopen( "c:/f.jpg", "rb" ); string signature(maxlen, ' '); maxlen = fread( &signature[0], 1, maxlen, f ); fclose(f); buf.resize(maxlen); signature = signature.substr(0, maxlen); memcpy(&buf[0],&signatu
阅读全文
摘要:stdafx.h 加入#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
阅读全文
摘要:#include "stdafx.h"#include <cv.h> #include <highgui.h> IplImage *Image1; CvPoint PointArray1[6]; CvPoint PointArray2[4]; CvScalar Color; int PolyVertexNumber; int Shift; int main() { CvSize ImageSize1 = cvSize(1000,700); Image1 = cvCreateImage(ImageSize1, IPL_DEPTH_8U, 3); Ipl
阅读全文
摘要:IplImage* cvGetSubImage(IplImage *image, CvRect roi){IplImage *result;// 设置 ROIcvSetImageROI(image,roi);// 创建子图像result = cvCreateImage( cvSize(roi.width, roi.height), image->depth, image->nChannels );cvCopy(image,result);cvResetImageROI(image);return result;}
阅读全文
摘要:voidBitMatToWnd(CWnd* pWnd, cv::Mat img, CRect *Roi){ if(img.empty()) return; CRect drect; pWnd->GetClientRect(drect); //(drect); (&drect); 两种方式均可,竟然 CClientDC dc(pWnd); HDC hDC =dc.GetSafeHdc(); //内存中的图像数据拷贝到屏幕上 BYTE *bitBuffer = NULL; BITMAPINFO *bitMapinfo =...
阅读全文
摘要:opencv\modules\core\include\opencv2\core\version.hpp修改:#define CV_MAJOR_VERSION 2#define CV_MINOR_VERSION 4#define CV_SUBMINOR_VERSION 0opencv配置:opencv\cmake目录下
阅读全文
摘要:创建:CMFCPropertyGridCtrl m_wndPropList ;CRect rectDummy;rectDummy.SetRectEmpty ();if (!m_wndPropList .Create (WS_VISIBLE | WS_CHILD, rectDummy, this, 1)){ TRACE0("Failed to create Properies Grid \n"); return -1; // fail to create}m_wndPropList.EnableHeaderCtrl (FALSE);//标头m_wndPropList.Enab
阅读全文
摘要:1) 在View中获得Doc指针 CYourSDIDoc *pDoc=GetDocument();一个视只能有一个文档。 2) 在App中获得MainFrame指针 CWinApp 中的 m_pMainWnd变量就是MainFrame的指针 也可以: CMainFrame *pMain =(CMainFrame *)AfxGetMainWnd(); 3) 在View中获得MainFrame指针 CMainFrame *pMain=(CmaimFrame *)AfxGetApp()->m_pMainWnd; 4) 获得View(已建立)指...
阅读全文
摘要:安装OPENCV安装CMAKE设置如下勾上 INSTALL_C_EXAMPLES点Configure点 Generate就会生成VS2010工程选中自己感兴趣的例子编译即可。
阅读全文
摘要:使用CWinApp类的WriteProfileString、GetProfileString等函数。1、如果不调用SetRegistryKey(),CWinApp 会把信息保存系统目录的的Test.ini文件中(C:\Windows\Test.ini)2、如果调用SetRegistryKey(<company name>),CWinApp 会把信息保存系统目录的的注册表中HKEY_CURRENT_USER\Software\<company name>\Test\<section name>\<value name>.注:SetRegistryK
阅读全文
摘要:弹出非模态对话框很简单,使用Create+ShowWindow就好了。但是如果在线程中这样做,那可是有问题的~(可以自己去试试)所以,我们就需要自定义消息映射和函数,通过SendMessage来创建非模态对话框。使用非模态对话框切记要懂得及时销毁,否则产生大量野指针就坏了!建立非模态对话框代码:123CMyDlg *myDlg=new CMyDlg(); // CMyDlg为对应对话框类myDlg->Create(IDD_MY,NULL); // IDD_MY为对应对话框ID号myDlg->ShowWindow(SW_SHOW);在线程中建立非模态对话框代码:自定义一条消息,在线程
阅读全文
摘要:#include "stdafx.h"#include "windows.h"class CLock{private: CRITICAL_SECTION m_section;public: CLock(void) { InitializeCriticalSection(&m_section); } ~CLock(void) { DeleteCriticalSection(&m_section); } void lock() { EnterCriticalSection(&m_section); } void unLock() {
阅读全文
摘要:extern int __argc;extern TCHAR** __argv;修改为:调试,静态库 MFC 应用程序的"调试 Multithreaded"。发行版中,静态库的 MFC 应用程序的"Multithreaded"。
阅读全文
摘要:Runtime Library四个选项的含义:(D表示Dll,而d表示debug版本)MT(Multi-threaded):多线程版本MTd(Multi-threaded debug):多线程调试版本MD(Multi-threaded Dll):多线程Dll版本MDd(Multi-threaded debugdebug):多线程调试Dll版本正常情况下,当我们用VC编译出一个Console/Win32类型项目的exe程序时(这里暂不考虑MFC程序),会依赖于msvcrxx.dll文件(xx为不同VC对应的版本号,VC2005为80,VC2008为90,VC2010为100),发布程序的时候,就
阅读全文
摘要:下载地址:http://sourceforge.net/projects/gsoap2官方网站:http://genivia.com/Products/gsoap/index.html工程: http://files.cnblogs.com/ahuo/gsoap.rar生成代码:soapcpp2.exe add.h
阅读全文
摘要:voidclrscr(intx,inty){HANDLEhConsole=GetStdHandle(STD_OUTPUT_HANDLE);//MyCls(hStdOut);//HANDLEhConsole=hStdOut;COORDcoordScreen={x,y};//设置清屏后光标返回的屏幕左上角坐标BOOLbSuccess;DWORDcCharsWritten;CONSOLE_SCREEN_BUFFER_INFOcsbi;//保存缓冲区信息DWORDdwConSize;//当前缓冲区可容纳的字符数bSuccess=GetConsoleScreenBufferInfo(hConsole,&
阅读全文
浙公网安备 33010602011771号