vc网络编程转帖
[setsockopt 设置socket 详细用法]http://www.cppblog.com/killsound/archive/2009/01/16/72138.html
[ setsockopt()用法(参数详细说明)]http://blog.csdn.net/chary8088/archive/2008/05/27/2486377.aspx
[如何实现点击菜单里的子菜单时,弹出对话框]
1.先画好对话框
2.为对话框建立类:在对话框空白处右击,点建立类向导,选择“建立新类”
3.给菜单选项添加函数:鼠标在菜单项上右击,点建立类向导,这时在左栏里选菜单项ID,右栏选COMMAND,点右边按钮“ADD FUNCTION”,再点“EDIT CODE”在函数里写(假设对话框类为Info_Dialog):
Info_Dialog infodlg;
infodlg.DoModal();
这样就可以实现弹出对话框了。
在OnInitDialog中添加:
CRect temprect(0,0,640,480);
CWnd::SetWindowPos(NULL,0,0,temprect.Width(),temprect.Height(),SWP_NOZORDER|SWP_NOMOVE);
[设置文档初始大小]在MainFrame的PreCreateWindow里面设置cs的cx与cy。
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if( !CFrameWnd::PreCreateWindow(cs) )
return FALSE;
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
cs.cx = 330;
cs.cy = 100;
return TRUE;
}
[设计了一个基于窗口的应用程序,其中会出现一个自定义的对话框,但其默认位置出现在左上角,如何才能将对话框的位置设置成居中]也是在::OnInitDialog()内设置
CenterWindow(CWnd::GetDesktopWindow()); //在桌面的居中位置
CWnd::CenterWindow( );//这个是在父容器的居中位置
AfxGetMainWnd()->CenterWindow();//这个将父容器也设为居中了
[error]unexpected end of file while looking for precompiled header directive
右键点工程名,选设置,然后选c/c++属性页,再选catagory选单中选 precompiled header ,将选项置成no use 或者autometic
然后再发现错误。

回复 2011-5-28 17:40:27 by ivy
回复 2011-6-1 19:06:49 by hyy