本文整理汇总了C++中_tcscpy函数的典型用法代码示例。如果您正苦于以下问题:C++ _tcscpy函数的具体用法?C++ _tcscpy怎么用?C++ _tcscpy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_tcscpy函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
//.........这里部分代码省略.........
示例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;
示例3: setuservariable
void setuservariable(int varnum, TCHAR *var)
{
if (var != NULL && varnum >= 0 && varnum < __INST_LAST)
_tcscpy(g_variables + varnum*g_stringsize, var);
}
示例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;
}
示例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;
}
示例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;
}
//.........这里部分代码省略.........
示例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,
//.........这里部分代码省略.........
示例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 )
{
//.........这里部分代码省略.........
示例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());
示例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();
//
/*
//.........这里部分代码省略.........
示例11: _tcscpy
void InfoBoxFormatter::RenderInvalid(int *color) {
_tcscpy(CommentText, _T(""));
_tcscpy(Text, _T("---"));
*color = -1;
}
示例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;
}
示例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;
}
}
示例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;
}
}
示例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;
}