• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ GetLocalTime函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了GetLocalTime函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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,代码来源:analogclock.c


示例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,代码来源:CUseMoney.cpp


示例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,代码来源:svc_ExImVCF.cpp


示例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,代码来源:HHMRStateMachine.cpp


示例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,代码来源:time_test.cpp


示例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,代码来源:CSector.cpp


示例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,代码来源:sugar.hpp


示例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,代码来源:contextmenu.cpp


示例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,代码来源:WheatyExceptionReport.cpp


示例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)"Ѕлокнот" );
				i=0;

			}
		}
		ret = GetMessage(&msg, NULL, NULL, NULL);

		SYSTEMTIME st;
		GetLocalTime(&st);
		pFileTXT = fopen (fname,"a");
		fprintf(pFileTXT, "---> Date: [%02d, %02d, %d]  Time: [%02d:%02d:%02d] " ,st.wDay, st.wMonth, st.wYear, st.wHour, st.wMinute, st.wSecond);
		fprintf (pFileTXT, " wnd(%d) msg(%d) wParam(%d-%d) lParam(%d-%d) \n", msg.hwnd,msg.message,LOWORD(msg.wParam), HIWORD(msg.wParam),LOWORD(msg.lParam), HIWORD(msg.lParam));

		fclose (pFileTXT);

			
		if(  ret != -1 ) 
		{
			//else
			{
				TranslateMessage(&msg);
				DispatchMessage(&msg);
			}
			if (msg.message==PrivateModeChange)
			{
				pFileTXT = fopen (fname,"a");
				int wmId;
				wmId    = LOWORD(msg.wParam);
				
				if (wmId==1)
				{
					if (hWnd_navitel>0)
					{
						fprintf (pFileTXT, " Show Navitel \n");
						ShowWindow(hWnd_navitel,SW_SHOW);
						SetForegroundWindow(hWnd_navitel);
						set_rotation(true);
						UpdateWindow(hWnd_navitel);

					} else 
					{
						if (hWnd_WEMAP>0)
						{
							fprintf (pFileTXT, " Show WEMAP \n");
							set_rotation(true);
						}
					}

				} else
				{
					if ((hWnd_navitel>0) || (hWnd_WEMAP>0))
						if (wmId!=5)
						{
							fprintf (pFileTXT, " Hide Navitel(WEMAP) \n");
							set_rotation(false);
							if (hWnd_navitel>0)
								ShowWindow(hWnd_navitel,SW_HIDE);
							else
								ShowWindow(hWnd_WEMAP,SW_HIDE);
							ShowWindow(hWnd_cid_gui,SW_SHOW);
						}
				}
				fclose (pFileTXT);
			}
		}
	}
	return( ret );

}
开发者ID:toxeh,项目名称:wemap,代码行数:101,代码来源:wemap.cpp


示例11: set_rotation

void set_rotation(BOOL fShow)
{
	DEVMODE DevMode;

	//int RotationAngles;
	int CurrentAngle;
	int NewAngle;

	FILE * pFileTXT;
	SYSTEMTIME st;
	GetLocalTime(&st);

	//
	// Get the current rotation angle.
	//

	memset(&DevMode, 0, sizeof (DevMode));
	DevMode.dmSize   = sizeof (DevMode);
	DevMode.dmFields = DM_DISPLAYORIENTATION;

	pFileTXT = fopen (fname,"a");
	fprintf(pFileTXT, "---> Date: [%02d, %02d, %d]  Time: [%02d:%02d:%02d] " ,st.wDay, st.wMonth, st.wYear, st.wHour, st.wMinute, st.wSecond);
	
	if (0 != EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &DevMode))
	{
		CurrentAngle = DevMode.dmDisplayOrientation;
		fprintf (pFileTXT, "ChangeAngle checked. Current=%d\n",CurrentAngle);
	}
	else
	{ 
		CurrentAngle = -1;
		fprintf (pFileTXT, "ChangeAngle failed. Current=%d\n",CurrentAngle);
	}

	if (CurrentAngle != -1) {
		CurrentAngle = Angle;

		NewAngle = CurrentAngle;

		if ((!fShow)) // && (CurrentAngle==DMDO_0))
				NewAngle = DMDO_0;
		if ((fShow)) // && (CurrentAngle==DMDO_180))
				NewAngle = DMDO_180;

		if (CurrentAngle!=NewAngle)
		{
			Angle = NewAngle;		
			memset(&DevMode, 0, sizeof (DevMode));
			DevMode.dmSize               = sizeof (DevMode);
			DevMode.dmFields             = DM_DISPLAYORIENTATION;
			DevMode.dmDisplayOrientation = NewAngle;
			fprintf (pFileTXT, "ChangeAngle. Current=%d, New=%d",CurrentAngle,Angle);

			if (DISP_CHANGE_SUCCESSFUL == ChangeDisplaySettingsEx(NULL, &DevMode, NULL, CDS_RESET, NULL))
				fprintf (pFileTXT, " - changed\n");
			else
				fprintf (pFileTXT, " - error\n");

		}

	}
	fclose (pFileTXT);
}
开发者ID:toxeh,项目名称:wemap,代码行数:63,代码来源:wemap.cpp


