 |
求教有关Sleep在线程中的使用
|
|
| |
| ...☆─────────────────────────────────────☆
kingfaint (强烈喜欢赵敏) 于 (Fri Mar 19 16:49:24 2004) 提到:
MSDN中明明说sleep一段时间后返回,线程继续执行,但是我在实际使用时发现只要自己开
个线程,在里面用Sleep,,就直接返回主线程,不知是何缘故
☆─────────────────────────────────────☆
YTTIKOLLEH (钻石恒久远,一颗永流传) 于 (Fri Mar 19 16:52:47 2004) 提到:
最好跟踪一下
【 在 kingfaint (强烈喜欢赵敏) 的大作中提到: 】
: MSDN中明明说sleep一段时间后返回,线程继续执行,但是我在实际使用时发现只要自己
开个线程,在里面用Sleep,,就直接返回主线程,不知是何缘故
...
|
|
| 作者:不祥 lucy张贴于2007-03-09 11:13:24.0,共阅读1804次,回复0次 |
|
|
 |
CWnd派生类使用加速键
|
|
| |
| //给派生类加入
HACCEL m_hAccelTable;
m_hAccelTable=::LoadAccelerators(AfxGetInstanceHandle(),
MAKEINTRESOURCE(IDR_ACCELERATORS));
//重载CWnd::PreTranslateMessage
BOOL CMainWindow::PreTranslateMessage(MSG* pMsg)
{
if(CWnd::PreTranslat
|
|
| 作者:不祥 bluejoe张贴于2006-01-01 00:00:00.0,共阅读1163次,回复0次 |
|
|
 |
Windows中读磁盘扇区
|
|
| |
| <1>BIOS的INT13,DOS的INT26(绝对读),INT26(绝对写)。
C语言中的函数:biosdisk, absread, abswrite.
<2>WIN95/98种VWIN32服务,只能读软盘,不能读硬盘
HANDLE hDev=CreateFile("\\\\.\\VWIN32",0,0,0,0,FILE_FLAG_DELETE_ON_CLOSE,NULL);
//...填充寄存器
B
|
|
| 作者:不祥 bluejoe张贴于2006-01-01 00:00:00.0,共阅读1299次,回复0次 |
|
|
 |
编写可串行化类的方法
|
|
| |
| //ClassWizard产生一个从CCmdTarget派生的类
//手工修改为从CObject派生
//去掉消息映射宏
//SERIAL宏对
DECLARE_SERIAL(CWidgetObj)
IMPLEMENT_SERIAL(CWidgetObj, CObject,1)
//重载Serialize函数
virtual void Serialize(CArchive& ar);
void CWidgetObj:
|
|
| 作者:不祥 bluejoe张贴于2006-01-01 00:00:00.0,共阅读1101次,回复0次 |
|
|
 |
IDE编译器的设置
|
|
| |
| 设置栈的大小:
工程->Link卡->Y分类 Output->叠存分配
---------------------------------------
设置多线程:
vc/project/setting//c++ set the multithread
---------------------------------------
如何在编译时禁止某类warning信息?
#pragma warning
|
|
| 作者:不祥 bluejoe张贴于2006-01-01 00:00:00.0,共阅读1348次,回复0次 |
|
|
 |
如何添加SplashScreen
|
|
| |
| 1.Project->Add to Project & Controls->Visual C++ Components->Splash Screen
2.OnInitInstance()中,将m_pMainWnd->ShowWindow(SW_SHOW);
改为m_pMainWnd->ShowWindow(SW_HIDE);
3.CSplashWnd::Create()中,将(从资源装入256色图像) if(!m_bitmap
|
|
| 作者:不祥 bluejoe张贴于2006-01-01 00:00:00.0,共阅读1331次,回复0次 |
|
|
 |
如何写参数个数可变的函数
|
|
| |
| #include <stdio.h>
#include <tchar.h>
HWND g_hwndLB; //列表框句柄
//下面函数把格式化字符串写入列表框
//带...函数参数的范例
void AddStr(LPCTSTR szFmt,...)
{
TCHAR szBuffer[150];
int nIndex;
va_list va_params;
va_start(v
|
|
| 作者:不祥 bluejoe张贴于2006-01-01 00:00:00.0,共阅读1161次,回复0次 |
|
|
 |
如何动态分配多维数组
|
|
| |
| new
delete
---------------------------------
//分配一个二维数组
//相当于int p[nRow][nCol];
int** p=new int*[nRow];
p[0]=new int[nRow*nCol];
for(i=1;i<nRow)p[i]=p[i-1]+nCol;
//释放二维数组
if(p)
{
if(p[0])delete[] p[0];
delet
|
|
| 作者:不祥 bluejoe张贴于2006-01-01 00:00:00.0,共阅读1372次,回复0次 |
|
|
 |
如何编写屏幕保护程序
|
|
| |
| MSDN中有个例子
\Samples\Vc98\Mfc\General\Saver
这是一个基于对话框的程序
在CxxApp::InitInstance()中确定打开方式
屏保程序有三种打开方式:
1,设置对话框;
2,小窗口预览;
3,全屏显示。
if(__argc==1||Match(__argv[1],_T("c")))//Match()是自编
|
|
| 作者:不祥 bluejoe张贴于2006-01-01 00:00:00.0,共阅读1371次,回复0次 |
|
|
 |
如何才能使C++程序运行时不显示那个字符界面的黑窗口
|
|
| |
| 方法一:
main ()
{
FreeConsole ();
.....
};
这样的话,就没有窗口啊,不过会看到窗口一闪然后消失了
方法二:
#pragma comment (linker, "/subsystem:windows")
#ifdef _UNICODE
#pragma comment (linker, "/entry:wmainCRTStartup")
#else
|
|
| 作者:peach bluejoe张贴于2006-01-01 00:00:00.0,共阅读1278次,回复0次 |
|
|
 |
如何在已知窗口句柄的情况下获得对应线程ID
|
|
| |
| GetWindowThreadProcessId
The GetWindowThreadProcessId function retrieves the identifier of the thread that created the specified window and, optionally, the identifier of the process that created the window.
DWORD GetWindowThreadProcessId(
HWND h
|
|
| 作者:hamxj bluejoe张贴于2006-01-01 00:00:00.0,共阅读1250次,回复0次 |
|
|
 |
如何使用Crypto API实现加密
|
|
| |
| 应用程序使用Crypto API进行加密通信的一般步骤如下:
1,include wincrypt.h
2,调用CryptAcquireContext()获得某个CSP模块中的密钥容器(key container)的一个句柄;
3,发送方使用CryptImportKey()将接受方的证书导入CSP中,从而获得接收方的公钥;
4,发送方式
|
|
| 作者:不祥 bluejoe张贴于2006-01-01 00:00:00.0,共阅读1921次,回复0次 |
|
|