本站首页    管理页面    写新日志    退出


«August 2025»
12
3456789
10111213141516
17181920212223
24252627282930
31


公告

谦卑,荣誉,牺牲,英勇,怜悯,诚实,精神,公正。


我的分类(专题)

日志更新

最新评论

留言板

链接

 

 


Blog信息
blog名称:
日志总数:183
评论数量:698
留言数量:7
访问次数:3023317
建立时间:2005年12月29日




[我的笔记]笔记3.9
读书笔记

newqiang 发表于 2006/3/10 9:22:41

1.设置显示器分辨率void CMainFrame::SetStartMode(){    DEVMODE lpDevMode;    lpDevMode.dmPelsHeight=768;    lpDevMode.dmPelsWidth=1024;    lpDevMode.dmDisplayFrequency=85;//设置显示频率    lpDevMode.dmFields=DM_PELSWIDTH|DM_PELSHEIGHT|DM_DISPLAYFREQUENCY;    ChangeDisplaySettings(&lpDevMode,0);     this->BringWindowToTop();} 2开机自动运行程序void CMainFrame::EnableAutoStart()//设置程序自动开机运行{    CString sPath;        int nPos;    HKEY RegKey;    GetModuleFileName(NULL,sPath.GetBufferSetLength(MAX_PATH+1),MAX_PATH);    sPath.ReleaseBuffer();    nPos=sPath.ReverseFind('\\');    sPath=sPath.Left(nPos);    CString lpszFile=sPath+"\\YbkDemo.exe";    CFileFind fFind;    BOOL bSuccess;    bSuccess=fFind.FindFile(lpszFile);    fFind.Close();    if(bSuccess)    {        CString fullName;        fullName=lpszFile;        RegKey=NULL;        RegOpenKey(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\Windows\\CurrentVersion\\Run",&RegKey);        RegSetValueEx(RegKey,"彭水白云监控系统",0,REG_SZ,(const unsigned char*)(LPCTSTR)fullName,fullName.GetLength());        this->UpdateData(FALSE);    }    else    {         ::AfxMessageBox("没找到执行程序,自动运行失败");        exit(0);    }}//其中RegOpenKey()和RegSetValueEx()是修改注册表的函数。 3.触发VIEW的WM_PAINT消息,进行背景位图的显示void CYbkDemoView::OnPaint() {    CPaintDC dc(this); // device context for painting        CRect rect;    GetClientRect(&rect);     HBITMAP hbitmap;     hbitmap=::LoadBitmap(::AfxGetInstanceHandle(),MAKEINTRESOURCE(IDB_MAIN));     HDC hMenDC=::CreateCompatibleDC(NULL);    SelectObject(hMenDC,hbitmap);    ::StretchBlt(dc.m_hDC,0,0,1024,768,hMenDC,0,0,1024,768,SRCCOPY);    ::DeleteDC(hMenDC);    ::DeleteObject(hbitmap);}  


阅读全文(4858) | 回复(0) | 编辑 | 精华
 



发表评论:
昵称:
密码:
主页:
标题:
验证码:  (不区分大小写,请仔细填写,输错需重写评论内容!)



站点首页 | 联系我们 | 博客注册 | 博客登陆

Sponsored By W3CHINA
W3CHINA Blog 0.8 Processed in 0.031 second(s), page refreshed 144757804 times.
《全国人大常委会关于维护互联网安全的决定》  《计算机信息网络国际联网安全保护管理办法》
苏ICP备05006046号