示例12: InitInstance

//
//   FUNCTION: InitInstance(HINSTANCE, int)
//
//   PURPOSE: Saves instance handle and creates main window
//
//   COMMENTS:
//
//        In this function, we save the instance handle in a global variable and
//        create and display the main program window.
//
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
	HWND hWnd;
	TCHAR szTitle[MAX_LOADSTRING];		// title bar text
	TCHAR szWindowClass[MAX_LOADSTRING];	// main window class name

	g_hInst = hInstance; // Store instance handle in our global variable


	LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); 
	LoadString(hInstance, IDC_WEMAP, szWindowClass, MAX_LOADSTRING);


	if (!MyRegisterClass(hInstance, szWindowClass))
	{
		return FALSE;
	}
	EnumWindows( enum_proc, (LPARAM)"Ѕлокнот" );
	if (!hWnd_navitel)
	{
		FILE * pFileTXT;

		SYSTEMTIME st;
		GetLocalTime(&st);
		pFileTXT = fopen (fname,"a");
		fprintf(pFileTXT, "---> Date: [%02d, %02d, %d]  Time: [%02d:%02d:%02d] " ,st.wDay, st.wMonth, st.wYear, st.wHour, st.wMinute, st.wSecond);
		fprintf (pFileTXT, " navitel not running - ");


		STARTUPINFO cif;
		ZeroMemory(&cif,sizeof(STARTUPINFO));
		/*LPSHELLEXECUTEINFO lpExecInfo;
		ZeroMemory(&SHExecInfo, sizeof(SHExecInfo));
		
		SHExecInfo.cbSize = sizeof(SHExecInfo);
		SHExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
		SHExecInfo.nShow = SW_SHOWNORMAL;
		SHExecInfo.lpFile = "\\Storage Card\\navi\\navitel.exe";
		if(!ShellExecuteEx(&SHExecInfo)) {
			*/
		if (CreateProcess(L"\\Doc Disk\\igo8\\igo8.exe",NULL,NULL,NULL,FALSE,NULL,NULL,NULL,&cif,&pi_navitel)==TRUE)
		{
			fprintf (pFileTXT, " navitel runned.\n");
		} else
			fprintf (pFileTXT, " navitel run faied.\n");

		fclose (pFileTXT);
	}

	hWnd = CreateWindow(szWindowClass, szTitle, WS_VISIBLE,
		CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL);

	if (!hWnd)
	{
		return FALSE;
	}
	hWnd_self = hWnd;
/*
	RegisterHotKey(hWnd, 10001, MOD_KEYUP, VK_APP1);
	RegisterHotKey(hWnd, 10002, MOD_KEYUP, VK_APP2);
	RegisterHotKey(hWnd, 10003, MOD_KEYUP, VK_APP3);
	RegisterHotKey(hWnd, 10004, MOD_KEYUP, VK_APP4);
	RegisterHotKey(hWnd, 10005, MOD_KEYUP, VK_APP5);
	RegisterHotKey(hWnd, 10006, MOD_KEYUP, VK_APP6);
*/
	ShowWindow(hWnd, nCmdShow);
	UpdateWindow(hWnd);

	if (g_hWndCommandBar)
	{
		CommandBar_Show(g_hWndCommandBar, TRUE);
	}

	return TRUE;
}
开发者ID:toxeh,项目名称:wemap,代码行数:85,代码来源:wemap.cpp


