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


C++ CString::GetBuffer方法代码示例

本文整理汇总了C++中CString::GetBuffer方法的典型用法代码示例。如果您正苦于以下问题:C++ CString::GetBuffer方法的具体用法?C++ CString::GetBuffer怎么用?C++ CString::GetBuffer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CString的用法示例。


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

示例1: OnBnClickedOk

void CConnectRemoteMachineWindow::OnBnClickedOk()
{
	// TODO: Add your control notification handler code here
	CguiconsoleDlg* dlg = static_cast<CguiconsoleDlg*>(theApp.m_pMainWnd);
	byte ips[4];

	if (0 == m_ip.GetAddress(ips[0],ips[1],ips[2],ips[3]))
	{
		AfxMessageBox(L"address is error!");
		return;
	}
	
	char strip[256];
	sprintf_s(strip, 256, "%d.%d.%d.%d", ips[0],ips[1],ips[2],ips[3]);
	
	KBEngine::u_int16_t port = 0;
	CString sport;
	m_port.GetWindowTextW(sport);
	char* csport = KBEngine::strutil::wchar2char(sport.GetBuffer(0));
	port = atoi(csport);
	std::string command = strip;
	command += ":";
	command += csport;
	free(csport);

	KBEngine::Network::EndPoint* endpoint = KBEngine::Network::EndPoint::ObjPool().createObject();

	KBEngine::u_int32_t address;
	Network::Address::string2ip(strip, address);
	KBEngine::Network::Address addr(address, htons(port));

	if(addr.ip == 0)
	{
		::AfxMessageBox(L"address is error!");
		KBEngine::Network::EndPoint::ObjPool().reclaimObject(endpoint);
		return;
	}

	endpoint->socket(SOCK_STREAM);
	if (!endpoint->good())
	{
		AfxMessageBox(L"couldn't create a socket\n");
		KBEngine::Network::EndPoint::ObjPool().reclaimObject(endpoint);
		return;
	}

	endpoint->addr(addr);
	if(endpoint->connect(addr.port, addr.ip) == -1)
	{
		CString err;
		err.Format(L"connect server is error! %d", ::WSAGetLastError());
		AfxMessageBox(err);
		KBEngine::Network::EndPoint::ObjPool().reclaimObject(endpoint);
		return;
	}

	endpoint->setnonblocking(false);
	int8 findComponentTypes[] = {LOGGER_TYPE, BASEAPP_TYPE, CELLAPP_TYPE, BASEAPPMGR_TYPE, CELLAPPMGR_TYPE, LOGINAPP_TYPE, DBMGR_TYPE, BOTS_TYPE, UNKNOWN_COMPONENT_TYPE};
	int ifind = 0;

	while(true)
	{
		int8 findComponentType = findComponentTypes[ifind++];
		if(findComponentType == UNKNOWN_COMPONENT_TYPE)
		{
			//INFO_MSG("Componentbridge::process: not found %s, try again...\n",
			//	COMPONENT_NAME_EX(findComponentType));
			break;
		}

		KBEngine::Network::Bundle bhandler;
		bhandler.newMessage(KBEngine::MachineInterface::onFindInterfaceAddr);

		KBEngine::MachineInterface::onFindInterfaceAddrArgs7::staticAddToBundle(bhandler, KBEngine::getUserUID(), KBEngine::getUsername(), 
			CONSOLE_TYPE, g_componentID, (COMPONENT_TYPE)findComponentType, 0, 0);

		endpoint->send(&bhandler);

		KBEngine::Network::TCPPacket packet;
		packet.resize(65535);

		endpoint->setnonblocking(true);
		KBEngine::sleep(300);
		packet.wpos(endpoint->recv(packet.data(), 65535));

		while(packet.length() > 0)
		{
			MachineInterface::onBroadcastInterfaceArgs24 args;
			
			try
			{
				args.createFromStream(packet);
			}catch(MemoryStreamException &)
			{
				goto END;
			}

			INFO_MSG(fmt::format("CConnectRemoteMachineWindow::OnBnClickedOk: found {}, addr:{}:{}\n",
				COMPONENT_NAME_EX((COMPONENT_TYPE)args.componentType), inet_ntoa((struct in_addr&)args.intaddr), ntohs(args.intport)));

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

示例2: RunBsp


//.........这里部分代码省略.........
      int nLen = pEnd-pStart-1;
      strncpy(cBuff, pStart, nLen);
      cBuff[nLen] = 0;
      str = cBuff;
      FindReplace(str, rsh, "");
      str.TrimLeft(' ');
      str.TrimRight(' ');
      ATOM a = GlobalAddAtom(str);
      PostMessage(hwndPClient, wm_AddCommand, 0, (LPARAM)a);
      pStart = pEnd+2;
      pEnd = strstr(pStart, "&&");
    }
    str = pStart;
    FindReplace(str, rsh, "");
    str.TrimLeft(' ');
    str.TrimRight(' ');
    ATOM a = GlobalAddAtom(str);
    PostMessage(hwndPClient, wm_AddCommand, 0, (LPARAM)a);
    Sys_Printf("Commands sent to Q3Map Process Client\n");
    return;
  }

  CString strSys = sys;

  FindReplace(strSys, "&&", outputpath);
  strcpy(sys, strSys);
  strcat(sys, outputpath);

  if (g_PrefsDlg.m_bInternalBSP)
  {
    g_tBegin = CTime::GetCurrentTime();
    strSys.MakeLower();
    char* p = new char[strSys.GetLength()+1];
    strcpy(p, strSys.GetBuffer(0));
    ThreadTools(p);
  }
  else
  {
	  Sys_ClearPrintf ();
	  Sys_Printf ("==================\nRunning bsp command...\n");
	  Sys_Printf ("\n%s\n", sys);

	  //++timo removed the old way BSP commands .. dumping to junk.txt doesn't work on my win98 box
	  // FIXME : will most likely break Quake2 BSP commands, is fitted to a one-lined sys command
	  //
	  // write qe3bsp.bat
	  //

	  sprintf (batpath, "%sqe3bsp.bat", temppath);
	  hFile = fopen(batpath, "w");
	  if (!hFile)
		  Error ("Can't write to %s", batpath);
	  fprintf (hFile, sys);
	  fclose (hFile);

	  Pointfile_Delete ();

	  // delete junk.txt file
	  remove(strOutFile);

	  GetStartupInfo (&startupinfo);

	  ret = CreateProcess(
		  batpath,
		  NULL,
		  NULL,
开发者ID:Izhido,项目名称:qrevpak,代码行数:67,代码来源:Win_main.cpp

示例3: OnInit

Bool CCompiler::OnInit( const char* sourceCode, const char* programInput, const char* helperSolutionPath )
{
    CL_TRACE("Initializing Compiler with");
    if( !sourceCode )
    {
        CL_ERROR("Failed to init Compiler! Source code is NULL");
        return false;
    }

    m_programInput = programInput;
    m_sourceCodeToCompile = sourceCode;

    if( !helperSolutionPath )
    {
        CL_ERROR(" helper solution path not found");
        return false;
    }


    // set helper solution path and validate it;
    m_helperSolutionPath = helperSolutionPath;
    if( !CPath::IsAbsolute(m_helperSolutionPath) )
    {
        CL_ERROR("solution path provided is not absolute:[%s]", m_helperSolutionPath.GetBuffer() );
        return false;
    }
    if( !CPath::DirectoryExists(m_helperSolutionPath) )
    {
        CL_ERROR( "solution directoy does not exists:[%s]", m_helperSolutionPath.GetBuffer() );
        return false;
    }

    if( !CPath::GetCurrPath( m_workingDir ) )
    {
        CL_ERROR("initialization step failed. Cannot get current directory");
        return false;
    }

    CPath::SetCurrPath( m_helperSolutionPath );

    if( !CPath::GetAbsolutePath(ms_compilerLogFile, m_compilerOutputFile) )
    {
        CL_ERROR( "failed to get absolute path from path:[%s]", ms_compilerLogFile );
        return false;
    }

    // get path to devenv and validate it;
    CString vsToolsPath;
    ThGetEnvVariable( ms_vsEnvToolsVar, vsToolsPath );
    vsToolsPath += "..\\IDE\\";
    if( !CPath::GetAbsolutePath(vsToolsPath, m_devenvPath ) )
    {
        CL_ERROR( " failed to get devenv absolute path from tools path:[%s]", vsToolsPath.GetBuffer() );
        return false;
    }
    CString devenvExecutableFullPath = m_devenvPath + "devenv.exe";
    if( !CPath::FileExists( devenvExecutableFullPath ) )
    {
        CL_ERROR( "failed to get path to devenv.exe. We got [%s] but this file does not exists!", devenvExecutableFullPath.GetBuffer() );
        return false;
    }

    CL_TRACE("Compile initialization succeeded");
    return true;
}
开发者ID:Pawel91,项目名称:Thot,代码行数:65,代码来源:Compiler.cpp

示例4: Run

int Run(LPTSTR /*lpstrCmdLine*/ = NULL, int /*nCmdShow*/ = SW_SHOWDEFAULT)
{ 
	int nRet = 0; // Return code
	CErrorReportDlg dlgErrorReport; // Error Report dialog
	CResendDlg dlgResend; // Resend dialog

	// Get command line parameters.
	LPCWSTR szCommandLine = GetCommandLineW();

    // Split command line.
    int argc = 0;
    LPWSTR* argv = CommandLineToArgvW(szCommandLine, &argc);

    // Check parameter count.
    if(argc!=2)
        return 1; // No arguments passed, exit.

	if(_tcscmp(argv[1], _T("/terminate"))==0)
	{
		// User wants us to find and terminate all instances of CrashSender.exe
		return CErrorReportSender::TerminateAllCrashSenderProcesses();
	}

	// Extract file mapping name from command line arg.    
    CString sFileMappingName = CString(argv[1]);
		
	// Create the sender model that will collect crash report data 
	// and send error report(s).
	CErrorReportSender* pSender = CErrorReportSender::GetInstance();

	// Init the sender object
	BOOL bInit = pSender->Init(sFileMappingName.GetBuffer(0));
	if(!bInit)
    {
		// Failed to init        
        return 0;
    }      

	// Determine what to do next 
	// (either run in GUI more or run in silent mode).
	if(!pSender->GetCrashInfo()->m_bSilentMode)
	{
		// GUI mode.
		// Create message loop.
		CMessageLoop theLoop;
		_Module.AddMessageLoop(&theLoop);

		if(!pSender->GetCrashInfo()->m_bSendRecentReports)
		{
			// Create "Error Report" dialog			
			if(dlgErrorReport.Create(NULL) == NULL)
			{
				ATLTRACE(_T("Error report dialog creation failed!\n"));
				return 1;
			}			
		}
		else
		{        
			// Create "Send Error Reports" dialog.					
			if(dlgResend.Create(NULL) == NULL)
			{
				ATLTRACE(_T("Resend dialog creation failed!\n"));
				return 1;
			}			
		}

		// Process window messages.
		nRet = theLoop.Run();	    
		_Module.RemoveMessageLoop();
	}
	else
	{
		// Silent (non-GUI mode).
		// Run the sender and wait until it exits.
		pSender->Run();
		pSender->WaitForCompletion();
		// Get return status
		nRet = pSender->GetStatus();
	}
    
	// Delete sender object.
	delete pSender;

	// Exit.
    return nRet;
}
开发者ID:doo,项目名称:CrashRpt,代码行数:86,代码来源:CrashSender.cpp

示例5: OnBnClickedOk

void CUserAddDlg::OnBnClickedOk()
{
	UpdateData();

	m_strName.TrimLeft();
	m_strName.TrimRight();
	m_strGroupName.TrimLeft();
	m_strGroupName.TrimRight();
	
	//验证输入的数据是否合法
	if ( "" == m_strName )
	{
		MessageBox(_CS("AccountMSG.EmptyName"), _CS("OneClick.Prompt"));
		return;
	}
	if(m_strName[0]=='&')
	{
		
		MessageBox(_CS("AccountMSG.ErrorName"), _CS("OneClick.Prompt"));
		
		return;
	}
	if(m_strName.Find('.')!=-1||m_strName.Find('[')!=-1||m_strName.Find(']')!=-1 || m_strName.Find('%') != -1)
	{
		
		MessageBox(_CS("AccountMSG.ErrorName"), _CS("OneClick.Prompt"));
		return;
	}

	//验证密码是否匹配
	if ( m_strPsw != m_strConfirm )
	{
		MessageBox(_CS("Error.PwdErr"), _CS("OneClick.Prompt"));
		return;
	}
	
	//验证用户名是否已经存在

	if ( FindUserName(m_strName.GetBuffer(0)) )
	{
		MessageBox(_CS("AccountMSG.AddUserExist"), _CS("OneClick.Prompt"));
		return;
	}

	USER_INFO userInfo;

	//获取选择的权限列表
	int nIndex = 0;
	int nSize = m_listAuthority.GetItemCount();
	for ( int i = 0; i < nSize; i ++ )
	{
		if ( m_listAuthority.GetCheck(i) )
		{
			CString strName = (char *)m_listAuthority.GetItemData(i);
			strcpy( userInfo.rights[nIndex ++], strName.GetBuffer(0) );
		}
	}
	userInfo.rigthNum = nIndex;
	if ( nIndex <= 0 )
	{
		MessageBox(_CS("AccountMSG.EmptyAuthority"), _CS("OneClick.Prompt"));

		return;
	}

	userInfo.reserved = false;
	userInfo.shareable = m_checkReuseable.GetCheck();
	strcpy ( userInfo.Groupname, m_strGroupName.GetBuffer(0) );
	strcpy ( userInfo.memo, m_strDescribe.GetBuffer(0) );
	strcpy ( userInfo.name, m_strName.GetBuffer(0) );
	strcpy ( userInfo.passWord, m_strPsw.GetBuffer(0) );
	
		//保存用户	
		int bRet = SaveuserInfo(&userInfo);
		if ( bRet <= 0 )
		{
			CString strMsg(_CS("User.AddUserFailed"));
			CString strError = GetSdkErrorInfo( bRet );
			strMsg += strError;
			MessageBox(strMsg, _CS("OneClick.Prompt"));

			return;
		}
	

	MessageBox(_CS("AccountMSG.AddUserSuccess"), _CS("OneClick.Prompt"));
	OnOK();
}
开发者ID:chinajeffery,项目名称:cpp-surveillance-cli,代码行数:88,代码来源:UserAddDlg.cpp

示例6: CopySIMDataFromBuffer

void CSimSysManager::CopySIMDataFromBuffer(xmlNodePtr pDoc, ETYPE_BUS eBus)
{
    /*xmlChar* pXpath = NULL;
    xmlXPathObjectPtr pObjectPath = NULL;

    if(eBus == CAN)
    {
        pXpath = (xmlChar*)"//BUSMASTER_CONFIGURATION/Module_Configuration/CAN_Simulated_Systems";
        pObjectPath = xmlUtils::pGetNodes(pDoc, pXpath);
    }
    else if(eBus == J1939)
    {
        pXpath = (xmlChar*)"//BUSMASTER_CONFIGURATION/Module_Configuration/J1939_Simulated_Systems";
        pObjectPath = xmlUtils::pGetNodes(pDoc, pXpath);
    }

    if(m_CopyJ1939SimNode != NULL && (eBus == J1939))
    {
        xmlFreeNode(m_CopyJ1939SimNode);
        m_CopyJ1939SimNode = NULL;
    }

    else if(pObjectPath != NULL && (eBus == J1939))
    {
        m_CopyJ1939SimNode = xmlCopyNode(pObjectPath->nodesetval->nodeTab[0], 1);
    }
    else
    {
        xmlFreeNode(m_CopyJ1939SimNode);
        m_CopyJ1939SimNode = NULL;
    }*/

    xmlNodePtr pNode = pDoc;
    //if( NULL != pObjectPath )
    {
        //xmlNodeSetPtr pNodeSet = pObjectPath->nodesetval;
        //if( NULL != pNodeSet )
        //{
        //  pNode = pNodeSet->nodeTab[0];       //Take First One only
        //}
        if( NULL != pNode )
        {
            pNode = pNode->xmlChildrenNode;
            while (pNode != NULL)
            {
                if ((!xmlStrcmp(pNode->name, (const xmlChar*)"Window_Position")))
                {
                    xmlUtils::ParseWindowsPlacement(pNode, CGlobalObj::ouGetObj(m_eBus).m_wWindowPlacement);
                }
                if ((!xmlStrcmp(pNode->name, (const xmlChar*)"Sym_Path")))
                {
                    xmlChar* key = xmlNodeListGetString(pNode->doc, pNode->xmlChildrenNode, 1);
                    if(NULL != key)
                    {
                        CString omStrFileName;
                        if(PathIsRelative((char*)key) == TRUE)
                        {
                            string omStrConfigFolder;
                            string omPath;
                            char configPath[MAX_PATH];
                            AfxGetMainWnd()->SendMessage(MSG_GET_CONFIGPATH, (WPARAM)configPath, 0);
                            CUtilFunctions::nGetBaseFolder(configPath, omStrConfigFolder );
                            char chAbsPath[MAX_PATH];
                            PathCombine(chAbsPath, omStrConfigFolder.c_str(), (char*)key);
                            omStrFileName = chAbsPath;
                        }
                        else
                        {
                            omStrFileName = (char*)key;
                        }
                        vLoadSimInfoFromConfiguration(omStrFileName.GetBuffer(MAX_PATH));
                        xmlFree(key);
                    }
                }
                pNode = pNode->next;
            }
        }
        //xmlXPathFreeObject(pObjectPath);
    }
    /*
    COPY_DATA_2(&CGlobalObj::ouGetObj(m_eBus).m_wWindowPlacement, tempBuffAddress, sizeof(WINDOWPLACEMENT));
    UINT UnCount = 0;
    COPY_DATA_2(&UnCount, tempBuffAddress, sizeof(UINT));

    CString omTmp = "";
    for (UINT i = 0; i < UnCount; i++)
    {
        char acFilename[MAX_PATH] = {'\0'};
        COPY_DATA_2(acFilename, tempBuffAddress, sizeof (char) * MAX_PATH);
        omTmp.Format("%s", acFilename);
        //Add the simsys file details
        vLoadSimInfoFromConfiguration(omTmp);
    }*/
}
开发者ID:padwalsandip,项目名称:busmaster,代码行数:94,代码来源:SimSysManager.cpp

示例7: GetVariableValue

int GetVariableValue(int index ,CString &ret_cstring,CString &ret_unit,CString &Auto_M,int &digital_value)
{
	CStringArray temparray;
	CString temp1;
	if(index >= BAC_VARIABLE_ITEM_COUNT)
	{
		ret_cstring.Empty();
		ret_unit.Empty();
		Auto_M.Empty();
		return -1;
	}
	int i = index;

	if(m_Variable_data.at(i).auto_manual == 1)
	{
		Auto_M = _T("M");
	}
	else
	{
		Auto_M.Empty();
	}

	if(m_Variable_data.at(i).digital_analog == BAC_UNITS_DIGITAL)
	{
		if(m_Variable_data.at(i).range>30)
		{
			ret_cstring.Empty();
			return -1;
		}
		else
		{
			if((m_Variable_data.at(i).range < 23) &&(m_Variable_data.at(i).range !=0))
				temp1 = Digital_Units_Array[m_Variable_data.at(i).range];
			else if((m_Variable_data.at(i).range >=23) && (m_Variable_data.at(i).range <= 30))
			{
				if(receive_customer_unit)
					temp1 = temp_unit_no_index[m_Variable_data.at(i).range - 23];
			}
			else
			{
				ret_cstring.Empty();
				return -1;
			}


			SplitCStringA(temparray,temp1,_T("/"));
			if((temparray.GetSize()==2))
			{
				if(m_Variable_data.at(i).control == 0)
				{
					digital_value = 0;
					ret_cstring = temparray.GetAt(0);
					return 1;
				}
				else
				{
					digital_value = 1;
					ret_cstring = temparray.GetAt(1);
				}
			}

		}
	}
	else
	{
		if(m_Variable_data.at(i).range == 20)	//如果是时间;
		{
			ret_unit = Variable_Analog_Units_Array[m_Variable_data.at(i).range];
			char temp_char[50];
			int time_seconds = m_Variable_data.at(i).value / 1000;
			intervaltotext(temp_char,time_seconds,0,0);

			MultiByteToWideChar( CP_ACP, 0, temp_char, strlen(temp_char) + 1, 
				ret_cstring.GetBuffer(MAX_PATH), MAX_PATH );
			ret_cstring.ReleaseBuffer();	
			digital_value = 2;
		}
		else if((m_Variable_data.at(i).range<=sizeof(Variable_Analog_Units_Array)/sizeof(Variable_Analog_Units_Array[0])) && (m_Variable_data.at(i).range != 0))
		{
			ret_unit = Variable_Analog_Units_Array[m_Variable_data.at(i).range];
			CString cstemp_value;
			float temp_float_value;
			temp_float_value = ((float)m_Variable_data.at(i).value) / 1000;
			ret_cstring.Format(_T("%.3f"),temp_float_value);
			digital_value = 2;
		}
		else
		{
			ret_cstring.Empty();
			return -1;
		}
	}

	return 1;
}
开发者ID:ALEXLCC,项目名称:T3000_Building_Automation_System,代码行数:95,代码来源:BacnetVariable.cpp

示例8: GetDesktopImageData

bool ImageHandler::GetDesktopImageData(ImageData& imageData)
{
	CRegKey keyColors;

	if (keyColors.Open(HKEY_CURRENT_USER, L"Control Panel\\Colors", KEY_READ) != ERROR_SUCCESS) return false;

	CString	strBackground;
	DWORD	dwDataSize = 32;

	if (keyColors.QueryStringValue(L"Background", strBackground.GetBuffer(dwDataSize), &dwDataSize) != ERROR_SUCCESS)
	{
		strBackground.ReleaseBuffer();
		return false;
	}
	strBackground.ReleaseBuffer();

	wstringstream	streamBk(wstring(strBackground.operator LPCTSTR()));
	DWORD			r = 0;
	DWORD			g = 0;
	DWORD			b = 0;

	streamBk >> r;
	streamBk >> g;
	streamBk >> b;

	CRegKey keyDesktop;
	if (keyDesktop.Open(HKEY_CURRENT_USER, L"Control Panel\\Desktop", KEY_READ) != ERROR_SUCCESS) return false;

	DWORD	dwChars = 0;
	CString	strWallpaperFile;
	CString	strWallpaperStyle;
	CString	strWallpaperTile;

	dwChars = 32;
	keyDesktop.QueryStringValue(L"WallpaperStyle", strWallpaperStyle.GetBuffer(dwChars), &dwChars);
	dwChars = 32;
	keyDesktop.QueryStringValue(L"TileWallpaper", strWallpaperTile.GetBuffer(dwChars), &dwChars);
	dwChars = MAX_PATH;
	keyDesktop.QueryStringValue(L"Wallpaper", strWallpaperFile.GetBuffer(dwChars), &dwChars);

	strWallpaperStyle.ReleaseBuffer();
	strWallpaperFile.ReleaseBuffer();
	strWallpaperTile.ReleaseBuffer();

	// set background data
	imageData.strFilename	= strWallpaperFile;
	imageData.bRelative		= true;
	imageData.bExtend		= false;
	imageData.crBackground	= RGB(static_cast<BYTE>(r), static_cast<BYTE>(g), static_cast<BYTE>(b));

	if (strWallpaperTile == L"1")
	{
		imageData.imagePosition= imagePositionTile;
	}
	else
	{
		if (strWallpaperStyle == L"0")
		{
			imageData.imagePosition= imagePositionCenter;
		}
		else if (strWallpaperStyle == L"6")
		{
			imageData.imagePosition= imagePositionFit;
		}
		else if (strWallpaperStyle == L"10")
		{
			imageData.imagePosition= imagePositionFill;
		}
		else if (strWallpaperStyle == L"22")
		{
			imageData.imagePosition= imagePositionFill;
			imageData.bExtend = true;
		}
		else
		{
			imageData.imagePosition= imagePositionStretch;
		}
	}

#if _WIN32_WINNT >= 0x0602
	if( ImageHandler::IsWin8() )
	{
		CComPtr<IDesktopWallpaper> desktopWallpaper;
		HRESULT hr = desktopWallpaper.CoCreateInstance(CLSID_DesktopWallpaper, nullptr, CLSCTX_ALL);
		if( SUCCEEDED(hr) )
		{
			DESKTOP_WALLPAPER_POSITION position;
			hr = desktopWallpaper->GetPosition(&position);

			UINT count = 0;
			hr = desktopWallpaper->GetMonitorDevicePathCount(&count);
			if( hr == S_OK && position == DWPOS_SPAN && count > 1 )
			{
				CComHeapPtr<wchar_t> spszWallpaper;
				hr = desktopWallpaper->GetWallpaper(NULL, &spszWallpaper);
				if( hr == S_OK )
					imageData.bExtend = true;
			}
		}
	}
//.........这里部分代码省略.........
开发者ID:MussaratAziz,项目名称:console,代码行数:101,代码来源:ImageHandler.cpp

示例9: setAtribut

bool ModelFriend::setAtribut(CString& atribut_nou)
{
	atribut.Empty();
	int z,l,a;
	char data[11],zi[3],luna[34],an[5];

	strcpy(data,atribut_nou.GetBuffer());
	strcpy(zi,"");
	strcpy(luna,"");
	strcpy(an,"");

	int i=0;
	int j=0;
	while(isdigit(data[j])!=0)
		zi[i++]=data[j++];
	zi[i]=0;

	if(j==0)
		return false;

	data[j++]='/';


	i=0;
	while(isdigit(data[j])!=0)
		luna[i++]=data[j++];
	luna[i]=0;
		
	if(j==1)
		return false;

	data[j++]='/';


	i=0;
	while(isdigit(data[j])!=0)
		an[i++]=data[j++];
	an[i]=0;

	z=atoi(zi);
	l=atoi(luna);
	a=atoi(an);

	if(a<0)
		a=0;
	if(a>9999)
		a=9999;

	if(l<0)
		l=1;
	if(l>12)
		l=12;

	bool bisect;

	if(((a%4==0)&&(a%100!=0))||(a%400==0))
		bisect=true;

	if(z<0)
		z=1;

	switch(l)
	{
	case 1: case 3: case 5: case 7: case 8: case 10: case  12: if(z>31) z=31;
	case 2:
		if(bisect)
		{
			if(z>29)
				z=29;
		}
		else
			if(z>28)
				z=28;
	case 4: case 6: case 9: case 11: if(z>30) z=30;	
	}
		
	strcpy(data,"");

	strcpy(data,itoa(z,zi,10));
	strcat(data,"/");
	strcat(data,itoa(l,luna,10));
	strcat(data,"/");
	strcat(data,itoa(a,an,10));

	atribut=data;
	
	return true;
}
开发者ID:RobertAlexandroaie,项目名称:C_CPP,代码行数:88,代码来源:model_contact.cpp

示例10: Convert


//.........这里部分代码省略.........
	if(ucRawData[35] == 0x00)
		strValue = "初次运行扎帐 ";
	else if(ucRawData[35] == 0x01)
		strValue = "上位机扎帐 ";
	else if(ucRawData[35] == 0x02)
		strValue = "复核扎帐 ";
	else if(ucRawData[35] == 0x03)
	{
		nSettType = 0;
		strValue = "手工扎帐 ";
	}
	else if(ucRawData[35] == 0x04)
	{
		nSettType = 1;
		strValue = "定时扎帐 ";
	}
	else if(ucRawData[35] == 0x05)
	{
		nSettType = 1;
		strValue = "开机扎帐 ";
	}
	else
		strValue = "未知类型 ";
	strValue.Format("CRC:%.2X%.2X\n", ucRawData[36],ucRawData[37]);  strText += strValue ;

	CString strAdjust=GetAdjustCode(pszAdjustCode, m_SRC.nSettleInvoice, 
		m_SRC.sSettleTime, "Smart_Settlement");

	if( strAdjust == "" && 	!IsValidDateTime(&ucRawData[8])  )
	{
		strAdjust = "0204";
	}

	m_pDoc = pDoc ;

	CString strTemp = "" ;

	strTemp = "INSERT INTO " + m_strTableName ;
	strTemp+= "(SMT_RowID, SMT_AuthNo, SMT_Data, SMT_CRC, ";
	strTemp+= "SMT_DateTime, SMT_DealWith, SMT_DealWithDateTime, SMT_AdjustCode) ";
	strTemp+= " VALUES(SMART_JZSOURCE%s_rowid.nextval, %ld, '%s', %d, SYSDATE, 0, NULL, '%s')";

	if( strAdjust == "0102" )
	{
		strSQL1.Format(strTemp, szDateTime, nAuthNo, 
			strData.GetBuffer(0), 0, strAdjust.GetBuffer(0));
	}
	else
	{
		strSQL1.Format(strTemp, szDateTime, nAuthNo, 
			strData.GetBuffer(0), 1, strAdjust.GetBuffer(0));
	}

	strTemp = "INSERT INTO Smart_Settlement(" ;
	strTemp+= " SMT_RowID, SMT_Authno, SMT_MachineID, SMT_Org_id, " ;
	strTemp+= " SMT_SettleInvoice, SMT_SettleTime, SMT_BeginInvoice, " ;
	strTemp+= " SMT_EndInvoice, SMT_DealCount, SMT_DealAmount, " ;
	strTemp+= " SMT_CancelCount, SMT_CancelAmount, SMT_OtherCount, " ;
	strTemp+= " SMT_OperatorID, SMT_KeepingDate, SMT_BatchNo, " ;
	strTemp+= " SMT_SettleType, SMT_DealCode, SMT_EXCEPTCOUNT, SMT_EXCEPTAMOUNT, SMT_ADJUSTCODE) VALUES( " ;
	strTemp+= " SMART_SETTLEMENT_ROWID.nextval, %d, '%s', '%s', " ;
	strTemp+= " %d, to_date('%s','yyyy-mm-dd hh24:mi:ss'), %d, " ;
	strTemp+= " %d, %d, %d, " ;
	strTemp+= " %d, %d, %d, " ;
	strTemp+= " '%d', SYSDATE, %d, " ;
	strTemp+= " %d, '%s', %d, %d,'%s')" ;

	char  szOrg[12];
	if( !strcmp(pDoc->m_szOrgid, "") )
		strcpy(szOrg, " ");
	else
		strcpy(szOrg, pDoc->m_szOrgid);

	strSQL2.Format(strTemp.GetBuffer(0), nAuthNo, m_SRC.sMachineID, szOrg, 
		m_SRC.nSettleInvoice, m_SRC.sSettleTime, m_SRC.nBeginInvoice, 
		m_SRC.nEndInvoice, m_SRC.nDealCount, m_SRC.nDealAmount, 
		m_SRC.nCancelCount, m_SRC.nCancelAmount, m_SRC.nOtherCount, 
		999, 0, 
		nSettType, strDealCode.GetBuffer(0), m_SRC.nExcepCount, m_SRC.nExcepACount, strAdjust.GetBuffer(0));

	strUpdate.Format("Update Smart_Commrec Set  SMT_LASTDEALDATETIME=to_date('%s','yyyy-mm-dd hh24:mi:ss'), SMT_SETTLEINVOICE=%ld, SMT_SETTLETIME=to_date('%s','yyyy-mm-dd hh24:mi:ss'), SMT_BEGININVOICE=%d, SMT_ENDINVOICE=%d Where Smt_AuthNo=%ld ", 
		m_SRC.sSettleTime, m_SRC.nSettleInvoice, m_SRC.sSettleTime, m_SRC.nBeginInvoice, 
		m_SRC.nEndInvoice, nAuthNo);
/*
	CString strString;

	pDoc->m_nFlow = m_SRC.nSettleInvoice;
	pDoc->m_nCardID = 0;
	pDoc->m_nInMoney = m_SRC.nDealAmount;
	pDoc->m_nOutMoney = m_SRC.nCancelAmount;
	pDoc->m_nDealCount++;

	strString.Format("%d&%d&%d&%s&%d&%d&%d",
		pDoc->m_nAuthID, m_SRC.nSettleInvoice, pDoc->m_nDealCount, 
		m_SRC.sSettleTime, 0, m_SRC.nDealAmount, m_SRC.nCancelAmount);

	BroadcastPro(PACKET_CMD_1002, pDoc, strString.GetBuffer(0), strString.GetLength());
*/
	return true;
}
开发者ID:Codiscope-Research,项目名称:ykt4sungard,代码行数:101,代码来源:JZSRCTable.cpp

示例11: ReplaceKeySymbol

void CFormat::ReplaceKeySymbol(CSymbolReplaceSetDlg* pSymbolReplaceSetDlg, CRichEditView *pRichEditView)
{
	long startPos=0,endPos=0;
	CRichEditCtrl* pRichEditCtrl=&pRichEditView->GetRichEditCtrl();

	//判断是否为全文替换,确定终止位置
	if(pSymbolReplaceSetDlg->m_nSelect==1){
		long lineCount=pRichEditCtrl->GetLineCount();
		CString strLine;
		for(long i=0;i<lineCount;i++){
			pRichEditCtrl->GetLine(i,strLine.GetBuffer());
			if(strLine.Find(_T("**注释**"))!=-1){
				endPos=pRichEditCtrl->LineIndex(i);
			}
		}
	}
	else{
		endPos=pRichEditCtrl->GetTextLength();
	}

	//开始替换
	CString strCh;
	while(startPos<endPos-1){
		pRichEditCtrl->GetTextRange(startPos,startPos+1,strCh);

		//////////单个字符比较//////////////
		//逗号
		if(pSymbolReplaceSetDlg->m_Symbol1){
			if(strCh.Compare(_T(","))==0){
				pRichEditCtrl->SetSel(startPos,startPos+1);
				if(!pSymbolReplaceSetDlg->m_editString1.IsEmpty()){
					pRichEditCtrl->ReplaceSel(
						pSymbolReplaceSetDlg->m_editString1);
				}
				else{
					pRichEditCtrl->ReplaceSel(_T(","));
				}
			}
		}
		//句号
		if(pSymbolReplaceSetDlg->m_Symbol2){
			if(strCh.Compare(_T("."))==0){
				pRichEditCtrl->SetSel(startPos,startPos+1);
				if(!pSymbolReplaceSetDlg->m_editString2.IsEmpty()){
					pRichEditCtrl->ReplaceSel(
						pSymbolReplaceSetDlg->m_editString2);
				}
				else{
					pRichEditCtrl->ReplaceSel(_T("。"));
				}
			}
		}
		//分号
		if(pSymbolReplaceSetDlg->m_Symbol3){
			if(strCh.Compare(_T(";"))==0){
				pRichEditCtrl->SetSel(startPos,startPos+1);
				if(!pSymbolReplaceSetDlg->m_editString3.IsEmpty()){
					pRichEditCtrl->ReplaceSel(
						pSymbolReplaceSetDlg->m_editString3);
				}
				else{
					pRichEditCtrl->ReplaceSel(_T(";"));
				}
			}
		}
		//冒号
		if(pSymbolReplaceSetDlg->m_Symbol4){
			if(strCh.Compare(_T(":"))==0){
				pRichEditCtrl->SetSel(startPos,startPos+1);
				if(!pSymbolReplaceSetDlg->m_editString4.IsEmpty()){
					pRichEditCtrl->ReplaceSel(
						pSymbolReplaceSetDlg->m_editString4);
				}
				else{
					pRichEditCtrl->ReplaceSel(_T(":"));
				}
			}
		}
		//波浪号
		if(pSymbolReplaceSetDlg->m_Symbol5){
			if(strCh.Compare(_T("~"))==0){
				pRichEditCtrl->SetSel(startPos,startPos+1);
				if(!pSymbolReplaceSetDlg->m_editString5.IsEmpty()){
					pRichEditCtrl->ReplaceSel(
						pSymbolReplaceSetDlg->m_editString5);
				}
				else{
					pRichEditCtrl->ReplaceSel(_T("~"));
				}
			}
		}
		//括号
		if(pSymbolReplaceSetDlg->m_Symbol7){
			if(strCh.Compare(_T("("))==0){
				pRichEditCtrl->SetSel(startPos,startPos+1);
				pRichEditCtrl->ReplaceSel(_T("("));
			}
			else if(strCh.Compare(_T(")"))==0){
				pRichEditCtrl->SetSel(startPos,startPos+1);
				pRichEditCtrl->ReplaceSel(_T(")"));
//.........这里部分代码省略.........
开发者ID:kooyou,项目名称:EBE,代码行数:101,代码来源:Format.cpp

示例12: SelectFile

/**
 * @brief Helper function for selecting folder or file.
 * This function shows standard Windows file selection dialog for selecting
 * file or folder to open or file to save. The last parameter @p is_open selects
 * between open or save modes. Biggest difference is that in save-mode Windows
 * asks if user wants to override existing file.
 * @param [in] parent Handle to parent window. Can be a NULL, but then
 *     CMainFrame is used which can cause modality problems.
 * @param [out] path Selected path is returned in this string
 * @param [in] initialPath Initial path (and file) shown when dialog is opened
 * @param [in] titleid Resource string ID for dialog title.
 * @param [in] filterid 0 or STRING ID for filter string
 *     - 0 means "All files (*.*)". Note the string formatting!
 * @param [in] is_open Selects Open/Save -dialog (mode).
 * @note Be careful when setting @p parent to NULL as there are potential
 * modality problems with this. Dialog can be lost behind other windows!
 * @param [in] defaultExtension Extension to append if user doesn't provide one
 */
BOOL SelectFile(HWND parent, CString& path, LPCTSTR initialPath /*=NULL*/,
		UINT titleid /*=0*/, UINT filterid /*=0*/,
		BOOL is_open /*=TRUE*/, LPCTSTR defaultExtension /*=NULL*/)
{
	path.Empty(); // Clear output param

	// This will tell common file dialog what to show
	// and also this will hold its return value
	CString sSelectedFile;

	// check if specified path is a file
	if (initialPath && initialPath[0])
	{
		// If initial path info includes a file
		// we put the bare filename into sSelectedFile
		// so the common file dialog will start up with that file selected
		if (paths_DoesPathExist(initialPath) == IS_EXISTING_FILE)
		{
			String temp;
			SplitFilename(initialPath, 0, &temp, 0);
			sSelectedFile = temp.c_str();
		}
	}

	if (parent == NULL)
		parent = AfxGetMainWnd()->GetSafeHwnd();
	
	if (!filterid)
		filterid = IDS_ALLFILES;
	String title = theApp.LoadString(titleid);
	String filters = theApp.LoadString(filterid);

	// Convert extension mask from MFC style separators ('|')
	//  to Win32 style separators ('\0')
	LPTSTR filtersStr = &*filters.begin();
	ConvertFilter(filtersStr);

	OPENFILENAME_NT4 ofn;
	memset(&ofn, 0, sizeof(ofn));
	ofn.lStructSize = sizeof(ofn);
	ofn.hwndOwner = parent;
	ofn.lpstrFilter = filtersStr;
	ofn.lpstrCustomFilter = NULL;
	ofn.nFilterIndex = 1;
	ofn.lpstrFile = sSelectedFile.GetBuffer(MAX_PATH);
	ofn.nMaxFile = MAX_PATH;
	ofn.lpstrInitialDir = initialPath;
	ofn.lpstrTitle = title.c_str();
	ofn.lpstrFileTitle = NULL;
	if (defaultExtension)
		ofn.lpstrDefExt = defaultExtension;
	ofn.Flags = OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY | OFN_PATHMUSTEXIST;

	BOOL bRetVal = FALSE;
	if (is_open)
		bRetVal = GetOpenFileName((OPENFILENAME *)&ofn);
	else
		bRetVal = GetSaveFileName((OPENFILENAME *)&ofn);
	// common file dialog populated sSelectedFile variable's buffer
	sSelectedFile.ReleaseBuffer();
	SetCurrentDirectory(env_GetWindowsDirectory().c_str()); // Free handle held by GetOpenFileName

	if (bRetVal)
		path = sSelectedFile;
	
	return bRetVal;
}
开发者ID:YueLinHo,项目名称:WinMerge,代码行数:85,代码来源:FileOrFolderSelect.cpp

示例13: SelectFileOrFolder

/** 
 * @brief Shows file/folder selection dialog.
 *
 * We need this custom function so we can select files and folders with the
 * same dialog.
 * - If existing filename is selected return it
 * - If filename in (CFileDialog) editbox and current folder doesn't form
 * a valid path to file, return current folder.
 * @param [in] parent Handle to parent window. Can be a NULL, but then
 *     CMainFrame is used which can cause modality problems.
 * @param [out] path Selected folder/filename
 * @param [in] initialPath Initial file or folder shown/selected.
 * @return TRUE if user choosed a file/folder, FALSE if user canceled dialog.
 */
BOOL SelectFileOrFolder(HWND parent, CString& path, LPCTSTR initialPath /*=NULL*/)
{
	String title = theApp.LoadString(IDS_OPEN_TITLE);

	// This will tell common file dialog what to show
	// and also this will hold its return value
	CString sSelectedFile;

	// check if specified path is a file
	if (initialPath && initialPath[0])
	{
		// If initial path info includes a file
		// we put the bare filename into sSelectedFile
		// so the common file dialog will start up with that file selected
		if (paths_DoesPathExist(initialPath) == IS_EXISTING_FILE)
		{
			String temp;
			SplitFilename(initialPath, 0, &temp, 0);
			sSelectedFile = temp.c_str();
		}
	}

	if (parent == NULL)
		parent = AfxGetMainWnd()->GetSafeHwnd();

	int filterid = IDS_ALLFILES;

	if (!filterid)
		filterid = IDS_ALLFILES;

	String filters = theApp.LoadString(filterid);

	// Convert extension mask from MFC style separators ('|')
	//  to Win32 style separators ('\0')
	LPTSTR filtersStr = &*filters.begin();
	ConvertFilter(filtersStr);

	String dirSelTag = theApp.LoadString(IDS_DIRSEL_TAG);

	// Set initial filename to folder selection tag
	dirSelTag += _T("."); // Treat it as filename
	sSelectedFile = dirSelTag.c_str(); // What is assignment above good for?

	OPENFILENAME_NT4 ofn;
	memset(&ofn, 0, sizeof(ofn));
	ofn.lStructSize = sizeof(ofn);
	ofn.hwndOwner = parent;
	ofn.lpstrFilter = filtersStr;
	ofn.lpstrCustomFilter = NULL;
	ofn.nFilterIndex = 1;
	ofn.lpstrFile = sSelectedFile.GetBuffer(MAX_PATH);
	ofn.nMaxFile = MAX_PATH;
	ofn.lpstrInitialDir = initialPath;
	ofn.lpstrTitle = title.c_str();
	ofn.lpstrFileTitle = NULL;
	ofn.Flags = OFN_HIDEREADONLY | OFN_PATHMUSTEXIST | OFN_NOTESTFILECREATE;

	BOOL bRetVal = GetOpenFileName((OPENFILENAME *)&ofn);
	// common file dialog populated sSelectedFile variable's buffer
	sSelectedFile.ReleaseBuffer();
	SetCurrentDirectory(env_GetWindowsDirectory().c_str()); // Free handle held by GetOpenFileName

	if (bRetVal)
	{
		path = sSelectedFile;
		struct _stati64 statBuffer;
		int nRetVal = _tstati64(path, &statBuffer);
		if (nRetVal == -1)
		{
			// We have a valid folder name, but propably garbage as a filename.
			// Return folder name
			String folder = GetPathOnly(sSelectedFile);
			path.Format(_T("%s\\"), folder.c_str());
		}
	}
	return bRetVal;
}
开发者ID:YueLinHo,项目名称:WinMerge,代码行数:91,代码来源:FileOrFolderSelect.cpp

示例14: Create

void CGitStatusCache::Create()
{
	ATLASSERT(m_pInstance == NULL);
	m_pInstance = new CGitStatusCache;

	m_pInstance->watcher.SetFolderCrawler(&m_pInstance->m_folderCrawler);
#define LOADVALUEFROMFILE(x) if (fread(&x, sizeof(x), 1, pFile)!=1) goto exit;
#define LOADVALUEFROMFILE2(x) if (fread(&x, sizeof(x), 1, pFile)!=1) goto error;
	unsigned int value = (unsigned int)-1;
	FILE * pFile = NULL;
	// find the location of the cache
	TCHAR path[MAX_PATH];		//MAX_PATH ok here.
	TCHAR path2[MAX_PATH];
	SecureZeroMemory(path, sizeof(path));
	SecureZeroMemory(path2, sizeof(path2));
	if (SHGetFolderPath(NULL, CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, path)==S_OK)
	{
		_tcscat_s(path, MAX_PATH, _T("\\TGitCache"));
		if (!PathIsDirectory(path))
		{
			if (CreateDirectory(path, NULL)==0)
				goto error;
		}
		_tcscat_s(path, MAX_PATH, _T("\\cache"));
		// in case the cache file is corrupt, we could crash while
		// reading it! To prevent crashing every time once that happens,
		// we make a copy of the cache file and use that copy to read from.
		// if that copy is corrupt, the original file won't exist anymore
		// and the second time we start up and try to read the file,
		// it's not there anymore and we start from scratch without a crash.
		_tcscpy_s(path2, MAX_PATH, path);
		_tcscat_s(path2, MAX_PATH, _T("2"));
		DeleteFile(path2);
		CopyFile(path, path2, FALSE);
		DeleteFile(path);
		pFile = _tfsopen(path2, _T("rb"), _SH_DENYNO);
		if (pFile)
		{
			try
			{
				LOADVALUEFROMFILE(value);
				if (value != 2)
				{
					goto error;
				}
				int mapsize = 0;
				LOADVALUEFROMFILE(mapsize);
				for (int i=0; i<mapsize; ++i)
				{
					LOADVALUEFROMFILE2(value);
					if (value > MAX_PATH)
						goto error;
					if (value)
					{
						CString sKey;
						if (fread(sKey.GetBuffer(value+1), sizeof(TCHAR), value, pFile)!=value)
						{
							sKey.ReleaseBuffer(0);
							goto error;
						}
						sKey.ReleaseBuffer(value);
						CCachedDirectory * cacheddir = new CCachedDirectory();
						if (cacheddir == NULL)
							goto error;
						if (!cacheddir->LoadFromDisk(pFile))
							goto error;
						CTGitPath KeyPath = CTGitPath(sKey);
						if (m_pInstance->IsPathAllowed(KeyPath))
						{
							m_pInstance->m_directoryCache[KeyPath] = cacheddir;
							// only add the path to the watch list if it is versioned
							if ((cacheddir->GetCurrentFullStatus() != git_wc_status_unversioned)&&(cacheddir->GetCurrentFullStatus() != git_wc_status_none))
								m_pInstance->watcher.AddPath(KeyPath, false);
							// do *not* add the paths for crawling!
							// because crawled paths will trigger a shell
							// notification, which makes the desktop flash constantly
							// until the whole first time crawling is over
							// m_pInstance->AddFolderForCrawling(KeyPath);
						}
					}
				}
			}
			catch (CAtlException)
			{
				goto error;
			}
		}
	}
exit:
	if (pFile)
		fclose(pFile);
	DeleteFile(path2);
	m_pInstance->watcher.ClearInfoMap();
	ATLTRACE("cache loaded from disk successfully!\n");
	return;
error:
	if (pFile)
		fclose(pFile);
	DeleteFile(path2);
	m_pInstance->watcher.ClearInfoMap();
//.........这里部分代码省略.........
开发者ID:mirror,项目名称:TortoiseGit,代码行数:101,代码来源:GITStatusCache.cpp

示例15: FileNavCommand

void FileNavCommand()
{
    LPCTSTR filterALL[] = {
        "*.*", NULL
    };
    LPCTSTR filterCPP[] = {
        "*.zip", "*.c", "*.cpp", "*.h", NULL
    };
    LPCTSTR filterDOC[] = {
        "*.doc", "*.txt", NULL
    };
    LPCTSTR filterDWG[] = {
        "*.dwg", "*.dxb", "*.dxf", NULL
    };
    LPCTSTR filterIMG[] = {
        "*.gif", "*.jpg", "*.tif", "*.tiff", NULL
    };
    LPCTSTR filterDescription[] = {
        "All files", "C++ files", "Documents", "Drawings", "Images", NULL
    };
    LPCTSTR *filterSpec[] = {
        filterALL, filterCPP, filterDOC, filterDWG, filterIMG, NULL
    };

    CNavFilter *f;
    int  i = 0, j;

    gFilterArray.RemoveAllData();

    while (filterSpec[i] != NULL) {
        // Append a new filter.
        f = gFilterArray.AddData();

        if (f != NULL) {
            // Set the filter's description.
            f->SetDescription(filterDescription[i]);

            // Assign the filter strings.
            j = 0;
            while (filterSpec[i][j] != NULL) {
                f->Add(filterSpec[i][j]);
                j++;
            }
        }

        // Prepare to add the next filter.
        i++;
    }
    while (true)
    {
        HWND acadHandle = adsw_acadMainWnd();
        ::EnableWindow (acadHandle, true);
        ::SetFocus (acadHandle);
        CWnd *pWnd = CWnd::FromHandle(acadHandle);

        CFileNavDlg dlg(gDataArray, gFilterArray, 0, pWnd);
        dlg.SetMultiSelectAllowed(TRUE);
        dlg.SetDialogCaption("Browse down to a file");


        if (dlg.DoModal() == IDOK)
        {
            for(int i = 0; i < gDataArray.GetCount(); i++)
            {
                LPITEMIDLIST id = gDataArray[i]->GetID();
                //able to get the text string entered/selected by user in File Name Combo
                //along with its full parth
                CString sText = gDataArray[i]->GetText();
                if (sText.GetLength() != 0)
                {
                    acutPrintf ("The file name is:\n%s\n",sText.GetBuffer(sText.GetLength()));
                }
            }

        }
        break;
    }
}
开发者ID:kevinzhwl,项目名称:ObjectARXMod,代码行数:78,代码来源:FileNavCommand.cpp


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