当前位置: 首页>>代码示例>>C++>>正文


C++ _tcscpy函数代码示例

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

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

示例1: StopLogger

void StopLogger(void) {
  TCHAR szMessage[(MAX_PATH*2)+1] = TEXT("\0");
  int iLoggerError=0;  // see switch statement for error handler
  TCHAR sztmplogfile[MAX_PATH+1] = TEXT("\0");
  int retval=0;

  _tcscpy(sztmplogfile,szLoggerFileName); // use LOGGER_TMP, unsigned

  if (LoggerActive) {
    LoggerActive = false;
    if (LoggerClearFreeSpace()) {

    #if (TESTBENCH && DEBUG_LOGGER)
    if (LoggerGActive())
    #else
    if (!SIMMODE && LoggerGActive())
    #endif
	{

	extern int RunSignature();
	retval = RunSignature();
	if (retval!=0) {
		StartupStore(_T(".... LOGGER SIGNATURE ERROR, CODE=%d%s"),retval,NEWLINE);
		switch(retval) {
			case -1:
				StartupStore(_T(".... (EXEQ DEBUG FAILURE)%s"),NEWLINE);
				break;
			case 1:
				StartupStore(_T(".... (SOURCE FILE DISAPPEARED)%s"),NEWLINE);
				break;
			case 3:
				StartupStore(_T(".... (EXEQ WITH WRONG ARGUMENTS)%s"),NEWLINE);
				break;
			case 4:
				StartupStore(_T(".... (BAD ENVIRONMENT)%s"),NEWLINE);
				break;
			case 11:
				StartupStore(_T(".... (LOGGER_TMP DISAPPEARED)%s"),NEWLINE);
				break;
			case 12:
				StartupStore(_T(".... (LOGGER_SIG ALREADY EXISTING)%s"),NEWLINE);
				break;
			case 21:
				StartupStore(_T(".... (MUTEX FAILURE=)%s"),NEWLINE);
				break;
			case 259:
				StartupStore(_T(".... (PROCESS DID NOT TERMINATE!)%s"),NEWLINE);
				break;
			default:
				break;
		}
		// we shall be moving LOGGER_TMP, and leave LOGGER_SIG untouched. In fact we do not know
		// if LOGGER_SIG is or will be available.
	} else {
		// RunSig ok, change logfile to new logger_sig
		StartupStore(_T(". Logger OK, IGC signed with G-Record%s"),NEWLINE);
		DeleteFile(szLoggerFileName);	// remove old LOGGER_TMP
		_tcscpy(sztmplogfile,szSLoggerFileName); // use LOGGER_SIG, signed
	}

	} // logger active

      int imCount=0;
      const int imMax=3;
      for (imCount=0; imCount < imMax; imCount++) {
        // MoveFile() nonzero==Success
        if (0 != MoveFile( sztmplogfile, szFLoggerFileName)) {
          iLoggerError=0;
          break; // success
        }
        Sleep(750); // wait for file system cache to fix itself?
      }
      if (imCount == imMax) { // MoveFile() failed all attempts

        if (0 == MoveFile( sztmplogfile, szFLoggerFileNameRoot)) { // try rename it and leave in root
          iLoggerError=1; //Fail.  NoMoveNoRename
        }
        else {
          iLoggerError=2; //NoMoveYesRename
        }
      }

    } // logger clearfreespace
    else { // Insufficient disk space.  // MoveFile() nonzero==Success
      if (0 == MoveFile( sztmplogfile, szFLoggerFileNameRoot)) { // try rename it and leave in root
        iLoggerError=3; //Fail.  Insufficient Disk Space, NoRename
      }
      else {
        iLoggerError=4; //Success.  Insufficient Disk Space, YesRename
      }
    }

    switch (iLoggerError) { //0=Success 1=NoMoveNoRename 2=NoMoveYesRename 3=NoSpaceNoRename 4=NoSpaceYesRename
    case 0:
      StartupStore(TEXT(". Logger: File saved %s%s"),WhatTimeIsIt(),NEWLINE);
      break;

    case 1: // NoMoveNoRename
      LK_tcsncpy(szMessage,TEXT("--- Logger file not copied.  It is in the root folder of your device and called "),MAX_PATH);
      _tcsncat(szMessage,sztmplogfile,MAX_PATH);
//.........这里部分代码省略.........
开发者ID:AlphaLima,项目名称:LK8000,代码行数:101,代码来源:Logger.cpp


示例2: switch


//.........这里部分代码省略.........

		double target_lon;
		double target_lat;

		target_lon = DrawInfo.FLARM_Traffic[i].Longitude;
		target_lat = DrawInfo.FLARM_Traffic[i].Latitude;

                if (!PointVisible(target_lon, target_lat)) {
                   // StartupStore(_T("... This traffic is not visible on map with current zoom%s"),NEWLINE);
                   continue;
                }

		painted++;

		#if (0) // No scaling, wrong
		if ((EnableFLARMMap==2)&&(scalefact>1.0)) {

			double distance;
			double bearing;

			DistanceBearing(DrawInfo.Latitude, DrawInfo.Longitude, target_lat, target_lon, &distance, &bearing);
			FindLatitudeLongitude(DrawInfo.Latitude, DrawInfo.Longitude, bearing, distance*scalefact, &target_lat, &target_lon);
		}
		#endif
      
		POINT sc, sc_name, sc_av;
		sc = _Proj.ToRasterPoint(target_lat, target_lon);

		sc_name = sc;

		sc_name.y -= NIBLSCALE(16);
		sc_av = sc_name;

		_tcscpy(lbuffer,_T(""));
		if (DrawInfo.FLARM_Traffic[i].Cn[0]!=_T('?')) { // 100322
			_tcscat(lbuffer,DrawInfo.FLARM_Traffic[i].Cn);
		}
		if (DrawInfo.FLARM_Traffic[i].Average30s>=0.1) {
                  size_t len = _tcslen(lbuffer);
                  if (len > 0)
                    _stprintf(lbuffer + len,_T(":%.1f"),LIFTMODIFY*DrawInfo.FLARM_Traffic[i].Average30s);
                  else
                    _stprintf(lbuffer,_T("%.1f"),LIFTMODIFY*DrawInfo.FLARM_Traffic[i].Average30s);
		}

		displaymode.Border=1;

		if (_tcslen(lbuffer)>0)
		TextInBox(Surface, &rc, lbuffer, sc.x+tscaler, sc.y+tscaler, &displaymode, false);

		// red circle
		if ((DrawInfo.FLARM_Traffic[i].AlarmLevel>0) && (DrawInfo.FLARM_Traffic[i].AlarmLevel<4)) {
			DrawBitmapIn(Surface, sc, hFLARMTraffic);
		}
#if 1 // 1
		Arrow[0].x = -4;
		Arrow[0].y = 5;
		Arrow[1].x = 0;
		Arrow[1].y = -6;
		Arrow[2].x = 4;
		Arrow[2].y = 5;
		Arrow[3].x = 0;
		Arrow[3].y = 2;
		Arrow[4].x = -4;
		Arrow[4].y = 5;
开发者ID:LK8000,项目名称:LK8000,代码行数:66,代码来源:LKDrawFLARMTraffic.cpp


示例3: setuservariable

void setuservariable(int varnum, TCHAR *var)
{
	if (var != NULL && varnum >= 0 && varnum < __INST_LAST) 
		_tcscpy(g_variables + varnum*g_stringsize, var);
}
开发者ID:tpn,项目名称:nsis-untgz,代码行数:5,代码来源:nsisUtils.c


示例4: OpenFileMapping

//Activate the Previous Instance of our Application.
HWND CInstanceChecker::ActivatePreviousInstance(LPCTSTR lpCmdLine, ULONG_PTR dwCopyDataItemData, DWORD dwTimeout)
{
  //What will be the return value from this function (assume the worst)
  HWND hWindow = NULL;

  //Try to open the previous instances MMF
  HANDLE hPrevInstance = OpenFileMapping(FILE_MAP_ALL_ACCESS, FALSE, GetMMFFilename());
  if (hPrevInstance)
  {
    //Open up the MMF
    int nMMFSize = sizeof(CWindowInstance);
    CWindowInstance* pInstanceData = static_cast<CWindowInstance*>(MapViewOfFile(hPrevInstance, FILE_MAP_READ | FILE_MAP_WRITE, 0, 0, nMMFSize));
    if (pInstanceData) //Opening the MMF should work
    {
      //Lock the data prior to reading from it
      CSingleLock dataLock(&m_instanceDataMutex, TRUE);

      //activate the old window
      ASSERT(pInstanceData->hMainWnd); //Something gone wrong with the MMF
      hWindow = pInstanceData->hMainWnd;
	  if (::IsWindow(hWindow))
      {
        CWnd wndPrev;
        wndPrev.Attach(hWindow);
        CWnd* pWndChild = wndPrev.GetLastActivePopup();

        //Restore the focus to the previous instance and bring it to the foreground
        if (wndPrev.IsIconic())
          wndPrev.ShowWindow(SW_RESTORE);

        if (pWndChild)
          pWndChild->SetForegroundWindow();

        if (lpCmdLine)
        {  
          //Send the current apps command line to the previous instance using WM_COPYDATA
          COPYDATASTRUCT cds;
          cds.dwData = dwCopyDataItemData;
          DWORD dwCmdLength = static_cast<DWORD>(_tcslen(lpCmdLine) + 1);
          cds.cbData = dwCmdLength * sizeof(TCHAR); 
          TCHAR* pszLocalCmdLine = new TCHAR[dwCmdLength]; //We use a local buffer so that we can specify a constant parameter
                                                           //to this function
        #if (_MSC_VER >= 1400)
          _tcscpy_s(pszLocalCmdLine, dwCmdLength, lpCmdLine);
        #else                                                 
          _tcscpy(pszLocalCmdLine, lpCmdLine);
        #endif
          cds.lpData = pszLocalCmdLine;
          CWnd* pMainWindow = AfxGetMainWnd();
          HWND hSender = NULL;
          if (pMainWindow)
            hSender = pMainWindow->GetSafeHwnd();

          //Send the message to the previous instance. Use SendMessageTimeout instead of SendMessage to ensure we 
          //do not hang if the previous instance itself is hung
          DWORD_PTR dwResult = 0;
          if (SendMessageTimeout(hWindow, WM_COPYDATA, reinterpret_cast<WPARAM>(hSender), reinterpret_cast<LPARAM>(&cds),
                                 SMTO_ABORTIFHUNG, dwTimeout, &dwResult) == 0)
          {
            //Previous instance is not responding to messages
            hWindow = NULL;
          }

          //Tidy up the heap memory we have used
          delete [] pszLocalCmdLine;
        }

        //Detach the CWnd we were using
        wndPrev.Detach();
      }

      //Unmap the MMF we were using
      UnmapViewOfFile(pInstanceData);
    }

    //Close the file handle now that we 
    CloseHandle(hPrevInstance);

    //When we have activate the previous instance, we can release the lock
    ReleaseLock();
  }

  return hWindow;
}
开发者ID:1070094289,项目名称:x3c,代码行数:85,代码来源:sinstance.cpp


示例5: GetWindowThreadProcessId

//-----------------------------------------------------------------------------
// Name: GetHandleInfo
// Object: fill CSelectWindow object information depending of the handle
// Parameters : 
//     in : HWND hWnd handle of the window
// Return : TRUE on success
//-----------------------------------------------------------------------------
BOOL CSelectWindow::GetHandleInfo(HWND hWnd)
{
    DWORD       PID;
    DWORD       TID;

    // get window thread and pid from handle
    TID = GetWindowThreadProcessId (hWnd, &PID);

    ///////////////////////////
    // parent window
    ///////////////////////////
    this->ParentWindowHandle = GetParent (hWnd);
    if (this->ParentWindowHandle != NULL) 
    {
        // parent text
        GetWindowText (this->ParentWindowHandle, this->ParentWindowText, MAX_PATH);
        // parent class name
        GetClassName (this->ParentWindowHandle, this->ParentWindowClassName, MAX_PATH);
    }
    else
    {
        _tcscpy(this->ParentWindowText,_T("Not Available"));
        _tcscpy(this->ParentWindowClassName,_T("Not Available"));
    }

    ///////////////////////////
    // window under cursor
    ///////////////////////////

    // window handle
    this->WindowHandle=hWnd;

    // window extended style
    this->WindowExStyle=(DWORD)GetWindowLongPtr (this->WindowHandle, GWL_EXSTYLE);

    // window style
    this->WindowStyle=(DWORD)GetWindowLongPtr (this->WindowHandle, GWL_STYLE);

    // address of the window procedure 
    this->WindowProc=(DWORD)GetWindowLongPtr (this->WindowHandle, GWLP_WNDPROC);

    // handle to the application instance
    this->WindowHinst=(DWORD)GetWindowLongPtr (this->WindowHandle, GWLP_HINSTANCE);

    // user data associated with the window
    this->WindowUserData=(DWORD)GetWindowLongPtr (this->WindowHandle, GWLP_USERDATA);

    // control ID
    this->WindowControlID=(DWORD)GetWindowLongPtr(this->WindowHandle, GWLP_ID);

    // RECT
    GetWindowRect(this->WindowHandle, &this->WindowRect);
 
    // thread ID
    this->WindowThreadID=TID;
    // process ID
    this->WindowProcessID=PID;

    // class name
    GetClassName (this->WindowHandle, WindowClassName, MAX_PATH);

    // The following values are also available when the hWnd parameter identifies a dialog box.
    // address of the dialog box procedure
    this->WindowDlgProc=(DWORD)GetWindowLongPtr (this->WindowHandle, DWLP_DLGPROC);
    // value of a message processed in the dialog box procedure
    this->WindowDlgMsgResult=(DWORD)GetWindowLongPtr (this->WindowHandle, DWLP_MSGRESULT);
    // extra information private to the application
    this->WindowDlgUser=(DWORD)GetWindowLongPtr (this->WindowHandle, DWLP_USER);

    return TRUE;
}
开发者ID:340211173,项目名称:hf-2011,代码行数:78,代码来源:SelectWindow.cpp


示例6: switch

BOOL CALLBACK SessionDialog::SessDlgProc(  HWND hwnd,  UINT uMsg,  WPARAM wParam, LPARAM lParam ) {
	// This is a static method, so we don't know which instantiation we're 
	// dealing with. But we can get a pseudo-this from the parameter to 
	// WM_INITDIALOG, which we therafter store with the window and retrieve
	// as follows:
    SessionDialog*_this = helper::SafeGetWindowUserData<SessionDialog>(hwnd);

	switch (uMsg) {

	case WM_INITDIALOG:
		{
            helper::SafeSetWindowUserData(hwnd, lParam);
            SessionDialog *l_this = (SessionDialog *) lParam;
            CentreWindow(hwnd);
			SetForegroundWindow(hwnd);
			l_this->m_pCC->m_hSessionDialog = hwnd;

            // Set up recently-used list
            HWND hcombo = GetDlgItem(  hwnd, IDC_HOSTNAME_EDIT);
            TCHAR valname[256];

            for (int i = 0; i < l_this->m_pMRU->NumItems(); i++) {
                l_this->m_pMRU->GetItem(i, valname, 255);
                int pos = SendMessage(hcombo, CB_ADDSTRING, 0, (LPARAM) valname);

            }
            SendMessage(hcombo, CB_SETCURSEL, 0, 0);

			// [email protected] - List available DSM Plugins
			HWND hPlugins = GetDlgItem(hwnd, IDC_PLUGINS_COMBO);
			int nPlugins = l_this->m_pDSMPlugin->ListPlugins(hPlugins);
			if (!nPlugins)
			{
				SendMessage(hPlugins, CB_ADDSTRING, 0, (LPARAM) sz_F11);
			}
			else
			{
				// Use the first detected plugin, so the user doesn't have to check the option
				// HWND hUsePlugin = GetDlgItem(hwnd, IDC_PLUGIN_CHECK);
				// SendMessage(hUsePlugin, BM_SETCHECK, TRUE, 0);
			}
			SendMessage(hPlugins, CB_SETCURSEL, 0, 0);

			HWND hButton = GetDlgItem(hwnd, IDC_PLUGIN_BUTTON);
			EnableWindow(hButton, FALSE); // [email protected] - Disable plugin config button by default

			//AaronP
			if( strcmp( l_this->m_pOpt->m_szDSMPluginFilename, "" ) != 0 && l_this->m_pOpt->m_fUseDSMPlugin )
			{ 
				int pos = SendMessage(hPlugins, CB_FINDSTRINGEXACT, -1,
					(LPARAM)&(l_this->m_pOpt->m_szDSMPluginFilename[0]));

				if( pos != CB_ERR )
				{
					SendMessage(hPlugins, CB_SETCURSEL, pos, 0);
					HWND hUsePlugin = GetDlgItem(hwnd, IDC_PLUGIN_CHECK);
					SendMessage(hUsePlugin, BM_SETCHECK, TRUE, 0);
					EnableWindow(hButton, TRUE); // [email protected] - Enable plugin config button
				}
			}
			//EndAaronP

			TCHAR tmphost[256];
			TCHAR tmphost2[256];
			_tcscpy(tmphost, l_this->m_pOpt->m_proxyhost);
			if (strcmp(tmphost,"")!=NULL)
			{
			_tcscat(tmphost,":");
			_tcscat(tmphost,_itoa(l_this->m_pOpt->m_proxyport,tmphost2,10));
			SetDlgItemText(hwnd, IDC_PROXY_EDIT, tmphost);
			}

			HWND hViewOnly = GetDlgItem(hwnd, IDC_VIEWONLY_CHECK);
			SendMessage(hViewOnly, BM_SETCHECK, l_this->m_pOpt->m_ViewOnly, 0);

			HWND hAutoScaling = GetDlgItem(hwnd, IDC_AUTOSCALING_CHECK);
			SendMessage(hAutoScaling, BM_SETCHECK, l_this->m_pOpt->m_fAutoScaling, 0);

			HWND hExitCheck = GetDlgItem(hwnd, IDC_EXIT_CHECK); //PGM @ Advantig
			SendMessage(hExitCheck, BM_SETCHECK, l_this->m_pOpt->m_fExitCheck, 0); //PGM @ Advantig

			HWND hProxy = GetDlgItem(hwnd, IDC_PROXY_CHECK);
			SendMessage(hProxy, BM_SETCHECK, l_this->m_pOpt->m_fUseProxy, 0);


			// [email protected] - Make the save settings optional but always enabled by default (for now)
			// (maybe disabled as default is better ?)
			HWND hSave = GetDlgItem(hwnd, IDC_SETDEFAULT_CHECK);
//ACT			SendMessage(hSave, BM_SETCHECK, true, 0);


			// [email protected] - Select Modem Option as default
			l_this->SetQuickOption(l_this, hwnd);

			l_this->m_fFromOptions = false;
			l_this->m_fFromFile = false;

            return TRUE;
		}

//.........这里部分代码省略.........
开发者ID:newmind,项目名称:uvnc_rds,代码行数:101,代码来源:SessionDialog.cpp


示例7: DCUnhandledExceptionFilter

LONG __stdcall DCUnhandledExceptionFilter( LPEXCEPTION_POINTERS e )
{	
#ifdef __DEBUG
	MessageBox(NULL, _T("If you would like to debug DCUnhandledExceptionFilter - attach to this process now"), _T(APPNAME), MB_OK);
#endif
	Lock l(cs);

	if(recursion++ > 30)
		exit(-1);

#ifndef _DEBUG
#if _MSC_VER == 1200
	__pfnDliFailureHook = FailHook;
#elif _MSC_VER == 1300 || _MSC_VER == 1310 || _MSC_VER == 1400
	__pfnDliFailureHook2 = FailHook;
#else
#error Unknown Compiler version
#endif

	// The release version loads the dll and pdb:s here...
	InitSymInfo(Text::toT(Util::getDataPath()).c_str());

#endif
	TCHAR pdbPath[MAX_PATH];
	GetModuleFileName(NULL, pdbPath, sizeof(pdbPath));
	TCHAR* dotPtr = _tcschr(pdbPath, '.');
	if (dotPtr != NULL) {
		_tcscpy(dotPtr, _T(".pdb"));
	}

	if (GetFileAttributes(pdbPath) == INVALID_FILE_ATTRIBUTES) {
		// No debug symbols, we're not interested...
		::MessageBox(WinUtil::mainWnd, _T(APPNAME) _T(" has crashed and you don't have .PDB file installed. Hence, I can't find out why it crashed, so don't report this as a bug unless you find a solution..."), _T(APPNAME) _T(" has crashed"), MB_OK);
#ifndef _DEBUG
		exit(1);
#else
		return EXCEPTION_CONTINUE_SEARCH;
#endif
	}
	File f(Util::getConfigPath() + "exceptioninfo.txt", File::WRITE, File::OPEN | File::CREATE);
	f.setEndPos(0);
	
	char buf[DEBUG_BUFSIZE];
	sprintf(buf, 
		"Code: %x (%s)\r\n"
		"Version: %d (%s)\r\n", 
		e->ExceptionRecord->ExceptionCode,
		getExceptionName(e->ExceptionRecord->ExceptionCode),
		BUILDID, 
		Util::getCompileDate().c_str());

	tstring exceptioninfo = Text::toT(buf);
	f.write(buf, strlen(buf));	
	
	OSVERSIONINFOEX ver;
	WinUtil::getVersionInfo(ver);
	const char *productType;
	if (ver.wProductType == VER_NT_DOMAIN_CONTROLLER) {
		productType = "domain controller";
	}
	else if (ver.wProductType == VER_NT_SERVER) {
		productType = "server";
	}
	else if (ver.wProductType == VER_NT_WORKSTATION) {
		productType = "workstation";
	}
	else {
		productType = "unknown product type";
	}

	sprintf(buf, "OS Version: %d.%d build %d service pack %d %s\r\n",
		(DWORD)ver.dwMajorVersion, (DWORD)ver.dwMinorVersion, (DWORD)ver.dwBuildNumber,
		(DWORD)ver.wServicePackMajor, productType);

	exceptioninfo += Text::toT(buf);
	f.write(buf, strlen(buf));

	time_t now;
	time(&now);
	strftime(buf, DEBUG_BUFSIZE, "Time: %Y-%m-%d %H:%M:%S\r\n", localtime(&now));

	exceptioninfo += Text::toT(buf);
	f.write(buf, strlen(buf));

#if 0
	WinUtil::exceptioninfo += LIT(_T("TTH: "));
	WinUtil::exceptioninfo += Text::toT(tth);
	WinUtil::exceptioninfo += LIT(_T("\r\n\r\n"));
#endif

    f.write(LIT("\r\n"));
	exceptioninfo += _T("\r\n");

        // !SMT!
        sprintf(buf,
	       "exception code %08X at eip=%08X, nested: %08X\r\n"
	       "eax=%08X ebx=%08X ecx=%08X edx=%08X\r\n"
          "esi=%08X edi=%08X ebp=%08X esp=%08X\r\n",
		e->ExceptionRecord->ExceptionCode, 
		e->ExceptionRecord->ExceptionAddress, 
//.........这里部分代码省略.........
开发者ID:inetra,项目名称:peers1,代码行数:101,代码来源:main.cpp


示例8: ASSERT

CLanguage::CLanguage( LPCTSTR pszName, CM_LANGUAGE *pLang )
{
   //////////////////////////////////
   // Must make complete copy of language details
   //////////////////////////////////
   ASSERT( pszName );
   ASSERT( pLang );
   _tcsncpy( m_szName, pszName, ARRAY_SIZE(m_szName) );
   m_szName[ARRAY_SIZE(m_szName) - 1] = 0;

   int nLen = ( pLang->pszKeywords ? _tcslen( pLang->pszKeywords ) + 1 : 0 ) +
              ( pLang->pszOperators ? _tcslen( pLang->pszOperators ) + 1 : 0 ) +
              ( pLang->pszSingleLineComments ? _tcslen( pLang->pszSingleLineComments ) + 1 : 0 ) +
              ( pLang->pszMultiLineComments1 ? _tcslen( pLang->pszMultiLineComments1 ) + 1 : 0 ) +
              ( pLang->pszMultiLineComments2 ? _tcslen( pLang->pszMultiLineComments2 ) + 1 : 0 ) +
              ( pLang->pszScopeKeywords1 ? _tcslen( pLang->pszScopeKeywords1 ) + 1 : 0 ) +
              ( pLang->pszScopeKeywords2 ? _tcslen( pLang->pszScopeKeywords2 ) + 1 : 0 ) +
              ( pLang->pszStringDelims ? _tcslen( pLang->pszStringDelims ) + 1 : 0 ) +
              ( pLang->pszTagElementNames ? _tcslen( pLang->pszTagElementNames ) + 1 : 0 ) +
              ( pLang->pszTagAttributeNames ? _tcslen( pLang->pszTagAttributeNames ) + 1 : 0 ) +
              ( pLang->pszTagEntities ? _tcslen( pLang->pszTagEntities ) + 1 : 0 );

   int cbLang = sizeof( CM_LANGUAGE ) +       // the language structure
                sizeof( DWORD ) +             // size of language struct
                sizeof( TCHAR ) * ( nLen + 1 ); // the lang buffer. +1 in case nLen = 0
   m_pLang = ( CM_LANGUAGE * ) new BYTE[ cbLang ];
   ZeroMemory( m_pLang, cbLang );

   *( ( LPDWORD ) ( m_pLang + 1 ) ) = cbLang;
   m_pLang->bIsCaseSensitive = pLang->bIsCaseSensitive;
   m_pLang->chEscape = pLang->chEscape;
   m_pLang->chTerminator = pLang->chTerminator;
   m_pLang->dwStyle = pLang->dwStyle;

   LPTSTR pszOut = ( LPTSTR ) ( ( LPBYTE ) ( m_pLang + 1 ) + sizeof( DWORD ) );

   if ( pLang->pszKeywords )
   {
      _tcscpy( pszOut, pLang->pszKeywords );
      m_pLang->pszKeywords = pszOut;
      pszOut += _tcslen( pLang->pszKeywords ) + 1;
   }

   if ( pLang->pszOperators )
   {
      _tcscpy( pszOut, pLang->pszOperators );
      m_pLang->pszOperators = pszOut;
      pszOut += _tcslen( pLang->pszOperators ) + 1;
   }

   if ( pLang->pszSingleLineComments )
   {
      _tcscpy( pszOut, pLang->pszSingleLineComments );
      m_pLang->pszSingleLineComments = pszOut;
      pszOut += _tcslen( pLang->pszSingleLineComments ) + 1;
   }

   if ( pLang->pszMultiLineComments1 )
   {
      _tcscpy( pszOut, pLang->pszMultiLineComments1 );
      m_pLang->pszMultiLineComments1 = pszOut;
      pszOut += _tcslen( pLang->pszMultiLineComments1 ) + 1;
      _tcscpy( pszOut, pLang->pszMultiLineComments2 );
      m_pLang->pszMultiLineComments2 = pszOut;
      pszOut += _tcslen( pLang->pszMultiLineComments2 ) + 1;
   }

   if ( pLang->pszScopeKeywords1 )
   {
      _tcscpy( pszOut, pLang->pszScopeKeywords1 );
      m_pLang->pszScopeKeywords1 = pszOut;
      pszOut += _tcslen( pLang->pszScopeKeywords1 ) + 1;
      _tcscpy( pszOut, pLang->pszScopeKeywords2 );
      m_pLang->pszScopeKeywords2 = pszOut;
      pszOut += _tcslen( pLang->pszScopeKeywords2 ) + 1;
   }

   if ( pLang->pszStringDelims )
   {
      _tcscpy( pszOut, pLang->pszStringDelims );
      m_pLang->pszStringDelims = pszOut;
      pszOut += _tcslen( pLang->pszStringDelims ) + 1;
   }

   if ( pLang->pszTagElementNames )
   {
      _tcscpy( pszOut, pLang->pszTagElementNames );
      m_pLang->pszTagElementNames = pszOut;
      pszOut += _tcslen( pLang->pszTagElementNames ) + 1;
   }

   if ( pLang->pszTagAttributeNames )
   {
      _tcscpy( pszOut, pLang->pszTagAttributeNames );
      m_pLang->pszTagAttributeNames = pszOut;
      pszOut += _tcslen( pLang->pszTagAttributeNames ) + 1;
   }

   if ( pLang->pszTagEntities )
   {
//.........这里部分代码省略.........
开发者ID:DeegC,项目名称:ZeidonTools,代码行数:101,代码来源:language.cpp


示例9: switch


//.........这里部分代码省略.........
    break;
  case 51:
    Value = DISTANCEMODIFY*Calculated().AATTargetDistance ;
    Valid = task.ValidTaskPoint(task.getActiveIndex()) && task.getSettings().AATEnabled;
    break;
  case 52:
    Value = TASKSPEEDMODIFY*Calculated().AATTargetSpeed;
    Valid = task.ValidTaskPoint(task.getActiveIndex()) && task.getSettings().AATEnabled;
    if (Calculated().AATTimeToGo<1) {
      Valid = false;
    }
    break;
  case 53:
    if (Calculated().LDvario== 999) {
      Valid = false;
    } else {
      Valid = Basic().VarioAvailable && Basic().AirspeedAvailable;
      Value = Calculated().LDvario;
    }
    break;
  case 54:
    Valid = Basic().AirspeedAvailable;
    Value = SPEEDMODIFY*Basic().TrueAirspeed;
    break;
  case 56: // team bearing
    Value = Calculated().TeammateBearing;
    Valid = true;
  case 58: // team range
    if (SettingsComputer().TeammateCodeValid)
      {
	Value = DISTANCEMODIFY*Calculated().TeammateRange;
	if (Value > 100)
	  {
	    _tcscpy(Format, _T("%.0lf"));
	  }
	else
	  {
	    _tcscpy(Format, _T("%.1lf"));
	  }
	Valid = true;
      }
    else
      {
	Valid = false;
      }
    break;
  case 59:
    Value = TASKSPEEDMODIFY*Calculated().TaskSpeedInstantaneous;
    if (task.getActiveIndex()>=1) {
      Valid = task.ValidTaskPoint(task.getActiveIndex());
    } else {
      Valid = false;
    }
    break;
  case 60:
    Value = DISTANCEMODIFY*Calculated().HomeDistance ;
    if (SettingsComputer().HomeWaypoint>=0) {
      Valid = way_points.verify_index(SettingsComputer().HomeWaypoint);
    } else {
      Valid = false;
    }
    break;
  case 61:
    Value = TASKSPEEDMODIFY*Calculated().TaskSpeedAchieved;
    if (task.getActiveIndex()>=1) {
      Valid = task.ValidTaskPoint(task.getActiveIndex());
开发者ID:scottp,项目名称:xcsoar,代码行数:67,代码来源:Base.cpp


示例10: strcpy

void CFileMoveProcess::ProcessFiles ( CList<CFileInfo *, CFileInfo *> & FileList)
{
 CString Msg;
	SHFILEOPSTRUCT fos;
 TCHAR pDirBuffer[MAX_PATH];
 TCHAR pFilenameBuffer[MAX_PATH];
 CFileInfo * pFileInfo;
 POSITION ListPos;

	// setup to directory buffer
// pDirBuffer = new TCHAR[m_Dir.GetLength()+2];
 strcpy( pDirBuffer, (LPCSTR) m_Dir);
 pDirBuffer[m_Dir.GetLength()] = '\0';
 pDirBuffer[m_Dir.GetLength()+1] = '\0';
 //

	// setup struct
 fos.hwnd = AfxGetMainWnd()->m_hWnd;
 fos.wFunc= FO_MOVE;
	fos.pTo =  pDirBuffer;
	fos.fFlags = FOF_ALLOWUNDO | FOF_NOERRORUI;
	fos.lpszProgressTitle = "NULL";
 //
	
	// set confirmation flag
	if ( m_YesToAll ) fos.fFlags |= FOF_NOCONFIRMATION;
 //


	/*	for ( int i = 0; i < FileList.GetSize(); i++)
		{
			//if ( ((CDuffDlg*)GetParent()->GetParent())->m_DuplicatePage.m_DupeList.GetCheck(i) == BST_CHECKED )
			//{
				Temp = FileList.ElementAt(i).m_Filename;
				//TotalLength += Temp.GetLength() +1;
				FilesToDelete.Add(Temp);
			//}
		}
		*/


 // update progress information
	pDuffStatus->Lock();
	pDuffStatus->CurrentTaskStr = "Moving selected duplicate files...";
	pDuffStatus->CurrentTaskInfo = "";
	pDuffStatus->SubProgress1.Min = 0;
	pDuffStatus->SubProgress1.Pos = 0;
	pDuffStatus->SubProgress1.Max = FileList.GetCount();
	pDuffStatus->Unlock();
	//


	ListPos = FileList.GetHeadPosition();

	while (ListPos)
	{
		pFileInfo = FileList.GetAt(ListPos);

		// process only the selected files
		if ( pFileInfo->Selected)
		{
			if ( ! (pFileInfo->Attributes & FILE_ATTRIBUTE_READONLY)  || m_MoveReadOnly )
			{

				/*				// remove read-only attribute
			 if ( FileList.ElementAt(i)->ReadOnly )
			 {
			 	DWORD FileAttributes;
			 	FileAttributes = GetFileAttributes( FileList.ElementAt(i)->Filename )
			 	FileAttributes ^= FILE_ATTRIBUTE_READONLY;
     SetFileAttributes(FileList.ElementAt(i)->Filename,FileAttributes );
			 }*/

	
			 _tcscpy(pFilenameBuffer, pFileInfo->GetFullName() );

    UINT			Length = _tcslen( pFilenameBuffer );

			//		for (int x = 0; x < FileList.ElementAt(i)->Filename.GetLength(); x++)
	//		{
		//		pFilenameBuffer[x] = FileList.ElementAt(i)->Filename.GetAt(x);
		//	}

		 	pFilenameBuffer[Length] = 0;
		 	pFilenameBuffer[Length+1] = 0;

			 fos.pFrom = pFilenameBuffer;

			 //		g_DupeFileFind.GetDuffDlg()->m_CurrentTaskInfoText.SetWindowText(FileList.ElementAt(i)->GetFullName());
	   //		g_DupeFileFind.GetDuffDlg()->m_CurrentTaskInfoText.RedrawWindow();

		 	// update progress information
		  pDuffStatus->Lock();
		  pDuffStatus->CurrentTaskInfo = pFileInfo->GetFullName();
		  pDuffStatus->SubProgress1.Pos++;
		  pDuffStatus->Unlock();
		  //

			
		 	/*	
//.........这里部分代码省略.........
开发者ID:GerHobbelt,项目名称:duff,代码行数:101,代码来源:FileMoveProcess.cpp


示例11: _tcscpy

void InfoBoxFormatter::RenderInvalid(int *color) {
  _tcscpy(CommentText, _T(""));
  _tcscpy(Text, _T("---"));
  *color = -1;
}
开发者ID:scottp,项目名称:xcsoar,代码行数:5,代码来源:Base.cpp


示例12: CopyString

bool
EWDevice::AddWaypoint(const Waypoint &way_point, OperationEnvironment &env)
{
  char EWRecord[100];
  TCHAR IDString[12];
  int DegLat, DegLon;
  double tmp, MinLat, MinLon;
  char NoS, EoW;

  // check for max 6 TP's
  if (ewDecelTpIndex > 6)
    return false;

  // copy at most 6 chars
  CopyString(IDString, way_point.name.c_str(), 7);

  // fill up with spaces
  while (_tcslen(IDString) < 6)
    _tcscat(IDString, _T(" "));

#if USESHORTTPNAME > 0
  // truncate to short name
  _tcscpy(&IDString[3], _T("   "));
#endif

  // prepare lat
  tmp = (double)way_point.location.latitude.Degrees();
  NoS = 'N';
  if (tmp < 0) {
    NoS = 'S';
    tmp = -tmp;
  }
  DegLat = (int)tmp;
  MinLat = (tmp - DegLat) * 60 * 1000;

  // prepare long
  tmp = (double)way_point.location.longitude.Degrees();
  EoW = 'E';
  if (tmp < 0) {
    EoW = 'W';
    tmp = -tmp;
  }
  DegLon = (int)tmp;
  MinLon = (tmp - DegLon) * 60 * 1000;

  //	Calc E/W and N/S flags

  // prepare flags
  const unsigned EoW_Flag = EoW == 'W' ? 0x08 : 0x04;
  const unsigned NoS_Flag = NoS == 'N' ? 0x01 : 0x02;

  //  Do the calculation
  const unsigned EW_Flags = (short)(EoW_Flag | NoS_Flag);

  // setup command string
  sprintf(EWRecord, "#STP%02X%02X%02X%02X%02X%02X%02X%02X%02X%04X%02X%04X",
          ewDecelTpIndex, IDString[0], IDString[1], IDString[2], IDString[3],
          IDString[4], IDString[5], EW_Flags, DegLat, (int)MinLat / 10, DegLon,
          (int)MinLon / 10);
  WriteWithChecksum(port, EWRecord);

  // wait for response
  if (!port.ExpectString("OK\r", env))
    return false;

  // increase TP index
  ewDecelTpIndex++;

  return true;
}
开发者ID:Adrien81,项目名称:XCSoar,代码行数:70,代码来源:EW.cpp


示例13: LCT_DumpResult

void LCT_DumpResult(const TCHAR* pszHint)
{
    const LCT_LINE* pl;
    const LCT_FILE* pf;
    TCHAR szFile[2*MAX_PATH];
    long nNewHits;
    long nOldHits;
    long nAllTest;
    FILE* pFile;
return;
    szFile[0] = 0;
    GetModuleFileName(NULL, szFile, FC_ARRAY_LEN(szFile));
    _tcscat(szFile, _T(".clt"));


    if(!FC_Exist(szFile))
    {
        _tprintf(_T("TEST: line coverage: create '%s'\n"), szFile);
          pFile = _tfopen(szFile, _T("at"));
        if(!pFile)
        {
            _tprintf(_T("error: line coverage test: cannot write file '%s'\n"),szFile);
            return;
        }

        for(pf= &g_lctfileList[0]; pf->pszSrc; pf++)
        {
            fprintf(pFile, "\n[%s]\n", pf->pszSrc);
            for(pl= &pf->pLines[0]; pl->lineNo>0; pl++)
                fprintf(pFile, "%d=TODO: %s\n", pl->lineNo, pl->pszInf);
        }
        fclose(pFile);
    }

// _tprintf(_T("TEST: line coverage: update '%s'\n"), szFile);

    if(pszHint)
        WritePrivateProfileString(_T("<History>"), "12.56.2002", pszHint, szFile);

    nNewHits = nOldHits = nAllTest = 0;
    for(pf= &g_lctfileList[0]; pf->pszSrc; pf++)
    {
        TCHAR szLineNo[64];
        TCHAR szBuffer[MAX_PATH];

        for(pl= &pf->pLines[0]; pl->lineNo>0; pl++)
        {
            nAllTest++;
            ltoa(pl->lineNo, szLineNo, 10);
            if(LCT_IsHit(pf->pszSrc, pl->lineNo))
            {
                _tcscpy(szBuffer, _T("OK: "));
                _tcscat(szBuffer, pl->pszInf);
                WritePrivateProfileString(pf->pszSrc, szLineNo, szBuffer, szFile);
                    nNewHits++;
            }
            else
            {
                GetPrivateProfileString(pf->pszSrc, szLineNo, _T(""), 
                szBuffer, FC_ARRAY_LEN(szBuffer), szFile);

                if(FC_StringBeginI(szBuffer, _T("OK:")))
                    nOldHits++;
            }
        }
    }

     _tprintf(_T("TEST: line coverage: new hits=%d, old hits=%d  (left to do=%d of %d)\n"),
         nNewHits, nOldHits, nAllTest-nNewHits-nOldHits, nAllTest);  

     if(g_lctHash)
     {
        g_lctHash->deletePtrs();
        delete(g_lctHash);
        g_lctHash = NULL;
     }

}
开发者ID:LM25TTD,项目名称:ATCMcontrol_Engineering,代码行数:78,代码来源:helper.cpp


示例14: switch

void PortCache::GetPortStateText(DWORD dwPortState, int nLanguageID, TCHAR szPortState[])
{
	switch (dwPortState)
	{
	case MIB_TCP_STATE_CLOSED:
		_tcscpy(szPortState, nLanguageID == 0 ? _T("已经关闭") : _T("CLOSED")); break;
	case MIB_TCP_STATE_LISTEN:
		_tcscpy(szPortState, nLanguageID == 0 ? _T("正在监听") : _T("LISTEN")); break;
	case MIB_TCP_STATE_SYN_SENT:
		_tcscpy(szPortState, nLanguageID == 0 ? _T("发送请求") : _T("SYN_SENT")); break;
	case MIB_TCP_STATE_SYN_RCVD:
		_tcscpy(szPortState, nLanguageID == 0 ? _T("接收请求") : _T("SYN_RCVD")); break;
	case MIB_TCP_STATE_ESTAB:
		_tcscpy(szPortState, nLanguageID == 0 ? _T("已经建立") : _T("ESTABLISHED")); break;
	case MIB_TCP_STATE_FIN_WAIT1:
		_tcscpy(szPortState, nLanguageID == 0 ? _T("等待 1") : _T("FIN_WAIT1")); break;
	case MIB_TCP_STATE_FIN_WAIT2:
		_tcscpy(szPortState, nLanguageID == 0 ? _T("等待 2") : _T("FIN_WAIT2")); break;
	case MIB_TCP_STATE_CLOSE_WAIT:
		_tcscpy(szPortState, nLanguageID == 0 ? _T("等待关闭") : _T("CLOSE_WAIT")); break;
	case MIB_TCP_STATE_CLOSING:
		_tcscpy(szPortState, nLanguageID == 0 ? _T("正在关闭") : _T("CLOSING")); break;
	case MIB_TCP_STATE_LAST_ACK:
		_tcscpy(szPortState, nLanguageID == 0 ? _T("等待中断") : _T("LAST_ACK")); break;
	case MIB_TCP_STATE_TIME_WAIT:
		_tcscpy(szPortState, nLanguageID == 0 ? _T("等待超时") : _T("TIME_WAIT")); break;
	case MIB_TCP_STATE_DELETE_TCB:
		_tcscpy(szPortState, nLanguageID == 0 ? _T("删除TCB") : _T("DELETE")); break;
	default:
		break;
	}
}
开发者ID:YaoXuanZhi,项目名称:win32-netmon,代码行数:32,代码来源:PortCache.cpp


示例15: GetModuleFileName

// Fetch the map file full path name.
HANDLE LocationDialog::openMapFile(char* mapName)
{
	HANDLE hMap;
	TCHAR fileName[MAX_PATH];
	int len;

	// Get subdir containing this plugin.
	GetModuleFileName(hInstance, fileName, MAX_PATH);

	// Append subdir string containing maps.
	TCHAR *slash = _tcsrchr(fileName, '\\');
	if (slash) {
		_tcscpy(slash, SGEOLOC);
	} else {
		// If the plugin filename contains no path information, look in plugcfg.
		_tcscpy(fileName,theInterface->GetDir(APP_PLUGCFG_DIR));
		len = _tcslen(fileName);
		if (len) {
			if (_tcscmp(&fileName[len-1],_T("\\")))
				_tcscat(fileName,_T("\\"));
		}
	}

	_tcscat(fileName,mapName);
	hMap = CreateFile(fileName, GENERIC_READ, FILE_SHARE_READ, NULL,
						OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
	if (hMap == INVALID_HANDLE_VALUE) {
		// If that fails, look in the MaxStart dir.
		_tcscpy(fileName,theInterface->GetDir(APP_MAXSTART_DIR));
		len = _tcslen(fileName);
		if (len) {
			if (_tcscmp(&fileName[len-1],_T("\\")))
				_tcscat(fileName,_T("\\"));
			_tcscat(fileName, GEOLOC);
		}   
		_tcscat(fileName,mapName);
		hMap = CreateFile(fileName, GENERIC_READ, FILE_SHARE_READ, NULL,
							OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
		if (hMap == INVALID_HANDLE_VALUE) {
			// If THAT fails, look beneath the main exe dir.
			_tcscpy(fileName,theInterface->GetDir(APP_MAXROOT_DIR));
			len = _tcslen(fileName);
			if (len) {
				if (_tcscmp(&fileName[len-1],_T("\\")))
					_tcscat(fileName,_T("\\"));
			}
			_tcscat(fileName, GEOLOC);
			_tcscat(fileName,mapName);
			hMap = CreateFile(fileName, GENERIC_READ, FILE_SHARE_READ, NULL,
							OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
			if (hMap == INVALID_HANDLE_VALUE) {
				// Last try: If THAT fails, look IN the main exe dir.
				_tcscpy(fileName,theInterface->GetDir(APP_MAXROOT_DIR));
				len = _tcslen(fileName);
				if (len) {
					if (_tcscmp(&fileName[len-1],_T("\\")))
						_tcscat(fileName,_T("\\"));
				}
				_tcscat(fileName,mapName);
				hMap = CreateFile(fileName, GENERIC_READ, FILE_SHARE_READ, NULL,
								OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
			}
		}
	}

	return hMap;
}
开发者ID:DimondTheCat,项目名称:xray,代码行数:68,代码来源:geoloc.cpp


示例16: TestPathCchStripPrefix

int TestPathCchStripPrefix(int argc, char* argv[])
{
	HRESULT status;
	TCHAR Path[PATHCCH_MAX_CCH];
	int i;

	/**
	 * PathCchStripPrefix returns S_OK if the prefix was removed, S_FALSE if
	 * the path did not have a prefix to remove, or an HRESULT failure code.
	 */


	/* Path with prefix (File Namespace) */

	_tcscpy(Path, testPathPrefixFileNamespace);

	status = PathCchStripPrefix(Path, sizeof(testPathPrefixFileNamespace) / sizeof(TCHAR));

	if (status != S_OK)
	{
		_tprintf(_T("PathCchStripPrefix status: 0x%08X\n"), status);
		return -1;
	}

	if (_tcscmp(Path, testPathNoPrefixFileNamespace) != 0)
	{
		_tprintf(_T("Path Mismatch: Actual: %s, Expected: %s\n"), Path, testPathNoPrefixFileNamespace);
		return -1;
	}

	/* Path with prefix (Device Namespace) */

	_tcscpy(Path, testPathPrefixDeviceNamespace);

	status = PathCchStripPrefix(Path, sizeof(testPathPrefixDeviceNamespace) / sizeof(TCHAR));

	if (status != S_FALSE)
	{
		_tprintf(_T("PathCchStripPrefix status: 0x%08X\n"), status);
		return -1;
	}

	if (_tcscmp(Path, testPathPrefixDeviceNamespace) != 0)
	{
		_tprintf(_T("Path Mismatch: Actual: %s, Expected: %s\n"), Path, testPathPrefixDeviceNamespace);
		return -1;
	}

	/* NULL Path */
	status = PathCchStripPrefix(NULL, PATHCCH_MAX_CCH);
	if (status != E_INVALIDARG)
	{
		_tprintf(_T("PathCchStripPrefix with null path unexpectedly succeeded with status 0x%08X\n"), status);
		return -1;
	}

	/* Invalid cchPath values: 0, 1, 2, 3 and > PATHCCH_MAX_CCH */
	for (i = 0; i < 5; i++)
	{
		_tcscpy(Path, testPathPrefixFileNamespace);
		if (i == 4)
			i = PATHCCH_MAX_CCH + 1;
		status = PathCchStripPrefix(Path, i);
		if (status != E_INVALIDARG)
		{
			_tprintf(_T("PathCchStripPrefix with invalid cchPath value %d unexpectedly succeeded with status 0x%08X\n"), i, status);
			return -1;
		}
	}

	/* Minimum Path that would get successfully stripped on windows */
	_tcscpy(Path, testPathPrefixFileNamespaceMinimum);
	i = sizeof(testPathPrefixFileNamespaceMinimum) / sizeof(TCHAR);
	i = i - 1; /* include testing of a non-null terminated string */
	status = PathCchStripPrefix(Path, i);
	if (status != S_OK)
	{
		_tprintf(_T("PathCchStripPrefix with minimum valid strippable path length unexpectedly returned status 0x%08X\n"), status);
		return -1;
	}
	if (_tcscmp(Path, testPathNoPrefixFileNamespaceMinimum))
	{
		_tprintf(_T("Path Mismatch: Actual: %s, Expected: %s\n"), Path, testPathNoPrefixFileNamespaceMinimum);
		return -1;
	}

	/* Invalid drive letter symbol */
	_tcscpy(Path, _T("\\\\?\\5:"));
	status = PathCchStripPrefix(Path, 6);
	if (status == S_OK)
	{
		_tprintf(_T("PathCchStripPrefix with invalid drive letter symbol unexpectedly succeeded\n"));
		return -1;
	}

	return 0;
}
开发者ID:BUGgs,项目名称:FreeRDP,代码行数:97,代码来源:TestPathCchStripPrefix.c


示例17: SetUnits

 void SetUnits(const TCHAR *text) { _tcscpy(mUnits, text); }
开发者ID:galippi,项目名称:xcsoar,代码行数:1,代码来源:Base.hpp


示例18: dc


//.........这里部分代码省略.........
							   (strAttributes[0] != _T(' ')))
						{
							m--;
							strAttributes = strAttributes.Mid(1);
						}
					}
				}
				n -= index + 1;
			}
			continue;
		}
		///////////////////////////////////////////////////////////////////////
		else if (_tcsnicmp(strText, _T("</FONT>"), 7) == 0)	// check for </FONT>
		{
			n -= 7;
			index = strText.Find(_T('>'));
			if (index != -1)
				strText = strText.Mid(index+1);
			crText = prev_crText;
			crBackground = prev_crBackground;
			memcpy(&lf, &prev_lf, sizeof(lf));
			if (bSizeChange)
				m_yStart += tm.tmDescent;
			bSizeChange = FALSE;
			continue;
		}
		///////////////////////////////////////////////////////////////////////
		else if (_tcsnicmp(strText, _T("<CODE>"), 6) == 0)	// check for <CODE>
		{
			n -= 6;
			index = strText.Find(_T('>'));
			if (index != -1)
				strText = strText.Mid(index+1);
			_tcscpy(lf.lfFaceName, _T("Courier New"));
			continue;
		}
		///////////////////////////////////////////////////////////////////////
		else if (_tcsnicmp(strText, _T("</CODE>"), 7) == 0)	// check for </CODE>
		{
			n -= 7;
			index = strText.Find(_T('>'));
			if (index != -1)
				strText = strText.Mid(index+1);
			memcpy(&lf, &prev_lf, sizeof(lf));
			continue;
		}
		///////////////////////////////////////////////////////////////////////
		// <a href=www.xyz.com>XYZ Web Site</a>
		else if (_tcsnicmp(strText, _T("<A HREF="), 8) == 0)	// check for <A HREF=
		{
			index = strText.Find(_T('>'));
			if (index != -1)
			{
				strAnchorText = strText.Mid(8, index-8);
				strText = strText.Mid(index+1);
				n = strText.GetLength();
				m_bInAnchor = TRUE;
				continue;
			}
		}
		///////////////////////////////////////////////////////////////////////
		else if (_tcsnicmp(strText, _T("</A>"), 4) == 0)	// check for </A>
		{
			strText = strText.Mid(4);
			n -= 4;
			m_bInAnchor = FALSE;
开发者ID:Bitfall,项目名称:AppWhirr-client,代码行数:67,代码来源:XHTMLStatic.cpp


示例19: IsClipboardFormatAvailable


//.........这里部分代码省略.........
			// "Could not open clipboard for reading after many timed attempts. Another program is probably holding it open."
			Close(CANT_OPEN_CLIPBOARD_READ);
			return CLIPBOARD_FAILURE;
		}
		if (   !(mClipMemNow = g_clip.GetClipboardDataTimeout(clipboard_contains_files ? CF_HDROP : CF_NATIVETEXT))   )
		{
			// v1.0.47.04: Commented out the following that had been in effect when clipboard_contains_files==false:
			//    Close("GetClipboardData"); // Short error message since so rare.
			//    return CLIPBOARD_FAILURE;
			// This was done because there are situations when GetClipboardData can fail indefinitely.
			// For example, in Firefox, pulling down the Bookmarks menu then right-clicking "Bookmarks Toolbar
			// Folder" then selecting "Copy" puts one or more formats on the clipboard that cause this problem.
			// For details, search the forum for TYMED_NULL.
			//
			// v1.0.42.03: For the fix below, GetClipboardDataTimeout() knows not to try more than once
			// for CF_HDROP.
			// Fix for v1.0.31.02: When clipboard_contains_files==true, tolerate failure, which happens
			// as a normal/expected outcome when there are files on the clipboard but either:
			// 1) zero of them;
			// 2) the CF_HDROP on the clipboard is somehow misformatted.
			// If you select the parent ".." folder in WinRar then use the following hotkey, the script
			// would previously yield a runtime error:
			//#q::
			//Send, ^c
			//ClipWait, 0.5, 1
			//msgbox %Clipboard%
			//Return
			Close();
			if (aBuf)
				*aBuf = '\0';
			return CLIPBOARD_FAILURE; // Return this because otherwise, Contents() returns mClipMemNowLocked, which is NULL.
		}
		// Although GlobalSize(mClipMemNow) can yield zero in some cases -- in which case GlobalLock() should
		// not be attempted -- it probably can't yield zero for CF_HDROP and CF_TEXT because such a thing has
		// never been reported by anyone.  Therefore, GlobalSize() is currently not called.
		if (   !(mClipMemNowLocked = (LPTSTR)GlobalLock(mClipMemNow))   )
		{
			Close(_T("GlobalLock"));  // Short error message since so rare.
			return CLIPBOARD_FAILURE;
		}
		// Otherwise: Update length after every successful new open&lock:
		// Determine the length (size - 1) of the buffer than would be
		// needed to hold what's on the clipboard:
		if (clipboard_contains_files)
		{
			if (file_count = DragQueryFile((HDROP)mClipMemNowLocked, 0xFFFFFFFF, _T(""), 0))
			{
				mLength = (file_count - 1) * 2;  // Init; -1 if don't want a newline after last file.
				for (i = 0; i < file_count; ++i)
					mLength += DragQueryFile((HDROP)mClipMemNowLocked, i, NULL, 0);
			}
			else
				mLength = 0;
		}
		else // clipboard_contains_text
			mLength = _tcslen(mClipMemNowLocked);
		if (mLength >= CLIPBOARD_FAILURE) // Can't realistically happen, so just indicate silent failure.
			return CLIPBOARD_FAILURE;
	}
	if (!aBuf)
		return mLength;
		// Above: Just return the length; don't close the clipboard because we expect
		// to be called again soon.  If for some reason we aren't called, MsgSleep()
		// will automatically close the clipboard and clean up things.  It's done this
		// way to avoid the chance that the clipboard contents (and thus its length)
		// will change while we don't have it open, possibly resulting in a buffer
		// overflow.  In addition, this approach performs better because it avoids
		// the overhead of having to close and reopen the clipboard.

	// Otherwise:
	if (clipboard_contains_files)
	{
		if (file_count = DragQueryFile((HDROP)mClipMemNowLocked, 0xFFFFFFFF, _T(""), 0))
			for (i = 0; i < file_count; ++i)
			{
				// Caller has already ensured aBuf is large enough to hold them all:
				aBuf += DragQueryFile((HDROP)mClipMemNowLocked, i, aBuf, 999);
				if (i < file_count - 1) // i.e. don't add newline after the last filename.
				{
					*aBuf++ = '\r';  // These two are the proper newline sequence that the OS prefers.
					*aBuf++ = '\n';
				}
				//else DragQueryFile() has ensured that aBuf is terminated.
			}
		// else aBuf has already been terminated upon entrance to this function.
	}
	else
		_tcscpy(aBuf, mClipMemNowLocked);  // Caller has already ensured that aBuf is large enough.
	// Fix for v1.0.37: Close() is no longer called here because it prevents the clipboard variable
	// from being referred to more than once in a line.  For example:
	// Msgbox %Clipboard%%Clipboard%
	// ToolTip % StrLen(Clipboard) . Clipboard
	// Instead, the clipboard is later closed in other places (search on CLOSE_CLIPBOARD_IF_OPEN
	// to find them).  The alternative to fixing it this way would be to let it reopen the clipboard
	// by means getting rid of the following lines above:
	//if (aBuf)
	//	return 0;
	// However, that has the risks described in the comments above those two lines.
	return mLength;
}
开发者ID:1j01,项目名称:ahk.js,代码行数:101,代码来源:clipboard.cpp


示例20: RunHyperlink

/*
 *	See if the mouse is located on a hyperlink and,
 *	if so, run it.
 */
BOOL RunHyperlink( LPCLASSDATA lpcd )
{
	/*
	 *	Get the hyperlink at the current mouse
	 *	position.
	 */
	TCHAR *pszLink = GetHyperlink( lpcd );
 
  // Modified by Stephan (2005-05-28)
	if ( pszLink )
	{
    // If it is not a URL
    if (!_tcsnicmp(pszLink, _T("c:\\"), 3) || !_tcsnicmp(pszLink, _T("d:\\"), 3) || 
        !_tcsnicmp(pszLink, _T("\\\\"), 2) || !_tcsnicmp(pszLink, _T("%"), 1))
    {
      TCHAR szAliasFolder[MAX_PATH], szPath[MAX_PATH];
      TCHAR szModuleFileName[MAX_PATH];
      TCHAR szExecParams[MAX_PATH];
      LPTSTR pszLinkNoAlias = pszLink;

      // Resolve aliases
      szAliasFolder[0] = 0;
      if (!_tcsnicmp(pszLink, _T("%WINDIR%"), 8))
      {
        GetWindowsDirectory(szAliasFolder, MAX_PATH);
        pszLinkNoAlias += 8;
      }
	  else if (!_tcsnicmp(pszLink, _T("C:\\Program Files (x86)\\Common"), 29))
	  {
		  _tcscpy(szAliasFolder, _T("c:\\Program Files (x86)\\Common Files"));
		  pszLinkNoAlias += 29;
	  }
	  else if (!_tcsnicmp(pszLink, _T("C:\\Program Files\\Common"), 23))
	  {
		  _tcscpy(szAliasFolder, _T("c:\\Program Files\\Common Files"));
		  pszLinkNoAlias += 23;
	  }
      else if (!_tcsnicmp(pszLink, _T("%ProgramFilesDir%"), 17))
      {
        if (GetSystemDefaultLangID() & 0x07)   // German
          _tcscpy(szAliasFolder, _T("c:\\Programme"));
        else
          _tcscpy(szAliasFolder, _T("c:\\Program Files"));
        pszLinkNoAlias += 17;
      }
      else if (!_tcsnicmp(pszLink, _T("%temp%"), 6))
      {
        GetTempPath(MAX_PATH, szAliasFolder);
        pszLinkNoAlias += 6;
      }

      // Remove :line at the end
      if (_tcschr(pszLinkNoAlias, _T(':')) != _tcsrchr(pszLinkNoAlias, _T(':')))
      {
        LPTSTR lpszSemicolon = _tcsrchr(pszLinkNoAlias, _T(':'));
        if (lpszSemicolon)
          lpszSemicolon[0] = _T('\0');
      }
      

      _stprintf(szPath, _T("%s%s"), szAliasFolder, pszLinkNoAlias);

      GetModuleFileName(NULL, szModuleFileName, MAX_PATH);
      _stprintf(szExecParams, _T("-hyperlink \"%s\""), szPath);
      
	    if (( int )ShellExecute( GetDesktopWindow(), NULL, szModuleFileName, szExecParams, 
			    NULL, SW_SHOWNORMAL ) <= 32 )
			{
		    OkIOError( lpcd, lpcd->hWnd, _T( "%s" ), szPath );
			}
    }
    // Execute URL
    else
    {
		  if (( int )ShellExecute( GetDesktopWindow(), 
				  NULL, 
				  pszLink, 
				  NULL, 
				  NULL, 
				  SW_SHOWNORMAL ) <= 32 )
			  OkIOError( lpcd, lpcd->hWnd, _T( "%s" ), pszLink );
    }

		/*
		 *	Release the url buffer.
		 */
		FreePooled( lpcd->pMemPool, pszLink );
		return TRUE;
	}
	/*
	 *	No hyperlink or memory failure...
	 */
	return FALSE;
}
开发者ID:ymx,项目名称:NiLogViewer,代码行数:98,代码来源:hyperlink.c


示例21: while

xpr_sint_t Thumbnail::runThread(xpr::Thread &aThread)
{

    HWND sHwnd;
    xpr_uint_t sMsg;
    xpr_tchar_t sPath[XPR_MAX_PATH + 1];
    xpr_char_t sPathA[XPR_MAX_PATH + 1];
    xpr_size_t sInputBytes;
    xpr_size_t sOutputBytes;
    CSize sThumbSize;
    ThumbItem *sThumbItem = XPR_NULL;

    GFL_BITMAP *sGflBitmap = XPR_NULL;
    GFL_LOAD_PARAMS sGflLoadParams;
    xpr_uchar_t *sDibData = XPR_NULL;
    BITMAPINFOHEADER sBitmapInfoHeader;
    CBitmap *sBitmap, *sOldBitmap;
    ThumbImage *sThumbImage;

    CSize sPicSize;
    xpr_sint_t x, y, cx, cy;
    xpr_double_t sRatio;
    CRect sDestRect;

    DWORD sWait;

    while (true)
    {
        sWait = ::WaitForSingleObject(mEvent, INFINITE);

        if (mThread.isStop() == XPR_TRUE)
            break;

        if (sWait != WAIT_OBJECT_0)
            continue;

        {
            xpr::MutexGuard sLockGuard(mMutex);

            if (mThumbDeque.empty() == true)
            {
                ::ResetEvent(mEvent);
                continue;
            }

            sThumbItem = mThumbDeque.front();
            mThumbDeque.pop_front();

            if (XPR_IS_NULL(sThumbItem))
                continue;
        }

        sThumbImage = XPR_NULL;

        sHwnd = sThumbItem->mHwnd;
        sMsg = sThumbItem->mMsg;
        sThumbSize = sThumbItem->mThumbSize;

        _tcscpy(sPath, sThumbItem->mPath.c_str());
        sInputBytes = _tcslen(sPath) * sizeof(xpr_tchar_t);
        sOutputBytes = XPR_MAX_PATH * sizeof(xpr_tchar_t);
        XPR_TCS_TO_MBS(sPath, &sInputBytes, sPathA, &sOutputBytes);
        sPathA[sOutputBytes / sizeof(xpr_char_t)] = 0;

        XPR_TRACE(XPR_STRING_LITERAL("Thumbnail Thread, path=%s\n"), sPath);

        {
            gflGetDefaultPreviewParams(&sGflLoadParams); 
            sGflLoadParams.Flags      |= GFL_LOAD_SKIP_ALPHA | GFL_LOAD_PREVIEW_NO_CANVAS_RESIZE;
            sGflLoadParams.Origin      = GFL_BOTTOM_LEFT;
            sGflLoadParams.ColorModel  = GFL_BGR; 
            sGflLoadParams.LinePadding = 4;

            if (sThumbItem->mLoadByExt == XPR_TRUE)
                sGflLoadParams.Flags |= GFL_LOAD_BY_EXTENSION_ONLY;

            if (gflLoadPreview(sPathA, sThumbSize.cx, sThumbSize.cy, &sGflBitmap, &sGflLoadParams, XPR_NULL) == XPR_FALSE)
            {
                // image bilinear scale
                sPicSize.cx = sGflBitmap->Width;
                sPicSize.cy = sGflBitmap->Height;
                x = y = 0;
                cx = sThumbSize.cx;
                cy = sThumbSize.cy;
                sRatio = (xpr_double_t)sPicSize.cx / (xpr_double_t)sPicSize.cy;

                if (sPicSize.cx >= sThumbSize.cx || sPicSize.cy >= sThumbSize.cy)
                {
                    x = (sThumbSize.cx - sPicSize.cx) / 2;
                    y = (sThumbSize.cy - sPicSize.cy) / 2;
                    sDestRect = CRect(x, y, x+cx, y+cy);
                }
                else
                {
                    x = (sThumbSize.cx - sPicSize.cx) / 2;
                    y = (sThumbSize.cy - sPicSize.cy) / 2;
                    sDestRect = CRect(x, y, x+sPicSize.cx, y+sPicSize.cy);
                }

                CClientDC dc(CWnd::GetDesktopWindow());
//.........这里部分代码省略.........
开发者ID:3rdexp,项目名称:fxfile,代码行数:101,代码来源:thumbnail.cpp


示例22: Update

static void
Update()
{
  WndProperty* wp;
  TCHAR Text[100];
  Angle teammateBearing = XCSoarInterface::Calculated().TeammateBearing;
  double teammateRange = XCSoarInterface::Calculated().TeammateRange;

  if (XCSoarInterface::SettingsComputer().TeamCodeRefWaypoint >= 0) {
    double Value = (teammateBearing - XCSoarInterface::Basic().TrackBearing).
      as_delta().value_degrees();

    if (Value > 1)
      _stprintf(Text, _T("%2.0f")_T(DEG)_T(">"), Value);
    else if (Value < -1)
      _stprintf(Text, _T("<%2.0f")_T(DEG), -Value);
    else
      _tcscpy(Text, _T("<>"));
  } else {
    _tcscpy(Text, _T("---"));
  }

  wp = (WndProperty*)wf->FindByName(_T("prpRelBearing"));
  if (wp) {
    wp->SetText(Text);
    wp->RefreshDisplay();
  }

  wp = (WndProperty*)wf->FindByName(_T("prpBearing"));
  if (wp) {
    wp->GetDataField()->SetAsFloat(teammateBearing.value_degrees());
    wp->RefreshDisplay();
  }

  wp = (WndProperty*)wf->FindByName(_T("prpRange"));
  if (wp) {
    wp->GetDataField()->SetAsFloat(Units::ToUserDistance(fixed(teammateRange)));
    wp->RefreshDisplay();
  }

  wp = (WndProperty*)wf->FindByName(_T("prpOwnCode"));
  if (wp) {
    _tcsncpy(Text, XCSoarInterface::Calculated().OwnTeamCode, 5);
    Text[5] = '\0';
    wp->SetText(Text);
    wp->RefreshDisplay();
  }

  wp = (WndProperty*)wf->FindByName(_T("prpMateCode"));
  if (wp) {
    wp->SetText(XCSoarInterface::SettingsComputer().TeammateCode);
    wp->RefreshDisplay();
  }

  wp = (WndProperty*)wf->FindByName(_T("prpFlarmLock"));
  if (wp) {
    wp->SetText(XCSoarInterface::SettingsComputer().TeamFlarmTracking ?
                XCSoarInterface::SettingsComputer().TeamFlarmCNTarget : _T(""));
    wp->RefreshDisplay();
  }
}
开发者ID:hnpilot,项目名称:XCSoar,代码行数:61,代码来源:dlgTeamCode.cpp


示例23: _tcscpy

/**
 * \return S_OK for success, S_FALSE for failure
 *
 * Registers a client to the DIL. ClientID will have client id
 * which will be used for further client related calls
 */
HRESULT CDIL_CAN_MHS::CAN_RegisterClient(BOOL bRegister, DWORD& ClientID, char* pacClientName)
{
    HRESULT hResult = S_FALSE;
    INT Index;

    if (bRegister)
    {
        if (sg_unClientCnt < MAX_CLIENT_ALLOWED)
        {
            Index = 0;
            if (!bClientExist(pacClientName, Index))
            {
                //Currently store the client information
                if (_tcscmp(pacClientName, CAN_MONITOR_NODE) == 0)
                {
                    //First slot is reserved to monitor node
                    ClientID = 1;
                    _tcscpy(sg_asClientToBufMap[0].m_acClientName, pacClientName);
                    sg_asClientToBufMap[0].m_dwClientID = ClientID;
                    sg_asClientToBufMap[0].m_unBufCount = 0;
                }
                else
                {
                    if (!bClientExist(CAN_MONITOR_NODE, Index))
                    {
                        Index = sg_unClientCnt + 1;
                    }
                    else
                    {
                        Index = sg_unClientCnt;
                    }
                    ClientID = dwGetAvailableClientSlot();
                    _tcscpy(sg_asClientToBufMap[Index].m_acClientName, pacClientName);
                    sg_asClientToBufMap[Index].m_dwClientID = ClientID;
                    sg_asClientToBufMap[Index].m_unBufCount = 0;
                }
                sg_unClientCnt++;
                hResult = S_OK;
            }
            else
            {
                ClientID = sg_asClientToBufMap[Index].m_dwClientID;
                hResult = ERR_CLIENT_EXISTS;
            }
        }
        else
        {
            hResult = ERR_NO_MORE_CLIENT_ALLOWED;
        }
    }
    else
    {
        if (bRemoveClient(ClientID))
        {
            hResult = S_OK;
        }
        else
        {
            hResult = ERR_NO_CLIENT_EXIST;
        }
    }
    return(hResult);
}
开发者ID:Schrenk,项目名称:busmaster,代码行数:69,代码来源:CAN_MHS.cpp


示例24: printf

/*!
\brief   安装指定的服务到服务管理器中
\param   LPCTSTR pszPath    :服务执行文件的全路径
\param   DWORD dwServiceType:服务类型
\li SERVICE_FILE_SYSTEM_DRIVER
\li SERVICE_KERNEL_DRIVER
\li SERVICE_WIN32_OWN_PROCESS
\li SERVICE_WIN32_SHARE_PROCESS
\li SERVICE_INTERACTIVE_PROCESS
\param   DWORD dwStartType  :开始类型
\li SERVICE_AUTO_START
\li SERVICE_BOOT_START
\li SERVICE_DEMAND_START
\li SERVICE_DISABLED
\li SERVICE_SYSTEM_START
\return  类型为 BOOL 。成功返回TRUE,否则返回FALSE.
\version 1.0
\author  康  林
\date    2007-6-12 21:03:45
*/
BOOL CServiceManage::Install(LPCTSTR pszPath /* = NULL */, LPTSTR pszServerName /* = NULL */, LPCTSTR pszDisplayName /* = NULL */)
{

	SC_HANDLE schService;
	TCHAR szPath[MAX_PATH];

	if(NULL == pszPath)
	{
		if(!GetModuleFileName(NULL, szPath, MAX_PATH))
		{
			printf("Cannot install service (%d)\n", GetLastError());
			return FALSE;
		}
	}
	else
	{
		_tcscpy(szPath, pszPath);
	}
	// Get a handle to the SCM database. 

	if(NULL == m_hSchSCManager)
	{
		m_hSchSCManager = OpenSCManager(
			NULL,                    // local computer
			NULL,                    // ServicesActive database 
			SC_MANAGER_ALL_ACCESS);  // full access rights 

		if (NULL == m_hSchSCManager) 
		{
			printf("OpenSCManager failed (%d)\n", GetLastError());
			return FALSE;
		}
	}

	if(NULL == pszServerName)
	{
		pszServerName =(LPTSTR) m_szServiceName.c_str();
	} // 结束 if(NULL == pszServerName)

	// Create the service.

	schService = CreateService( 
		m_hSchSCManager,              // SCM database 
		pszServerName,                   // name of service 
		pszDisplayName,                   // service name to display 
		SERVICE_ALL_ACCESS,        // desired access 
		SERVICE_WIN32_OWN_PROCESS, // service type 
		SERVICE_AUTO_START,      // start type 
		SERVICE_ERROR_NORMAL,      // error control type 
		szPath,                    // path to service's binary 
		NULL,                      // no load ordering group 
		NULL,                      // no tag identifier 
		NULL,                      // no dependencies 
		NULL,                      // LocalSystem account 
		NULL);                     // no password 

	if (schService == NULL) 
	{
		printf("CreateService failed (%d)\n", GetLastError()); 
		return FALSE;
	}
	else printf("Service installed successfully\n"); 

	CloseServiceHandle(schService); 

}
开发者ID:KangLin,项目名称:ArpVirus,代码行数:86,代码来源:ServiceManage.cpp


示例25: _tcslen

void VNCOptions::SetFromCommandLine(LPTSTR szCmdLine) {
	// We assume no quoting here.
	// Copy the command line - we don't know what might happen to the original
	int cmdlinelen = _tcslen(szCmdLine);
	if (cmdlinelen == 0) return;
	
	TCHAR *cmd = new TCHAR[cmdlinelen + 1];
	_tcscpy(cmd, szCmdLine);
	
	// Count the number of spaces
	// This may be more than the number of arguments, but that doesn't matter.
	int nspaces = 0;
	TCHAR *p = cmd;
	TCHAR *pos = cmd;
	while ( ( pos = _tcschr(p, ' ') ) != NULL ) {
		nspaces ++;
		p = pos + 1;
	}
	
	// Create the array to hold pointers to each bit of string
	TCHAR **args = new LPTSTR[nspaces + 1];
	
	// replace spaces with nulls and
	// create an array of TCHAR*'s which points to start of each bit.
	pos = cmd;
	int i = 0;
	args[i] = cmd;
	bool inquote=false;
	for (pos = cmd; *pos != 0; pos++) {
		// Arguments are normally separated by spaces, unless there's quoting
		if ((*pos == ' ') && !inquote) {
			*pos = '\0';
			p = pos + 1;
			args[++i] = p;
		}
		if (*pos == '"') {  
			if (!inquote) {      // Are we starting a quoted argument?
				args[i] = ++pos; // It starts just after the quote
			} else {
				*pos = '\0';     // Finish a quoted argument?
			}
			inquote = !inquote;
		}
	}
	i++;

	bool hostGiven = false, portGiven = false;
	// take in order.
	for (int j = 0; j < i; j++) {
		if ( SwitchMatch(args[j], _T("help")) ||
			SwitchMatch(args[j], _T("?")) ||
			SwitchMatch(args[j], _T("h"))) {
			ShowUsage();
			PostQuitMessage(1);
		} else if ( SwitchMatch(args[j], _T("listen"))) {
			m_listening = true;
		} else if ( SwitchMatch(args[j], _T("restricted"))) {
			m_restricted = true;
		} else if ( SwitchMatch(args[j], _T("viewonly"))) {
			m_ViewOnly = true;
		} else if ( SwitchMatch(args[j], _T("fullscreen"))) {
			m_FullScreen = true;
		} else if ( SwitchMatch(args[j], _T("8bit"))) {
			m_Use8Bit = true;
		} else if ( SwitchMatch(args[j], _T("shared"))) {
			m_Shared = true;
		} else if ( SwitchMatch(args[j], _T("swapmouse"))) {
			m_SwapMouse = true;
		} else if ( SwitchMatch(args[j], _T("nocursor"))) {
			m_localCursor = NOCURSOR;
		} else if ( SwitchMatch(args[j], _T("dotcursor"))) {
			m_localCursor = DOTCURSOR;
		} else if ( SwitchMatch(args[j], _T("normalcursor"))) {
			m_localCursor = NORMALCURSOR;
		} else if ( SwitchMatch(args[j], _T("belldeiconify") )) {
			m_DeiconifyOnBell = true;
		} else if ( SwitchMatch(args[j], _T("emulate3") )) {
			m_Emul3Buttons = true;
		} else if ( SwitchMatch(args[j], _T("noemulate3") )) {
			m_Emul3Buttons = false;
		} else if ( SwitchMatch(args[j], _T("scale") )) {
			if (++j == i) {
				ArgError(_T("No scaling factor specified"));
				continue;
			}
			int numscales = _stscanf(args[j], _T("%d/%d"), &m_scale_num, &m_scale_den);
			if (numscales < 1) {
				ArgError(_T("Invalid scaling specified"));
				continue;
			}
			if (numscales == 1) 
				m_scale_den = 1; // needed if you're overriding a previous setting

		} else if ( SwitchMatch(args[j], _T("emulate3timeout") )) {
			if (++j == i) {
				ArgError(_T("No timeout specified"));
				continue;
			}
			if (_stscanf(args[j], _T("%d"), &m_Emul3Timeout) != 1) {
				ArgError(_T("Invalid timeout specified"));
//.........这里部分代码省略.........
开发者ID:lubing521,项目名称:important-files,代码行数:101,代码来源:VNCOptions.cpp


示例26: InpdUpdate

int InpdUpdate()
{
	unsigned int i, j = 0;
	struct GameInp* pgi = NULL;
	unsigned char* plv = NULL;
	unsigned short nThisVal;
	if (hInpdList == NULL) {
		return 1;
	}
	if (LastVal == NULL) {
		return 1;
	}

	// Update the values of all the inputs
	for (i = 0, pgi = GameInp, plv = LastVal; i < nGameInpCount; i++, pgi++, plv++) {
		LVITEM LvItem;
		TCHAR szVal[16];

		if (pgi->nType == 0) {
			continue;
		}

		if (pgi->nType & BIT_GROUP_ANALOG) {
			if (bRunPause) {														// Update LastVal
				nThisVal = pgi->Input.nVal;
			} else {
				nThisVal = *pgi->Input.pShortVal;
			}

			if (bLastValDefined && (pgi->nType != BIT_ANALOG_REL || nThisVal) && pgi->Input.nVal == *((unsigned short*)plv)) {
				j++;
				continue;
			}

			*((unsigned short*)plv) = nThisVal;
		} else {
			if (bRunPause) {														// Update LastVal
				nThisVal = pgi->Input.nVal;
			} else {
				nThisVal = *pgi->Input.pVal;
			}

			if (bLastValDefined && pgi->Input.nVal == *plv) {						// hasn't changed
				j++;
				continue;
			}

			*plv = nThisVal;
		}

		switch (pgi->nType) {
			case BIT_DIGITAL: {
				if (nThisVal == 0) {
					szVal[0] = 0;
				} else {
					if (nThisVal == 1) {
						_tcscpy(szVal, _T("ON"));
					} else {
						_stprintf(szVal, _T("0x%02X"), nThisVal);
					}
				}
				break;
			}
			case BIT_ANALOG_ABS: {
				_stprintf(szVal, _T("0x%02X"), nThisVal >> 8);
				break;
			}
			case BIT_ANALOG_REL: {
				if (nThisVal == 0) {
					szVal[0] = 0;
				}
				if ((short)nThisVal < 0) {
					_stprintf(szVal, _T("%d"), ((short)nThisVal) >> 8);
				}
				if ((short)nThisVal > 0) {
					_stprintf(szVal, _T("+%d"), ((short)nThisVal) >> 8);
				}
				break;
			}
			default: {
				_stprintf(szVal, _T("0x%02X"), nThisVal);
			}
		}
开发者ID:treblewinner,项目名称:FB-Alpha,代码行数:83,代码来源:inpd.cpp


示例27: BkgPingStatusCheckThread

DWORD WINAPI BkgPingStatusCheckThread(LPVOID lpVoid)
{

	BBS_PING_OPTION pingOpt = {0,};
	BBS_CUR_NET_INFO netInfo;
	BBS_PING_RESULT pingResult;
	BBS_ADAPTER_INFO adapterInfo;
	DWORD dwPingFailCount = 0;
	CBBS_Ping ping;

	TCHAR tszLiteralIP[18] = {'\0',};

	memset(&pingOpt, 0, sizeof(BBS_PING_OPTION));
	memset(&netInfo, 0, sizeof(BBS_CUR_NET_INFO));
	memset(&pingResult, 0, sizeof(BBS_PING_RESULT));
	memset(&adapterInfo, 0, sizeof(BBS_ADAPTER_INFO));


	NKDbgPrintfW( _T("[NETUI] ===== [BkgPingStatusCheckThread Start] ===== \r\n") );

	g_bIsOperating = TRUE;

	while(g_bIsOperating == TRUE)
	{

		// 1초씩 g_dwBreakInterval 만큼 쉬어준다.
		// 1초씩 마다 스레드가 종료 조건이 걸려있는지 확인
		for(UINT i=1; i<=g_dwBreakInterval; i++)
		{
			// BreakTime Interval
			Sleep(1000);

			if(g_bIsOperating == FALSE)
			{
				return 0;
			}
		}

		// PIng 실패 횟수 초기화 필수!
		dwPingFailCount = 0;


		GetWlanDefaultInformation(&adapterInfo);

		GetCurrentNetworkInfo(adapterInfo.tszAdapterName, &netInfo);

		
		NKDbgPrintfW( _T("[NETUI] ---------- [Default Information] ---------- \r\n") );
		NKDbgPrintfW( _T("[NETUI] Adapter(%s), DHCP(%d) \r\n"), adapterInfo.tszAdapterName, adapterInfo.bDHCPEnabled );
		NKDbgPrintfW( _T("[NETUI] IPAddr(%s) \r\n"), adapterInfo.tszIPAddr );
		NKDbgPrintfW( _T("[NETUI] DefaultGateWay(%s) \r\n"), adapterInfo.tszDefaultGateWay );
		NKDbgPrintfW( _T("[NETUI] DnsAddr(%s) \r\n"), adapterInfo.tszDnsAddr );
		NKDbgPrintfW( _T("[NETUI] ---------------------------------------- \r\n\r\n") );



		// 아답터가 검색되었는지?
		if( _tcslen(adapterInfo.tszAdapterName) == 0 )
		{
			// 아답터가 검색되지 않았다면, 기본 대기시간만큼 다시 대기
			// ERROR
			NKDbgPrintfW( _T("[NETUI] [ERROR] Can't Find Adapter! \r\n") );
			continue;
		}


		NKDbgPrintfW( _T("[NETUI] SSID : %s \r\n"), netInfo.tszSSID );

		// 현재 접속된 SSID가 있을 때만 Ping 시도
		if( _tcslen(netInfo.tszSSID) != 0 )
		{
			
			// Custom Dest IP를 지정 되어있으면, 읽어온 값으로, 지정되지 않았다면, 기본 DefaultGateWay로 시도
			if( _tcslen(g_tszCustomDestAddr) > 0 )
			{
				_tcscpy(pingOpt.tszDestIP, g_tszCustomDestAddr);
			}
			else
			{
				_tcscpy(pingOpt.tszDestIP, adapterInfo.tszDefaultGateWay);
			}
			pingOpt.dwSendBufSize = 32;
			pingOpt.dwTimeOut = 1000;
			pingOpt.ucTos = 0;
			pingOpt.ucTtl = 32;


			NKDbgPrintfW( TEXT("[NETUI] Dest IP(%s) \r\n"), pingOpt.tszDestIP );

			

			if( ping.InitPing(pingOpt, tszLiteralIP) == TRUE)
			{
				HKEY hKey = NULL;
				DWORD dwDisposition = 0;


				NKDbgPrintfW( TEXT("[NETUI] Literal IP(%s) \r\n"), tszLiteralIP );

				for(DWORD dwLoop=0; dwLoop<g_dwMaxCheckCount; dwLoop++)
//.........这里部分代码省略.........
开发者ID:NemProjects,项目名称:WLAN,代码行数:101,代码来源:BBS_BkgPingStatusCheck.cpp


示例28: _sasl_load_plugins


//.........这里部分代码省略.........
    if (sizeof(TCHAR) == sizeof(char)) {
        path = (TCHAR*)utf8path;
    }
    else {
        path = _sasl_utf8_to_wchar(utf8path);
        if (!path) return SASL_FAIL;
    }

    if (_tcslen(path) >= PATH_MAX) { /* no you can't buffer overrun */
	    retCode = SASL_FAIL;
        goto cleanup;
    }

    position=0;
    do {
	pos=0;
	do {
	    c=path[position];
	    position++;
	    cur_dir[pos]=c;
	    pos++;
	} while ((c!=PATHS_DELIMITER) && (c!=0));
	cur_dir[pos-1]='\0';


/* : check to make sure that a valid directory name was passed in */
	if (_tstat (cur_dir, &statbuf) < 0) {
	    continue;
	}
	if ((statbuf.st_mode & S_IFDIR) == 0) {
	    continue;
	}

    _tcscpy(prefix, cur_dir);
	prefix_len = _tcslen (prefix);

/* : Don't append trailing \ unless required */
	if (prefix[prefix_len-1] != '\\') {
        _tcscat(prefix,_T("\\"));
	    prefix_len++;
	}

	pattern = prefix;

/* : Check that we have enough space for "*.dll" */
	if ((prefix_len + DLL_MASK_LEN) > (sizeof(prefix) / sizeof(TCHAR) - 1)) {
	    _sasl_log(NULL, SASL_LOG_WARN, "plugin search mask is too big");
            continue;
	}

	_tcscat (prefix + prefix_len, _T("*") DLL_SUFFIX);

        fhandle = _tfindfirst (pattern, &finddata);
        if (fhandle == -1) {	/* no matching files */
            continue;
        }

/* : Truncate "*.dll" */
	prefix[prefix_len] = '\0';

	do {
	    size_t length;
	    void *library;
	    char *c;
	    char plugname[PATH_MAX];
	    int entries;
开发者ID:cyrusimap,项目名称:cyrus-sasl,代码行数:67,代码来源:windlopen.c


示例29: LoadCompatibilityModes

static BOOL
LoadCompatibilityModes(LPCOMPATIBILITYPAGE info)
{
    BOOL Ret;
    LONG e;
    HKEY hk, hk2;
    TCHAR szKey[256];

    ClearCItemList(info);

    e = RegOpenKey(HKEY_CURRENT_USER,
                   TEXT("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Layers"),
                   &hk);

    if (e == ERROR_SUCCESS)
    {
        DWORD i;
        PCITEM lastitem = NULL;

        for(i = 0;
            (RegEnumKey(hk, i,szKey, sizeof(szKey) / sizeof(szKey[0])) == ERROR_SUCCESS);
            i++)
        {
            e = RegOpenKey(hk,
                           szKey,
                           &hk2);

            if (e == ERROR_SUCCESS)
            {
                DWORD dwType;

                e = RegQueryValueEx(hk2,
                                    NULL,
                                    0,
                                    &dwType,
                                    NULL,
                                    NULL);

                if (e != ERROR_SUCCESS || (e == ERROR_SUCCESS && dwType == REG_SZ))
                {
                    PCITEM item;

                    item = HeapAlloc(GetProcessHeap(),
                                     0,
                                     sizeof(CITEM));
                    if (item != NULL)
                    {
                        DWORD cdb = sizeof(item->szName);

                        /* description */
                        e = RegQueryValueEx(hk2,
                                            NULL,
                                            0,
                                            NULL,
                                            (LPBYTE)item->szName,
                                            &cdb);

                        /* make sure it is null-terminated */
                        if (cdb > sizeof(item->szName) - sizeof(item->szName[0]))
                        {
                            item->szName[(sizeof(item->szName) / sizeof(item->szName[0])) - 1] = TEXT('\0');
                        }

                        if (e != ERROR_SUCCESS ||
                            cdb < sizeof(item->szName[0]))
                        {
                            _tcscpy(item->szName, szKey);
                            e = ERROR_SUCCESS;
                        }

                        _tcscpy(item->szKeyName, szKey);
                        info->nItems++;

                        ReadDWORDFlag(hk2,
                                      TEXT("MajorVersion"),
                                      &item->MajorVersion,
                                      0);
                        ReadDWORDFlag(hk2,
                                      TEXT("MinorVersion"),
                                      &item->MinorVersion,
                                      0);
                        ReadDWORDFlag(hk2,
                                      TEXT("BuildNumber"),
                                      &item->BuildNumber,
                                      0);
                        ReadDWORDFlag(hk2,
                                      TEXT("PlatformId"),
                                      &item->PlatformId,
                                      0);
                        ReadDWORDFlag(hk2,
                                      TEXT("SPMajorVersion"),
                                      &item->SPMajorVersion,
                                      0);
                        ReadDWORDFlag(hk2,
                                      TEXT("SPMinorVersion"),
                                      &item->SPMinorVersion,
                                      0);

                        if (e == ERROR_SUCCESS)
                        {
//.........这里部分代码省略.........
开发者ID:hoangduit,项目名称:reactos,代码行数:101,代码来源:slayer.c



注:本文中的_tcscpy函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。