两时间比较 #include #include #include using namespace std;float DiffTime(unsigned ty1, unsigned th1, unsigned ty2, unsigned th2){struct tm tm1, tm2;time_t tt1, tt2;float dt;
tm ,time_t,SYSTEMTIME转换 time_t tmToTime_t(char * dt){tm timeinfo;sscanf_s(dt, "%d-%d-%d %d:%d:%d",&timeinfo.tm_year, &timeinfo.tm_mon, &timeinfo.tm_mday,&timeinfo.tm_hour, &timeinfo.tm_min, &timeinfo.tm_sec);ti
c++构造函数初始化列表 class F{public:F(int a);int m;};F::F(int a) :m(a){cout }int main(void){ F *f = new F(100);delete(f);}
MFC资源文件切换 AFX_MANAGE_STATE(AfxGetStaticModuleState()); TTest *Tet = new TTest(); Tet->Create(IDD_DIALOGTEST, NULL); Tet->ShowWindow(SW_SHOW);
win32 自定义控件使用,必须要将自定义控件style = 0x50010000 0x50010000是三个样式的组合 // Win32Project12.cpp : 定义应用程序的入口点。//#include "stdafx.h"#include "Win32Project12.h"#define MAX_LOADSTRING 100#define IDC_OKBTN 200// 全局变量: HINSTANCE hInst; // 当前实例TCHAR szT
win32 WM_DESTROY 和 WM_NCDESTROY. WM_DESTROY与WM_NCDESTROY在窗口销毁时有两个紧密关联的 windows 消息, 就是 WM_DESTROY 和 WM_NCDESTROY.区别就是 WM_DESTROY 消息是在窗口销毁动作序列中的开始被发送的, 而 WM_NCDESTROY 消息是在结尾. 这在你的窗口拥有子窗口时是个重大区别. 如果你有一个带子窗口的父窗口, 那么消息的发送序列 (在没有怪诞
wiin32 想找目录下文件 case WM_COMMAND:if (LOWORD(wParam) == IDOK){search = L"E:\\Form\\*.png";WIN32_FIND_DATA fdd;HANDLE AFind = FindFirstFile(search, &fdd);TCHAR * s = NULL;if (AFind != INVALID_HANDLE_VALUE)
修改dialog上ico hwnd ---- hinstance SendMessage(hDlg, WM_SETICON, ICON_SMALL, (LPARAM) LoadIcon(hInst, MAKEINTRESOURCE(IDI_SMALL)));
win32 linkcontrol使用 //设置值 wstring link = L"link.append(curMessage->url.c_str());link.append(L"\">");link.append(curMessage->url.c_str());link.append(L"");SetWindowText(GetDlgItem(hwnd, IDC_SYSLINK), link.c_st
gdi画图拉伸 // 让其平铺拉伸(默认为渐变拉伸)ImageAttributes ImgAtt;ImgAtt.SetWrapMode(WrapModeTileFlipXY);RectF rcDrawRect;rcDrawRect.X=0;rcDrawRect.Y=0;rcDrawRect.Width=100;rcDrawRect.Height=100;g.DrawImage(m_
文本重影 case WM_CTLCOLORSTATIC://static窗体透明i = GetWindowLong((HWND) lParam, GWL_ID); //获取窗口控制项ID ////根据所获取的id依次更改文字颜色 switch (i){case 120:SetTextColor((HDC) wParam, RGB(255, 255,
HBRUSH的使用 HBRUSH hbr;第一种: hbr= CreateSolidBrush(RGB(255,0,0)); //单色的画刷第二种: hbr= (HBRUSH)GetStockObject(BLACK_BRUSH); //只能取特定颜色的画刷,如BLACK_BRUSH,GRAY_BRUSH等刷第三种: hbr= CreatePatternBrush(HBITMAP hb
win32 listview,combox使用 HWND hwndList = GetDlgItem(hDlg, IDC_LIST_ALLMESSAGE);HWND hwndCombox = GetDlgItem(hDlg, IDC_COMBOSTATE);switch (message) {case WM_INITDIALOG:SendMessage(hwndList, LVM_SETEXTENDEDLISTVIEWSTYLE
c++中日期转换 #include "time.h"#include "stdio.h"int main(void){char now[64];struct tm newtime;time_t timep;errno_t err;timep = 1386691200;err = localtime_s(&newtime, &timep);strftime(now, 64, "
c++日期转换 #include #include #include using namespace std;void GetDay(int days, int &month, int&mDay, bool bLeap){int dayCount[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };if (b
得到window区域位置 1、全屏显示int full_x = GetSystemMetrics(SM_CXSCREEN);int full_y = GetSystemMetrics(SM_CYSCREEN);::SetWindowPos(hWnd,HWND_TOPMOST,0,0,full_x,full_y,0 ); 2、工作区显示 RECT rt; SystemParametersI
_access判断文人提否存在 _access使用方法path文件或目录路径。mode读/写属性。0仅存在2只读4只读6读取和写入BOOLEAN CheckFileExists(char * fileOrDirName){ if (_access(fileOrDirName, 0) == 0) //文件或目录存在 { return true; } return false;