学习了,希望LZ继续,期盼您的这个系列。这本书一直没有时间买来看,读了LZ的文章真是受益匪浅。
re: PPC Today界面的开发心得 追梦时代 2008-03-20 15:47
@cohere
字体大小是在系统设置中设置主题字体大小的,程序中没法设置
re: IOCP Tips 追梦时代 2008-03-14 19:32
我关于避免多次调用WSARecv的做法是使用引用计数. 不知道大家是怎么做的
re: 智能指针的几点错误操作心得 追梦时代 2008-01-30 09:52
@free2000fly
并不完全赞同楼上的意见,基本原理其实我们都懂,但理论和实践毕竟是两码事,实践才会加深对知识的理解。
re: vs2005奇怪的断点无效问题 追梦时代 2008-01-30 09:23
我也遇到过相同的问题,也是断点无法跟进。解决方法是在断点之前加上MessageBox就可以了,原理未知
re: 别了,cppblog 追梦时代 2008-01-25 10:49
兄弟不要走,毕竟大多数人都不是高手,只是一些所谓的高手太喜欢高评了。如果我们这些菜鸟被高手打压后都选择逃避就不会进步了,那些高手就更猖狂了
re: MFC中一个容易被忽视的问题 追梦时代 2007-12-14 13:53
@vc
我做的是一个控制面板程序,之前会CRUSH掉的部分代码如下:
BOOL CStockF10SetDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
//Init contrl data
.......
//获得注册表的值
if(GetRegValues())
{
//更新没有值绑定的控件的显示
SetCtrlState();
//更新有值绑定的控件的显示
UpdateData(FALSE);
}
else
{
MessageBox("Get regedit values error!");
}
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CStockF10SetDlg::SetCtrlState()
{
//EnableForceSend
......
szTemp.Format("%02ld",gethour(m_nUpdateTime));
//将m_nUpdateTime这个时间值的小时部分显示到控件
GetDlgItem(IDC_UPDATETIMEH)->SetWindowText(szTemp);
szTemp.Format("%02ld",getminute(m_nUpdateTime));
//将m_nUpdateTime这个时间值的分钟部分显示到控件
GetDlgItem(IDC_UPDATETIMEM)->SetWindowText(szTemp);
}
由于这个时间值我把它放在小时和分钟两个控件中显示,所以没有绑定成员变量,直接通过资源号来显示数据的。代码运行到SetWindowText这里会CRUSH掉。
re: 关闭SOCKET时需注意的问题 追梦时代 2007-11-14 16:21
这里贴上MSDN对于shutdown的注意事项,shutdown不管SO_LINGER如何设置都不会堵塞。
The shutdown function is used on all types of sockets to disable reception, transmission, or both.
If the how parameter is SD_RECEIVE, subsequent calls to the recv function on the socket will be disallowed. This has no effect on the lower protocol layers. For TCP sockets, if there is still data queued on the socket waiting to be received, or data arrives subsequently, the connection is reset, since the data cannot be delivered to the user. For UDP sockets, incoming datagrams are accepted and queued. In no case will an ICMP error packet be generated.
If the how parameter is SD_SEND, subsequent calls to the send function are disallowed. For TCP sockets, a FIN will be sent after all data is sent and acknowledged by the receiver.
Setting how to SD_BOTH disables both sends and receives as described above.
The shutdown function does not close the socket. Any resources attached to the socket will not be freed until closesocket is invoked.
To assure that all data is sent and received on a connected socket before it is closed, an application should use shutdown to close connection before calling closesocket. For example, to initiate a graceful disconnect:
1. Call WSAAsyncSelect to register for FD_CLOSE notification.
2. Call shutdown with how=SD_SEND.
When FD_CLOSE received, call recv until zero returned, or SOCKET_ERROR.
3. Call closesocket.
Note The shutdown function does not block regardless of the SO_LINGER setting on the socket.
An application should not rely on being able to reuse a socket after it has been shut down. In particular, a Windows Sockets provider is not required to support the use of connect on a socket that has been shut down.
re: 关闭SOCKET时需注意的问题 追梦时代 2007-11-14 16:12
@heroboy
谢谢,刚测试了shutdown也可以解决问题
re: 关于sizeof()的简单解析 追梦时代 2007-11-14 12:52
“sizeof()括号中的所有的运算都是无效的”这点确实没有注意到