MFC&Win32
火麒噬日
这个作者很懒,什么都没留下…
展开
-
CreateThread
DWORD WINAPI ThreadFunc1(LPVOID lpmess) //一定要符合这种规范 { return 0; //最后不要忘记返回一个DWORD }HANDLE handle = CreateThread(NULL,0,ThreadFunc1,p,0,NULL); //成功的话返回一个县城句柄 if(!handle){ AfxMessageB原创 2009-07-13 10:55:00 · 547 阅读 · 0 评论 -
替换exe文件资源
int ReplaceDLLBitmapResource( LPCWSTR pszDLLFile, WORD dwResourceID, LPCWSTR pszBitmapFile ) { CFile f; CFileException e; USES_CONVERSION; if( ! f转载 2010-01-11 12:00:00 · 3318 阅读 · 0 评论 -
UTF-8转GBK
bool DemoDlg::UTF8ToGB(CString &szOut ,CString str){WCHAR *strSrc;TCHAR *szRes;int i = MultiByteToWideChar(CP_UTF8, 0, str, -1, NULL, 0);strSrc = new WCHAR[i+1];MultiByteToWideChar(CP_UTF8原创 2009-12-21 11:39:00 · 916 阅读 · 0 评论 -
AVI example code for creating AVI files
AVI example code for creating AVI files(c) 2002 Lucian Wischik. This code is free, and anyone can do with it whatever they like, including incorporating it in commercial products.This code is conc转载 2009-12-15 18:07:00 · 1444 阅读 · 0 评论 -
vc播放声音文件
一.播放声音文件的简单方法 在VC++ 中的多媒体动态连接库中提供了一组与音频设备有关的函数。利用这些函数可以方便地播放声音。最简单的播放声音方法就是直接调用VC++中提供的声音播放函数BOOL sndPlaySound ( LPCSTR lpszSound,UINT fuSound ); 或BOOL PlaySound( LPCSTR lpszSound, HMODULE hmod, DWOR转载 2009-11-17 16:14:00 · 1582 阅读 · 0 评论 -
AVI example code for creating AVI files
(c) 2002 Lucian Wischik. This code is free, and anyone can do with it whatever they like (except sell it or claim ownership).This code is concerned with creating AVI files, including video and au转载 2009-11-17 12:16:00 · 1356 阅读 · 0 评论 -
win32加载jpg
#include #include #include using namespace std;bool loadFile(char *fileName,char **imageBuffer1,int &size){ fstream fs1; fs1.open(fileName,ios_base::in|ios_base::binary); fs1.seek原创 2009-11-04 09:51:00 · 2570 阅读 · 0 评论 -
Win32中实现类似MFC中TRACE的函数
#include #include #include #include void LogTrace(LPCTSTR pszFormat, ...){ va_list pArgs; char szMessageBuffer[16380]={0}; va_start( pArgs, pszFormat ); _vsntprintf原创 2009-10-20 14:13:00 · 4564 阅读 · 2 评论 -
SO_REUSEADDR例解
网友vmstat多次提出了这个问题:SO_REUSEADDR有什么用处和怎么使用。而且很多网友在编写网络程序时也会遇到这个问题。所以特意写了这么一篇文章,希望能够解答一些人的疑难。 其实这个问题在Richard Stevens的《Unix网络编程指南》卷一里有很详细的解答(中文版P166-168页)。这里我只是写几个基本的例子来验证这个问题。 首先声明一个问题:当两个s原创 2009-10-08 17:34:00 · 807 阅读 · 0 评论 -
WinPro偷梁换柱
hr = ::SetWindowLongPtr(m_container,GWLP_WNDPROC,(LONG_PTR)WndProc2); if(hr) { ::MessageBox(NULL,"Ok",NULL,NULL); } else { ::MessageBox(NULL,"False",NULL,NULL); }原创 2009-07-15 15:48:00 · 567 阅读 · 0 评论 -
用VC创建进程和线程
if( !CreateProcess( NULL, // No module name (use command line). TEXT("test.exe"), // Command line. NULL, // Process handle not inheritable. NULL, // Thread handle no原创 2009-07-03 09:49:00 · 664 阅读 · 0 评论 -
进程内键盘钩子
HHOOK g_hKeyboard = NULL;LRESULT CALLBACK KeyboardProc(int code,WPARAM wParam,LPARAM lParam){ BOOL bKeyUp = lParam & (1 BOOL bKeyDown = lParam & (1 if(bKeyDown&& code == HC_ACTION) { switch(wP原创 2009-09-02 13:46:00 · 1055 阅读 · 0 评论 -
一些常用的系统函数点滴汇总
获取桌面分辨率:GetSystemMetrics(SM_CXSCREEN); GetSystemMetrics(SM_CYSCREEN);原创 2009-07-22 08:58:00 · 493 阅读 · 0 评论 -
资源文件读取_文件
导读: 有时我们会在资源里加上一些文件,BMP、ICON、WAVE等文件读取时没什么问题,主要的区别在于RT_TOOLBAR,RT_MENU,RT_...HINSTANCE hInst = AfxFindResourceHandle(lpszResourceName, RT_TOOLBAR);HRSRC hRsrc = ::FindResource(hInst, lpszResourc转载 2010-01-11 11:59:00 · 779 阅读 · 0 评论