字体+窗口+进程
CPaintDC dc(this);// device context for painting CRect rtClient; GetClientRect(rtClient); //获取客户区尺寸、位置信息 /////// 利用CFont::CreateFont(...)函数实现竖写汉字//////// CFont myFont; //创建字体对象 //创建逻辑字体 myFont.CreateFont(40, //字体高度(旋转后的字体宽度)=56 10, //字体宽度(旋转后的字体高度)=20 2700, //字体显示角度=270° 0, //nOrientation=0 6, //字体磅数=10 FALSE, //非斜体 FALSE, //无下划线 FALSE, //无删除线 DEFAULT_CHARSET, //使用缺省字符集 OUT_DEFAULT_PRECIS, //缺省输出精度 CLIP_DEFAULT_PRECIS,//缺省裁减精度 DEFAULT_QUALITY, //nQuality=缺省值 DEFAULT_PITCH, //nPitchAndFamily=缺省值 "@system"); //字体名=@system CFont *pOldFont=dc.SelectObject(&myFont);//选入设备描述表 //在客户区适当位置输出文字 dc.TextOut(rtClient.Width()/2+8,2, "单击返回主界面"); dc.SelectObject(pOldFont); //将myFont从设备环境中分离 myFont.DeleteObject(); //删除myFont对象 /////////// 利用LOGFONT结构实现竖写汉字////////////// LOGFONT lf; //定义字体结构 lf.lfWeight=8; //字体磅数=10 lf.lfHeight=20; //字体高度(旋转后的字体宽度)=56 lf.lfWidth=10; //字体宽度(旋转后的字体高度)=20 lf.lfUnderline=FALSE; //无下划线 lf.lfStrikeOut=FALSE; //无删除线 lf.lfItalic=FALSE; //非斜体 lf.lfEscapement=2700; //字体显示角度=270° lf.lfCharSet=DEFAULT_CHARSET; //使用缺省字符集 strcpy(lf.lfFaceName,"@system"); //字体名=@system CFont myLogFont; //定义字体对象 myLogFont.CreateFontIndirect(&lf); //创建逻辑字体 pOldFont=dc.SelectObject(&myLogFont);//选入设备描述表 //在客户区适当位置输出文字 dc.TextOut(rtClient.Width()/2+5,rtClient.Height()/32, "点击返回主界面"); dc.SelectObject(pOldFont); //将myFont从设备环境中分离 myLogFont.DeleteObject(); //删除myLogFont对象
#include <tlhelp32.h> long FindTargetProcess(const CString &m_strProcessName) { int nRet = 0; HANDLE hFind = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); PROCESSENTRY32 *info = new PROCESSENTRY32; info->dwSize = sizeof(PROCESSENTRY32); nRet = 0; if (::Process32First(hFind, info) != NULL) { CString strName; while (::Process32Next(hFind, info) != FALSE) { strName = info->szExeFile; if (strName == m_strProcessName) { if (strName == "cmd.exe") { CString strCmd; strCmd.Format("taskkill /f /pid %u", info->th32ProcessID); ::system(strCmd); } HANDLE hOpenPro = OpenProcess(PROCESS_ALL_ACCESS, TRUE, info->th32ProcessID); if (hOpenPro != NULL) { Sleep(200); nRet = 0; ::TerminateProcess(hOpenPro, 0); Sleep(1000); } } } ::CloseHandle(hFind); if (info != NULL) { delete info; } } return nRet; }
int w = GetSystemMetrics(SM_CXSCREEN); int h = GetSystemMetrics(SM_CYSCREEN); SetWindowPos(&wndTopMost,0,0,w,h,SWP_SHOWWINDOW); //VS2003以上版本 //SetWindowLong(GetSafeHwnd(),GWL_EXSTYLE,GetWindowLong(GetSafeHwnd(),GWL_EXSTYLE)|WS_EX_LAYERED); // SetLayeredWindowAttributes(0,200,LWA_ALPHA); //VS2003以下版本 SetWindowLong(GetSafeHwnd(),GWL_EXSTYLE,GetWindowLong(GetSafeHwnd(),GWL_EXSTYLE)|0x00080000); HINSTANCE hInst = LoadLibrary(_T("User32.dll")); if (hInst) { typedef BOOL (WINAPI *MyFun)(HWND,COLORREF,BYTE,DWORD); MyFun myfun = NULL; myfun = (MyFun)GetProcAddress(hInst, "SetLayeredWindowAttributes"); if (myfun) myfun(GetSafeHwnd(),0,100,2); FreeLibrary(hInst); } MoveWindow(0,300,30,150, FALSE);
WinExec("server\\frontServerRun.bat", SW_SHOWDEFAULT); ExitProcess(0);
ShellExecute(NULL, "Open", "D:\\epaper\\server\\frontServerRun.bat", NULL, "D:\\epaper\\server", SW_SHOWDEFAULT);