月度归档: 2010 年 8 月

  • linux在自己的用户目录下安装VIM插件

    在根目录下创建:

    mkdir ~/.vim/plugin

    mkdir ~/.vim/doc

    然后把插件放到plugin目录下,说明文档放到doc目录下即可

  • VC 使用命令行编译

    VC 使用命令行编译,创建批处理命令如下:

    @echo off
    
    taskkill /f /im MyAssistant.exe
    set path=D:/Program Files/Microsoft Visual Studio 9.0/Common7/IDE;%Systemroot%;%systemroot%/system32;
    set name=MyAssistant
    set outname=MyAssistant.exe
    
    devenv /Rebuild Release "MyAssistant.sln"  /project "MyAssistant.vcproj" /projectconfig Release
    pause
  • VC 屏幕截图

    VC++实现屏幕截图:

    void CScreenDlg::OnPaint()
    {
    	CClientDC dc(this); 
    	// 获取屏幕DC
    	HDC hScrDC = ::GetDC(NULL);
    	// 得到屏幕分辨率  
    	INT nHeight = GetDeviceCaps(hScrDC, VERTRES);
    	INT nWidth = GetDeviceCaps(hScrDC, HORZRES);  
    	// 创建屏幕DC的兼容DC
    	HDC hMemDC1 = CreateCompatibleDC(hScrDC);
    	// 创建屏幕兼容位图
    	HBITMAP hBitmap1 = CreateCompatibleBitmap(hScrDC, nWidth, nHeight);
    	// 把兼容位图选入兼容DC
    	HBITMAP hBitmap2 = (HBITMAP)SelectObject(hMemDC1, hBitmap1);
    	// 复制DC
    	BitBlt(hMemDC1, 0, 0, nWidth, nHeight, hScrDC, 0, 0, SRCCOPY);
    	// 显示
    	BitBlt(dc.GetSafeHdc(), 0, 0, nHeight, nWidth, hMemDC1, 0, 0, SRCCOPY);
    	::DeleteObject(hBitmap1);
    	::DeleteDC(hMemDC1);
    	__super::OnPaint();
    }