TimeStamp | You'll be challenged,inspired,motivated and humbled.nirvana

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(); 

这样就可以实现弹出对话框了。


[MFC中设置对话框的大小]

在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
然后再发现错误。

Posted by timestamp @ 2011-5-28 14:19:28 阅读(482) 评论(2)
上一篇:=====
下一篇:微软图标控件MsChart

Feedback

  1. 回复 2011-5-28 17:40:27 by ivy

    if you list more detail info,that'll be more helpful to your readers.
  2. 回复 2011-6-1 19:06:49 by hyy

    @ivy:嗯 。我在看别人的博客时就有这种感受~~~  谢谢建议啦~
你还可以输入600/600个字符 发表评论
称呼: (必填) 登录 | 开通博客
邮箱: (选填) 你的邮箱地址不会被公开
网站: (选填)
验证码: (必填)