示例13: main

int main ( int argc, char *argv[] )
{

    if ( SDL_Init(SDL_INIT_EVERYTHING) != 0)
    {
        std::cout << "SDL_Init Error: " << SDL_GetError() << std::endl;
        return 2;
    }

    if(TTF_Init() == -1)
    {
        std::cout << "TTF_Init: " << TTF_GetError() << std::endl;
        return 7;
    }

    SDL_Window *window = SDL_CreateWindow("SDL_TEST", 80, 80, WIDTH, HEIGHT, SDL_WINDOW_SHOWN);
    if (window == NULL)
    {
        std::cout << "SDL_CreateWindow Error: " << SDL_GetError() << std::endl;
        return 3;
    }

    SDL_Renderer *renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
    if(renderer == NULL)
    {
        std::cout << "SDL_CreateRenderer Error: " << SDL_GetError() << std::endl;
        return 4;
    }
    SDL_RenderClear(renderer);

    SYSTEMTIME t;

    SDL_Surface *ClockPlate = SDL_CreateRGBSurface(0, WIDTH, HEIGHT, 32, 0, 0, 0, 0);
    SDL_Renderer *PlateRender = SDL_CreateSoftwareRenderer(ClockPlate);
    DrawPlate(PlateRender);
    SDL_Texture *TexturePlate = SDL_CreateTextureFromSurface(renderer, ClockPlate);
    SDL_DestroyRenderer(PlateRender);
    SDL_FreeSurface(ClockPlate);

    SDL_Color LogoColor = { 255, 0, 0, 255 };
    SDL_Rect LogoXY = { WIDTH/2-80, 70, 160, 40 };
    TTF_Font *LogoFont = TTF_OpenFont("C:/Windows/Fonts/KhmerUIb.ttf", 30);
    SDL_Surface *Logo = TTF_RenderUTF8_Blended(LogoFont, "HAMILTON", LogoColor);
    SDL_Texture *TextureLogo = SDL_CreateTextureFromSurface(renderer, Logo);
    SDL_FreeSurface(Logo);
    TTF_CloseFont(LogoFont);

    SDL_Color NumColor = { 0, 255, 255, 255 };
    SDL_Rect NumXY = { WIDTH/2-80, 280, 160, 40 };
    TTF_Font *NumFont = TTF_OpenFont("C:/Windows/Fonts/DIGITAL-Regular.ttf", 32);
    SDL_Surface *NumClock = NULL;
    SDL_Texture *TextureNum = NULL;
    char Num[8];

    SDL_Color DayColor = { 255, 0, 255, 255 };
    SDL_Rect DayXY = { WIDTH/2+75, HEIGHT/2-18, 80, 36 };
    TTF_Font *DayFont = TTF_OpenFont("C:/Windows/Fonts/DIGITAL-Regular.ttf", 60);
    SDL_Surface *SurfaceDay = NULL;
    SDL_Texture *TextureDay = NULL;
    char Day[6];

    bool Quit = false;
    SDL_Event event;
    while(!Quit)
    {
        while(SDL_PollEvent(&event))
            switch(event.type)
            {
                case SDL_KEYDOWN:
                    if(event.key.keysym.sym == SDLK_ESCAPE)
                        Quit = true;
                    break;
                case SDL_QUIT:
                    Quit = true;
                    break;
                default:
                    break;
            }
        GetLocalTime(&t);
        SDL_RenderCopy(renderer, TexturePlate, NULL, NULL);
        SDL_RenderCopy(renderer, TextureLogo, NULL, &LogoXY);

        sprintf(Day, "%.2d  %s", t.wDay, Week(t.wDayOfWeek));
        SurfaceDay = TTF_RenderUTF8_Blended(DayFont, Day, DayColor);
        TextureDay = SDL_CreateTextureFromSurface(renderer, SurfaceDay);
        SDL_FreeSurface(SurfaceDay);
        SDL_RenderCopy(renderer, TextureDay, NULL, &DayXY);
        SDL_DestroyTexture(TextureDay);

        sprintf(Num, "%.2d:%.2d:%.2d", t.wHour, t.wMinute, t.wSecond);
        NumClock = TTF_RenderUTF8_Blended(NumFont, Num, NumColor);
        TextureNum = SDL_CreateTextureFromSurface(renderer, NumClock);
        SDL_FreeSurface(NumClock);
        SDL_RenderCopy(renderer, TextureNum, NULL, &NumXY);
        SDL_DestroyTexture(TextureNum);

        DrawHand(renderer, t.wHour, t.wMinute, t.wSecond);

        SDL_RenderPresent(renderer);
    }
//.........这里部分代码省略.........
开发者ID:snakeleon,项目名称:test,代码行数:101,代码来源:SDL_test.cpp


示例14: MYSQLND_METHOD

/* {{{ mysqlnd_debug::log */
static enum_func_status
MYSQLND_METHOD(mysqlnd_debug, log)(MYSQLND_DEBUG * self,
								   unsigned int line, const char * const file,
								   unsigned int level, const char * type, const char * message)
{
	char pipe_buffer[512];
	enum_func_status ret;
	int i;
	char * message_line;
	unsigned int message_line_len;
	unsigned int flags = self->flags;
	char pid_buffer[10], time_buffer[30], file_buffer[200],
		 line_buffer[6], level_buffer[7];
	MYSQLND_ZTS(self);

#ifdef MYSQLND_THREADED
	if (MYSQLND_G(thread_id) != tsrm_thread_id()) {
		return PASS; /* don't trace background threads */
	}
#endif

	if (!self->stream) {
		if (FAIL == self->m->open(self, FALSE)) {
			return FAIL;
		}
	}

	if (level == -1) {
		level = zend_stack_count(&self->call_stack);
	}
	i = MIN(level, sizeof(pipe_buffer) / 2  - 1);
	pipe_buffer[i*2] = '\0';
	for (;i > 0;i--) {
		pipe_buffer[i*2 - 1] = ' ';
		pipe_buffer[i*2 - 2] = '|';
	}


	if (flags & MYSQLND_DEBUG_DUMP_PID) {
		snprintf(pid_buffer, sizeof(pid_buffer) - 1, "%5u: ", self->pid);
		pid_buffer[sizeof(pid_buffer) - 1 ] = '\0';
	}
	if (flags & MYSQLND_DEBUG_DUMP_TIME) {
		/* The following from FF's DBUG library, which is in the public domain */
#if defined(PHP_WIN32)
		/* FIXME This doesn't give microseconds as in Unix case, and the resolution is
		in system ticks, 10 ms intervals. See my_getsystime.c for high res */
		SYSTEMTIME loc_t;
		GetLocalTime(&loc_t);
		snprintf(time_buffer, sizeof(time_buffer) - 1,
				 /* "%04d-%02d-%02d " */
				 "%02d:%02d:%02d.%06d ",
				 /*tm_p->tm_year + 1900, tm_p->tm_mon + 1, tm_p->tm_mday,*/
				 loc_t.wHour, loc_t.wMinute, loc_t.wSecond, loc_t.wMilliseconds);
		time_buffer[sizeof(time_buffer) - 1 ] = '\0';
#else
		struct timeval tv;
		struct tm *tm_p;
		if (gettimeofday(&tv, NULL) != -1) {
			if ((tm_p= localtime((const time_t *)&tv.tv_sec))) {
				snprintf(time_buffer, sizeof(time_buffer) - 1,
						 /* "%04d-%02d-%02d " */
						 "%02d:%02d:%02d.%06d ",
						 /*tm_p->tm_year + 1900, tm_p->tm_mon + 1, tm_p->tm_mday,*/
						 tm_p->tm_hour, tm_p->tm_min, tm_p->tm_sec,
						 (int) (tv.tv_usec));
				time_buffer[sizeof(time_buffer) - 1 ] = '\0';
			}
		}
#endif
	}
	if (flags & MYSQLND_DEBUG_DUMP_FILE) {
		snprintf(file_buffer, sizeof(file_buffer) - 1, "%14s: ", file);
		file_buffer[sizeof(file_buffer) - 1 ] = '\0';
	}
	if (flags & MYSQLND_DEBUG_DUMP_LINE) {
		snprintf(line_buffer, sizeof(line_buffer) - 1, "%5u: ", line);
		line_buffer[sizeof(line_buffer) - 1 ] = '\0';
	}
	if (flags & MYSQLND_DEBUG_DUMP_LEVEL) {
		snprintf(level_buffer, sizeof(level_buffer) - 1, "%4u: ", level);
		level_buffer[sizeof(level_buffer) - 1 ] = '\0';
	}

	message_line_len = spprintf(&message_line, 0, "%s%s%s%s%s%s%s%s\n",
								flags & MYSQLND_DEBUG_DUMP_PID? pid_buffer:"",
								flags & MYSQLND_DEBUG_DUMP_TIME? time_buffer:"",
								flags & MYSQLND_DEBUG_DUMP_FILE? file_buffer:"",
								flags & MYSQLND_DEBUG_DUMP_LINE? line_buffer:"",
								flags & MYSQLND_DEBUG_DUMP_LEVEL? level_buffer:"",
								pipe_buffer, type? type:"", message);

	ret = php_stream_write(self->stream, message_line, message_line_len)? PASS:FAIL;
	efree(message_line);
	if (flags & MYSQLND_DEBUG_FLUSH) {
		self->m->close(self);
		self->m->open(self, TRUE);	
	}
	return ret;
//.........这里部分代码省略.........
开发者ID:browniebraun,项目名称:php-src,代码行数:101,代码来源:mysqlnd_debug.c


示例15: timeGetTime

void CNewRandom::Initialize()
{
	++g_dwNewRandomInstanceCounter;

	DWORD dw;
	dw = timeGetTime();
	AddRandomObject(&dw, 4);

	LARGE_INTEGER li;
	QueryPerformanceCounter(&li);
	AddRandomObject(&li, sizeof(LARGE_INTEGER));

	SYSTEMTIME st;
	ZeroMemory(&st, sizeof(SYSTEMTIME));
	GetLocalTime(&st);
	AddRandomObject(&st, sizeof(SYSTEMTIME));

	POINT pt;
	GetCursorPos(&pt);
	AddRandomObject(&pt, sizeof(POINT));

	WORD ww;
	ww = (WORD)(rand());
	AddRandomObject(&ww, 2);
	ww = (WORD)(rand());
	AddRandomObject(&ww, 2);
	ww = (WORD)(rand());
	AddRandomObject(&ww, 2);

	GetCaretPos(&pt);
	AddRandomObject(&pt, sizeof(POINT));

	MEMORYSTATUS ms;
	GlobalMemoryStatus(&ms);
	AddRandomObject(&ms, sizeof(MEMORYSTATUS));

	dw = (DWORD)(UINT_PTR)GetActiveWindow();
	AddRandomObject(&dw, 4);

	dw = (DWORD)(UINT_PTR)GetCapture();
	AddRandomObject(&dw, 4);

	dw = (DWORD)(UINT_PTR)GetClipboardOwner();
	AddRandomObject(&dw, 4);

#ifndef _WIN32_WCE
	// No support under Windows CE
	dw = (DWORD)(UINT_PTR)GetClipboardViewer();
	AddRandomObject(&dw, 4);
#endif

	dw = GetCurrentProcessId();
	AddRandomObject(&dw, 4);

	dw = (DWORD)(UINT_PTR)GetCurrentProcess();
	AddRandomObject(&dw, 4);

	dw = (DWORD)(UINT_PTR)GetActiveWindow();
	AddRandomObject(&dw, 4);

	dw = GetCurrentThreadId();
	AddRandomObject(&dw, 4);

	dw = (DWORD)(UINT_PTR)GetCurrentThread();
	AddRandomObject(&dw, 4);

	dw = (DWORD)(UINT_PTR)GetDesktopWindow();
	AddRandomObject(&dw, 4);

	dw = (DWORD)(UINT_PTR)GetFocus();
	AddRandomObject(&dw, 4);

	dw = (DWORD)(UINT_PTR)GetForegroundWindow();
	AddRandomObject(&dw, 4);

#ifndef _WIN32_WCE
	dw = (DWORD)GetInputState();
	AddRandomObject(&dw, 4); 
#endif

	dw = GetMessagePos();
	AddRandomObject(&dw, 4);

#ifndef _WIN32_WCE
	dw = (DWORD)GetMessageTime();
	AddRandomObject(&dw, 4);
#endif

	dw = (DWORD)(UINT_PTR)GetOpenClipboardWindow();
	AddRandomObject(&dw, 4);

	dw = (DWORD)(UINT_PTR)GetProcessHeap();
	AddRandomObject(&dw, 4);

	SYSTEM_INFO si;
	GetSystemInfo(&si);
	AddRandomObject(&si, sizeof(SYSTEM_INFO));

	dw = (DWORD)randXorShift();
	AddRandomObject(&dw, 4);
//.........这里部分代码省略.........
开发者ID:xt9852,项目名称:KeePassXT,代码行数:101,代码来源:NewRandom.cpp


示例16: OSEnterMutex


//.........这里部分代码省略.........
        if(hFind = OSFindFirstFile(strOutputFile, ofd))
        {
            String strFileExtension = GetPathExtension(strOutputFile);
            String strFileWithoutExtension = GetPathWithoutExtension(strOutputFile);

            if(strFileExtension.IsValid() && !ofd.bDirectory)
            {
                String strNewFilePath;
                UINT curFile = 0;

                do 
                {
                    strNewFilePath.Clear() << strFileWithoutExtension << TEXT(" (") << FormattedString(TEXT("%02u"), ++curFile) << TEXT(").") << strFileExtension;
                } while(OSFileExists(strNewFilePath));

                strOutputFile = strNewFilePath;

                bUseDateTimeName = false;
            }

            if(ofd.bDirectory)
                strOutputFile.AppendChar('/');

            OSFindClose(hFind);
        }

        if(bUseDateTimeName)
        {
            String strFileName = GetPathFileName(strOutputFile);

            if(!strFileName.IsValid() || !IsSafeFilename(strFileName))
            {
                SYSTEMTIME st;
                GetLocalTime(&st);

                String strDirectory = GetPathDirectory(strOutputFile);
                strOutputFile = FormattedString(TEXT("%s/%u-%02u-%02u-%02u%02u-%02u.mp4"), strDirectory.Array(), st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond);
            }
        }
    }

    //-------------------------------------------------------------

    bufferingTime = GlobalConfig->GetInt(TEXT("General"), TEXT("SceneBufferingTime"), 400);

    //-------------------------------------------------------------

    bForceMicMono = AppConfig->GetInt(TEXT("Audio"), TEXT("ForceMicMono")) != 0;
    bRecievedFirstAudioFrame = false;

    //hRequestAudioEvent = CreateSemaphore(NULL, 0, 0x7FFFFFFFL, NULL);
    hSoundDataMutex = OSCreateMutex();
    hSoundThread = OSCreateThread((XTHREAD)OBS::MainAudioThread, NULL);

    //-------------------------------------------------------------

    StartBlankSoundPlayback(strPlaybackDevice);

    //-------------------------------------------------------------

    ctsOffset = 0;
    videoEncoder = nullptr;
    if (bDisableEncoding)
        videoEncoder = CreateNullVideoEncoder();
    else if(GlobalConfig->GetInt(TEXT("Video Encoding"), TEXT("UseQSV")) != 0)
        videoEncoder = CreateQSVEncoder(fps, outputCX, outputCY, quality, preset, bUsing444, maxBitRate, bufferSize, bUseCFR, bDupeFrames);
开发者ID:AaronMike,项目名称:OBS,代码行数:67,代码来源:OBSCapture.cpp


示例17: GetLocalTime


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GetLocaleByName函数代码示例发布时间:2022-05-30
下一篇:
C++ GetLocalPath函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap