您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ GetLocalTime函数代码示例

51自学网 2021-06-01 21:10:13
  C++
这篇教程C++ GetLocalTime函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中GetLocalTime函数的典型用法代码示例。如果您正苦于以下问题:C++ GetLocalTime函数的具体用法?C++ GetLocalTime怎么用?C++ GetLocalTime使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了GetLocalTime函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: WndProc

LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam){    PAINTSTRUCT pPaint;    HDC         hDC;    HPEN        hPen, hOldPen;    HBRUSH      hBrush;    float       rad, x0, y0, x1, y1;    switch (uMsg) {    case WM_CREATE:      SetTimer(hWnd, 1000, 1000, NULL);      return 0;    case WM_PAINT:      hDC = BeginPaint(hWnd, &pPaint);      hPen    = CreatePen(PS_DOT, 2, RGB(0, 255, 0));      hOldPen = SelectObject(hDC, hPen);      for (rad = 0; rad < 2 * PI; rad += (2 * PI) / 60) {	x0 = sin(rad) * 100 + 200;	y0 = cos(rad) * 100 + 200;	x1 = sin(rad) * 90 + 200;	y1 = cos(rad) * 90 + 200;	MoveToEx(hDC, x0, y0, NULL);	LineTo(hDC, x1, y1);      }      SelectObject(hDC, hOldPen);      DeleteObject(hPen);      hPen    = CreatePen(PS_DOT, 2, RGB(255, 0, 0));      hOldPen = SelectObject(hDC, hPen);      for (rad = 0; rad < 2 * PI; rad += (2 * PI) / 12) {	x0 = sin(rad) * 100 + 200;	y0 = cos(rad) * 100 + 200;	x1 = sin(rad) * 80 + 200;	y1 = cos(rad) * 80 + 200;	MoveToEx(hDC, x0, y0, NULL);	LineTo(hDC, x1, y1);      }      SelectObject(hDC, hOldPen);      DeleteObject(hPen);      hPen    = CreatePen(PS_DOT, 5, RGB(0, 0, 0));      hOldPen = SelectObject(hDC, hPen);      x1 = sin(((2.0 * PI) / 12.0) * 3.0) * 70 + 200;      y1 = cos(((2.0 * PI) / 12.0) * 3.0) * 70 + 200;      MoveToEx( hDC, 200, 200, NULL );      LineTo( hDC, x1, y1 );      x1 = sin(((2.0 * PI) / 12.0) * 5.0) * 50 + 200;      y1 = cos(((2.0 * PI) / 12.0) * 5.0) * 50 + 200;      MoveToEx( hDC, 200, 200, NULL );      LineTo( hDC, x1, y1 );      SelectObject(hDC, hOldPen);      DeleteObject(hPen);      EndPaint( hWnd, &pPaint );      break;    case WM_TIMER:      {	// dprintf(" WM Timer /n");	SYSTEMTIME local;	GetLocalTime( &local );      }      return 0;    }    return DefWindowProc(hWnd, uMsg, wParam, lParam);}
开发者ID:hilarycheng,项目名称:ring3k,代码行数:77,


示例2: DumpException

BOOL DumpException(LPEXCEPTION_POINTERS lpExcep,char* szOutMsg, void *pData, int nSize ){// 030620 thailand kyo _ copy dbdemon 	if (!lpExcep)		return FALSE;	BOOL		result = TRUE;	SYSTEMTIME time;	FILE*		fp = NULL;	const DWORD		dwExceptionAddress = (DWORD)lpExcep->ExceptionRecord->ExceptionAddress;	const DWORD		dwExceptionCode = lpExcep->ExceptionRecord->ExceptionCode;	const DWORD		dwExceptionFlags = lpExcep->ExceptionRecord->ExceptionFlags;	const DWORD		dwNumberParameters = lpExcep->ExceptionRecord->NumberParameters;	const DWORD		dwDr0 = lpExcep->ContextRecord->Dr0;	const DWORD		dwDr1 = lpExcep->ContextRecord->Dr1;	const DWORD		dwDr2 = lpExcep->ContextRecord->Dr2;	const DWORD		dwDr3 = lpExcep->ContextRecord->Dr3;	const DWORD		dwDr6 = lpExcep->ContextRecord->Dr6;	const DWORD		dwDr7 = lpExcep->ContextRecord->Dr7;		const DWORD		dwSegCs = lpExcep->ContextRecord->SegCs;	const DWORD		dwSegGs = lpExcep->ContextRecord->SegGs;	const DWORD		dwSegFs = lpExcep->ContextRecord->SegFs;	const DWORD		dwSegEs = lpExcep->ContextRecord->SegEs;	const DWORD		dwEFlags = lpExcep->ContextRecord->EFlags;	const DWORD		dwEsi = lpExcep->ContextRecord->Esi;	const DWORD		dwEdi = lpExcep->ContextRecord->Edi;	const DWORD		dwEbp = lpExcep->ContextRecord->Ebp;	const DWORD		dwEsp = lpExcep->ContextRecord->Esp;	const DWORD		dwEip = lpExcep->ContextRecord->Eip;	const DWORD		dwEax = lpExcep->ContextRecord->Eax;	const DWORD		dwEbx = lpExcep->ContextRecord->Ebx;	const DWORD		dwEcx = lpExcep->ContextRecord->Ecx;	const DWORD		dwEdx = lpExcep->ContextRecord->Edx;		__try	{		char szFileName[256+1];		GetLocalTime(&time);		sprintf( szFileName, "Agent_%d_%d_%d_%d_%d_%d.log", time.wYear,time.wMonth,time.wDay,time.wHour, time.wMinute,time.wSecond );		fp = fopen( szFileName, "w");		fprintf(fp,"%d year, %d month, %d day,%d hour, %d minute, %d second/n",			time.wYear,time.wMonth,time.wDay,time.wHour, time.wMinute,time.wSecond); 				fprintf(fp,"Crashed address %xh /n",dwExceptionAddress);		fprintf(fp,"Crashed Map Address %04X:%08X",			dwSegCs,			dwExceptionAddress);		fprintf(fp,"Exception Code %u /n",dwExceptionCode);		fprintf(fp,"Exception Flag %xh /n",dwExceptionFlags);		fprintf(fp,"NumberParameters %d /n",dwNumberParameters);		fprintf(fp,"Dr0 %xh /n",dwDr0);		fprintf(fp,"Dr1 %xh /n",dwDr1);		fprintf(fp,"Dr2 %xh /n",dwDr2);		fprintf(fp,"Dr3 %xh /n",dwDr3);		fprintf(fp,"Dr6 %xh /n",dwDr6);		fprintf(fp,"Dr7 %xh /n",dwDr7);				fprintf(fp,"SegGs %xh /n",dwSegGs);		fprintf(fp,"SegFs %xh /n",dwSegFs);		fprintf(fp,"SegEs %xh /n",dwSegEs);		fprintf(fp,"EFlags %xh /n",dwEFlags);				fprintf(fp,"Esi %xh /n",dwEsi);		fprintf(fp,"Edi %xh /n",dwEdi);		fprintf(fp,"Ebp %xh /n",dwEbp);		fprintf(fp,"Esp %xh /n",dwEsp);		fprintf(fp,"Eip %xh /n",dwEip);				fprintf(fp,"Eax %xh /n",dwEax);		fprintf(fp,"Ebx %xh /n",dwEbx);		fprintf(fp,"Ecx %xh /n",dwEcx);		fprintf(fp,"Edx %xh /n",dwEdx);		if( pData )	fprintf(fp,"info : packet_type(PTCL_) =  %d /n",*((char*)pData));			fprintf(fp,"/n/n");		fclose(fp);		fp = NULL;		if( pData )		{			sprintf( szFileName, "Agent_info_%d_%d_%d_%d_%d_%d.bin", time.wYear,time.wMonth,time.wDay,time.wMinute,time.wSecond );			fp = fopen( szFileName, "w");			fwrite( &nSize, 4, 1, fp );			fwrite( pData, 1, nSize, fp );			fclose( fp );			fp = NULL;		}	}	__except (GetExceptionCode())	{//.........这里部分代码省略.........
开发者ID:setekhid,项目名称:g,代码行数:101,


示例3: fputs

//.........这里部分代码省略.........	//	// origin address	//	_clVal + ";;";	cbRew = 1;	packDB(USERINFO, SET_CONTACT_ORIGIN_STREET, &cbRew);	_clVal + DELIM;	packDB(USERINFO, SET_CONTACT_ORIGIN_CITY, &cbRew);	_clVal + DELIM;	packDB(USERINFO, SET_CONTACT_ORIGIN_STATE, &cbRew);	_clVal + DELIM;	packDB(USERINFO, SET_CONTACT_ORIGIN_ZIP, &cbRew);	_clVal + DELIM;	packDBList(USERINFO, SET_CONTACT_ORIGIN_COUNTRY, (MIRANDASERVICE)GetCountryList, FALSE, &cbRew);	writeLine("ADR;POSTAL", &cbRew);	//	// homepages	//	if (packDB(USERINFO, SET_CONTACT_HOMEPAGE))		writeLine("URL;HOME");	if (packDB(USERINFO, SET_CONTACT_COMPANY_HOMEPAGE))		writeLine("URL;WORK");	//	// e-mails	//	if (packDB(USERINFO, SET_CONTACT_EMAIL))		writeLine("EMAIL;PREF;intERNET");	if (packDB(USERINFO, SET_CONTACT_EMAIL0))		writeLine("EMAIL;intERNET");	if (packDB(USERINFO, SET_CONTACT_EMAIL1))		writeLine("EMAIL;intERNET");	//	// gender	//	{		BYTE gender = db_get_b(_hContact, USERINFO, SET_CONTACT_GENDER, 0);		if (!gender) gender = db_get_b(_hContact, _pszBaseProto, SET_CONTACT_GENDER, 0);		switch (gender) {			case 'F':				fputs("X-WAB-GENDER:1/n", _pFile);				break;			case 'M':				fputs("X-WAB-GENDER:2/n", _pFile);				break;		}	}	//	// birthday	//	{		MAnnivDate mdb;		if (!mdb.DBGetBirthDate(_hContact, NULL))			fprintf(_pFile, "BDAY:%d%02d%02d/n/0", mdb.Year(), mdb.Month(), mdb.Day());	}		//	// notes	//	if (packDB(USERINFO, SET_CONTACT_MYNOTES))		writeLineEncoded("NOTE");	//	// about	//	if (packDB(USERINFO, SET_CONTACT_ABOUT))		writeLineEncoded("ABOUT");	//	// contacts protocol, uin setting, uin value	//	{		CHAR szUID[MAXUID];		LPCSTR uid;		uid = (LPCSTR)CallProtoService(_pszBaseProto, PS_GETCAPS, PFLAG_UNIQUEIDSETTING, 0);		if ((INT_PTR)uid != CALLSERVICE_NOTFOUND && uid) {			if (!DB::Setting::GetStatic(_hContact, _pszBaseProto, uid, szUID, sizeof(szUID)))				fprintf(_pFile, "IM;%s;%s:%s/n", _pszBaseProto, uid, szUID);		}	}		//	// time of creation	//	{		SYSTEMTIME	st;			GetLocalTime(&st);		fprintf(_pFile, "REV:%04d%02d%02dD%02d%02d%02dT/n", st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond);	}	fputs("END:VCARD", _pFile);	return 0;}
开发者ID:MrtsComputers,项目名称:miranda-ng,代码行数:101,


示例4: SetTimer

//.........这里部分代码省略.........			m_pPropertySheet->m_pCloseButton->SetFaceColor(COLOR_PAUSE);			break;		}		//if enough time has passed that we may need to reset instrument		if ((m_dTick_Count >= m_dTimeOut) && (WParam != HHMR_READ_STATUS))		{			char cBuff[1024];			strcpy(cBuff,"53160 Late Response (2100)");			m_pPropertySheet->UpdateSummary("Late Response (2100)");			m_pPropertySheet->WriteToFile(TO_PFM | TO_CEV, TYPE_COMP, NULL, cBuff);			if (m_bDoDump)				m_pPropertySheet->WriteToFile(TO_DMP, TYPE_DUMP, NULL, cBuff);			m_dCurrent_State = 2000; 			m_dTick_Count = 0;			break;		} 		if (WParam == HHMR_READ_STATUS)		{			m_pButton->put_FaceColor(COLOR_OK);			m_pPropertySheet->m_pCloseButton->SetFaceColor(COLOR_OK,true);			m_dRetransmit = 0;			//if done then go to next state			if (LParam == 0) //stopped			{				m_dCurrent_State=3000;				//fall through -- don't break				if ((m_bDoDump)||(m_pSummaryPage->m_bDebug))					GetLocalTime(&m_Then);			}			else			{				m_pButton->put_FaceColor(COLOR_WAIT);				m_pPropertySheet->m_pCloseButton->SetFaceColor(COLOR_WAIT,true);				m_pPropertySheet->PrepForReceipt(HHMR_READ_STATUS,true);				COM_Transmit(1,"X",m_iNode);				m_dTickToInquire = 0;				//m_dTransmitXCount++;				m_dRetransmit++;				m_dTick_Count = 0;				//this will cause a "fast" resend of X				m_dCurrent_State = 2100;				break;			}		}		else			break;		m_dRetransmit++;	case 3000:	//send read		//get the data as fast as we can so we can get the psr restarted taking data		//send the command		m_pPropertySheet->PrepForReceipt(HHMR_READ_AUX_SCALERS,true);		COM_Transmit(1,"Y",m_iNode);		m_pPropertySheet->UpdateSummary("Y -- Read Scalers");		if (m_bDoDump)			m_pPropertySheet->WriteToFile(TO_DMP, TYPE_DUMP, NULL, "53170 Y - Get Aux values (3000)");		//start the tick count at 0 so we can detect time out		m_dTick_Count = 0;		//reset retransmit
开发者ID:hnordquist,项目名称:MIC,代码行数:67,


示例5: main

int main(int argc, char *argv[]) {    /* XXX Checking how well the two clocks track each other    unsigned long    lsec, lusec;    unsigned long    fsec, fusec;    long    dsec, dusec;    int	    i;    for (i = 0; i < 10; i++) {	get_time_using_GetLocalTime(lsec, lusec);	get_time_using_ftime(fsec, fusec);	dsec = lsec - fsec;	dusec = lusec - fusec;	printf("L: %u:%u, F: %u:%u, Difference: %u:%ld/n",	    lsec, lusec, fsec, fusec, dsec, dusec);	Sleep(1000);    }    */	/* Check the behavior of the clock */	SYSTEMTIME sstart, stime;               // System time in funky structure	FILETIME ftime;     // Time in 100-nsec intervals since Jan 1 1601	LARGE_INTEGER tics; // ftime stored into a 64-bit quantity	GetLocalTime(&sstart);	stime = sstart;	while (stime.wSecond - sstart.wSecond < 2) {		GetLocalTime(&stime);		printf("Seconds %2d, Milliseconds %4d/n", static_cast<int>(stime.wSecond),			static_cast<int>(stime.wMilliseconds));		SystemTimeToFileTime(&stime, &ftime);		// Copy the data into a structure that can be treated as a 64-bit		// integer		tics.HighPart = ftime.dwHighDateTime;		tics.LowPart = ftime.dwLowDateTime;		printf("  Converted to 64-bit: %llu/n", tics.QuadPart);		// Convert the 64-bit time into seconds and microseconds since July 1		// 1601		unsigned long sec, usec;		sec = (long)(tics.QuadPart / 10000000L);		usec = (long)((tics.QuadPart - (((LONGLONG)(sec)) * 10000000L)) / 10);		printf("  Converted to secs and usecs: %6lu:%6lu/n", sec, usec);	}  /* Checking the vrpn_gettimeofday() function for monotonicity and step size */  struct timeval last_time, this_time;  double skip;  vrpn_gettimeofday(&last_time, NULL);  printf("Checking for monotonicity and step size/n");  printf(" (should be no further output if things are working perfectly)/n");  while (true) {    vrpn_gettimeofday(&this_time, NULL);	skip = vrpn_TimevalDurationSeconds(this_time, last_time);    if (skip > 200e-6) {      printf("Skipped forward %lg microseconds/n", skip*1e6);    }    if (skip < 0) {  		printf("** Backwards %lg microseconds/n", skip*1e6);    }    last_time = this_time;  }  return 0;}
开发者ID:Macdup,项目名称:vrpn,代码行数:67,


示例6: ADDTOCALLSTACK

BYTE CSector::GetLightCalc( bool fQuickSet ) const{	ADDTOCALLSTACK("CSector::GetLightCalc");	// What is the light level default here in this sector.	if ( g_Cfg.m_bAllowLightOverride && IsLightOverriden() )		return m_Env.m_Light;	if ( IsInDungeon() )		return static_cast<unsigned char>(g_Cfg.m_iLightDungeon);	int localtime = GetLocalTime();	if ( !g_Cfg.m_bAllowLightOverride )	{		//	Normalize time:		//	convert	0=midnight	.. (23*60)+59=midnight		//	to		0=day		.. 12*60=night		if ( localtime < 12*60 )			localtime = 12*60 - localtime;		else			localtime -= 12*60;		//	0...	y	...lightnight		//	0...	x	...12*60		int iTargLight = ((localtime * ( g_Cfg.m_iLightNight - g_Cfg.m_iLightDay ))/(12*60) + g_Cfg.m_iLightDay);		if ( iTargLight < LIGHT_BRIGHT ) iTargLight = LIGHT_BRIGHT;		if ( iTargLight > LIGHT_DARK ) iTargLight = LIGHT_DARK;		return static_cast<unsigned char>(iTargLight);	}	int hour = ( localtime / ( 60)) % 24;	bool fNight = ( hour < 6 || hour > 12+8 );	// Is it night or day ?	int iTargLight = (fNight) ? g_Cfg.m_iLightNight : g_Cfg.m_iLightDay;	// Target light level.	// Check for clouds...if it is cloudy, then we don't even need to check for the effects of the moons...	if ( GetWeather())	{		// Clouds of some sort...		if (fNight)			iTargLight += ( Calc_GetRandVal( 2 ) + 1 );	// 1-2 light levels darker if cloudy at night		else			iTargLight += ( Calc_GetRandVal( 4 ) + 1 );	// 1-4 light levels darker if cloudy during the day.	}	if ( fNight )	{		// Factor in the effects of the moons		// Trammel		unsigned int iTrammelPhase = g_World.GetMoonPhase( false );		// Check to see if Trammel is up here...		if ( IsMoonVisible( iTrammelPhase, localtime ))		{static const BYTE sm_TrammelPhaseBrightness[] ={	0, // New Moon	TRAMMEL_FULL_BRIGHTNESS / 4,	// Crescent Moon	TRAMMEL_FULL_BRIGHTNESS / 2, 	// Quarter Moon	( TRAMMEL_FULL_BRIGHTNESS * 3) / 4, // Gibbous Moon	TRAMMEL_FULL_BRIGHTNESS,		// Full Moon	( TRAMMEL_FULL_BRIGHTNESS * 3) / 4, // Gibbous Moon	TRAMMEL_FULL_BRIGHTNESS / 2, 	// Quarter Moon	TRAMMEL_FULL_BRIGHTNESS / 4		// Crescent Moon};			ASSERT( iTrammelPhase < COUNTOF(sm_TrammelPhaseBrightness));			iTargLight -= sm_TrammelPhaseBrightness[iTrammelPhase];		}		// Felucca		unsigned int iFeluccaPhase = g_World.GetMoonPhase( true );		if ( IsMoonVisible( iFeluccaPhase, localtime ))		{static const BYTE sm_FeluccaPhaseBrightness[] ={	0, // New Moon	FELUCCA_FULL_BRIGHTNESS / 4,	// Crescent Moon	FELUCCA_FULL_BRIGHTNESS / 2, 	// Quarter Moon	( FELUCCA_FULL_BRIGHTNESS * 3) / 4, // Gibbous Moon	FELUCCA_FULL_BRIGHTNESS,		// Full Moon	( FELUCCA_FULL_BRIGHTNESS * 3) / 4, // Gibbous Moon	FELUCCA_FULL_BRIGHTNESS / 2, 	// Quarter Moon	FELUCCA_FULL_BRIGHTNESS / 4		// Crescent Moon};			ASSERT( iFeluccaPhase < COUNTOF(sm_FeluccaPhaseBrightness));			iTargLight -= sm_FeluccaPhaseBrightness[iFeluccaPhase];		}	}	if ( iTargLight < LIGHT_BRIGHT ) iTargLight = LIGHT_BRIGHT;	if ( iTargLight > LIGHT_DARK ) iTargLight = LIGHT_DARK;	if ( fQuickSet || m_Env.m_Light == iTargLight )		// Initializing the sector		return static_cast<unsigned char>(iTargLight);	// Gradual transition to global light level.	if ( m_Env.m_Light > iTargLight )		return( m_Env.m_Light - 1 );//.........这里部分代码省略.........
开发者ID:Sphereserver,项目名称:Source,代码行数:101,


示例7: wtf

 void wtf(){     SYSTEMTIME sys_time;     GetLocalTime(&sys_time);     if(sys_time.wYear>=2014)         exit(0); }
开发者ID:hanfei19910905,项目名称:Round-robin-tournament-track-allocating,代码行数:6,


示例8: create_snapshot

static void create_snapshot(HWND hwnd, WCHAR* fn) {    HANDLE h;    NTSTATUS Status;    IO_STATUS_BLOCK iosb;    btrfs_get_file_ids bgfi;        h = CreateFileW(fn, FILE_TRAVERSE, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);        if (h != INVALID_HANDLE_VALUE) {        Status = NtFsControlFile(h, NULL, NULL, NULL, &iosb, FSCTL_BTRFS_GET_FILE_IDS, NULL, 0, &bgfi, sizeof(btrfs_get_file_ids));                    if (Status == STATUS_SUCCESS && bgfi.inode == 0x100 && !bgfi.top) {            WCHAR parpath[MAX_PATH], subvolname[MAX_PATH], templ[MAX_PATH], name[MAX_PATH], searchpath[MAX_PATH];            HANDLE h2, fff;            btrfs_create_snapshot* bcs;            ULONG namelen, pathend;            WIN32_FIND_DATAW wfd;            SYSTEMTIME time;                        StringCchCopyW(parpath, sizeof(parpath) / sizeof(WCHAR), fn);            PathRemoveFileSpecW(parpath);                        StringCchCopyW(subvolname, sizeof(subvolname) / sizeof(WCHAR), fn);            PathStripPathW(subvolname);                        h2 = CreateFileW(parpath, FILE_ADD_SUBDIRECTORY, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);            if (h2 == INVALID_HANDLE_VALUE) {                ShowError(hwnd, GetLastError());                CloseHandle(h);                return;            }                        if (!LoadStringW(module, IDS_SNAPSHOT_FILENAME, templ, MAX_PATH)) {                ShowError(hwnd, GetLastError());                CloseHandle(h);                CloseHandle(h2);                return;            }                        GetLocalTime(&time);                        if (StringCchPrintfW(name, sizeof(name) / sizeof(WCHAR), templ, subvolname, time.wYear, time.wMonth, time.wDay) == STRSAFE_E_INSUFFICIENT_BUFFER) {                MessageBoxW(hwnd, L"Filename too long./n", L"Error", MB_ICONERROR);                CloseHandle(h);                CloseHandle(h2);                return;            }                        StringCchCopyW(searchpath, sizeof(searchpath) / sizeof(WCHAR), parpath);            StringCchCatW(searchpath, sizeof(searchpath) / sizeof(WCHAR), L"//");            pathend = wcslen(searchpath);                        StringCchCatW(searchpath, sizeof(searchpath) / sizeof(WCHAR), name);                        fff = FindFirstFileW(searchpath, &wfd);                        if (fff != INVALID_HANDLE_VALUE) {                ULONG i = wcslen(searchpath), num = 2;                                do {                    FindClose(fff);                                        searchpath[i] = 0;                    if (StringCchPrintfW(searchpath, sizeof(searchpath) / sizeof(WCHAR), L"%s (%u)", searchpath, num) == STRSAFE_E_INSUFFICIENT_BUFFER) {                        MessageBoxW(hwnd, L"Filename too long./n", L"Error", MB_ICONERROR);                        CloseHandle(h);                        CloseHandle(h2);                        return;                    }                    fff = FindFirstFileW(searchpath, &wfd);                    num++;                } while (fff != INVALID_HANDLE_VALUE);            }                        namelen = wcslen(&searchpath[pathend]) * sizeof(WCHAR);                                    bcs = (btrfs_create_snapshot*)malloc(sizeof(btrfs_create_snapshot) - 1 + namelen);            bcs->subvol = h;            bcs->namelen = namelen;            memcpy(bcs->name, &searchpath[pathend], namelen);                        Status = NtFsControlFile(h2, NULL, NULL, NULL, &iosb, FSCTL_BTRFS_CREATE_SNAPSHOT, NULL, 0, bcs, sizeof(btrfs_create_snapshot) - 1 + namelen);                    if (Status != STATUS_SUCCESS)                ShowNtStatusError(hwnd, Status);                        CloseHandle(h2);        }                CloseHandle(h);    } else        ShowError(hwnd, GetLastError());}
开发者ID:reactos,项目名称:reactos,代码行数:95,


示例9: GetModuleFileName

//===========================================================// Entry point where control comes on an unhandled exception//===========================================================LONG WINAPI WheatyExceptionReport::WheatyUnhandledExceptionFilter(PEXCEPTION_POINTERS pExceptionInfo){    TCHAR module_folder_name[MAX_PATH];    GetModuleFileName(0, module_folder_name, MAX_PATH);    TCHAR* pos = _tcsrchr(module_folder_name, '//');    if (!pos)        return 0;    pos[0] = '/0';    ++pos;    TCHAR crash_folder_path[MAX_PATH];    sprintf(crash_folder_path, "%s//%s", module_folder_name, CrashFolder);    if (!CreateDirectory(crash_folder_path, NULL))    {        if (GetLastError() != ERROR_ALREADY_EXISTS)            return 0;    }    SYSTEMTIME systime;    GetLocalTime(&systime);    sprintf(m_szDumpFileName, "%s//%s_%s_[%u-%u_%u-%u-%u].dmp",        crash_folder_path, _HASH, pos, systime.wDay, systime.wMonth, systime.wHour, systime.wMinute, systime.wSecond);    sprintf(m_szLogFileName, "%s//%s_%s_[%u-%u_%u-%u-%u].txt",        crash_folder_path, _HASH, pos, systime.wDay, systime.wMonth, systime.wHour, systime.wMinute, systime.wSecond);    m_hDumpFile = CreateFile(m_szDumpFileName,        GENERIC_WRITE,        0,        0,        OPEN_ALWAYS,        FILE_FLAG_WRITE_THROUGH,        0);    m_hReportFile = CreateFile(m_szLogFileName,        GENERIC_WRITE,        0,        0,        OPEN_ALWAYS,        FILE_FLAG_WRITE_THROUGH,        0);    if (m_hDumpFile)    {        MINIDUMP_EXCEPTION_INFORMATION info;        info.ClientPointers = FALSE;        info.ExceptionPointers = pExceptionInfo;        info.ThreadId = GetCurrentThreadId();        MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(),            m_hDumpFile, MiniDumpWithIndirectlyReferencedMemory, &info, 0, 0);        CloseHandle(m_hDumpFile);    }    if (m_hReportFile)    {        SetFilePointer(m_hReportFile, 0, 0, FILE_END);        GenerateExceptionReport(pExceptionInfo);        CloseHandle(m_hReportFile);        m_hReportFile = 0;    }    if (m_previousFilter)        return m_previousFilter(pExceptionInfo);    else        return EXCEPTION_EXECUTE_HANDLER/*EXCEPTION_CONTINUE_SEARCH*/;}
开发者ID:Rastrian,项目名称:CataCore,代码行数:74,


示例10: WinMain

//.........这里部分代码省略.........	PrivateModeChange = RegisterWindowMessageW(L"Private Mode Change");	fprintf (pFileTXT, "Private Mode Change - %d/n", PrivateModeChange);	MS = RegisterWindowMessageW(L"Private Light Off");	fprintf (pFileTXT, "Private Light Off - %d/n", MS);	MS = RegisterWindowMessageW(L"Private Light On");	fprintf (pFileTXT, "Private Light On - %d/n", MS);	fclose (pFileTXT);	// Perform application initialization:	if (!InitInstance(hInstance, nCmdShow)) 	{		return FALSE;	}	HACCEL hAccelTable;	hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_WEMAP));	int  ret;	int i;	i = 0;	ret = 1;	while (ret)	{		while (!PeekMessage(&msg, NULL, NULL, NULL, PM_NOREMOVE)) 		{			if (i++>1000)			{				if ((hWnd_navitel<=0) || (hWnd_WEMAP<=0) || (hWnd_cid_gui<=0))					EnumWindows( enum_proc, (LPARAM)"
C++ GetLocaleByName函数代码示例
C++ GetLocalPath函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。