本文整理汇总了C++中String::AnsiCompareIC方法的典型用法代码示例。如果您正苦于以下问题:C++ String::AnsiCompareIC方法的具体用法?C++ String::AnsiCompareIC怎么用?C++ String::AnsiCompareIC使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类String
的用法示例。
在下文中一共展示了String::AnsiCompareIC方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: strtok
void __fastcall TFormMain::NMUDP1DataReceived(TComponent *Sender,
int NumberBytes, AnsiString FromIP, int Port)
{
char * buf = (char*)malloc(5000);
int bytesread = 0;
NMUDP1->ReadBuffer( buf, 5000, bytesread );
char *p = strtok( buf, "\n" );
String proc = p;
proc = proc.Trim();
// procura processo ( a primeira linha da mensagem é o nome do processo )
for ( unsigned i = 0; i < Processos.size(); i++ )
if ( proc.AnsiCompareIC(Processos[i]) == 0 )
{ // achou, resseta watchdog
WDCnt[i] = 0;
if ( i == (unsigned)ProcIndex ) // mostra se for o processo selecionado
{
memoMens->Lines->Clear();
memoMens->Lines->Add( proc );
while ( ( p = strtok(NULL, "\n")) != NULL )
{
memoMens->Lines->Add(p);
}
}
break;
}
free(buf);
}
示例2: ProcessoExecutando
bool ProcessoExecutando(String ExeFile, DWORD &id)
{
bool achou = false;
HANDLE snap;
PROCESSENTRY32 pre;
bool ret;
DWORD idProcess[200];
DWORD cbNeeded;
EnumProcesses(
idProcess, // array of process identifiers
sizeof(idProcess), // size of array
&cbNeeded // number of bytes returned
);
unsigned i;
for ( i = 0; i < (int)cbNeeded / sizeof(DWORD); i++ )
{
HANDLE hProcess = OpenProcess( PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, 0, idProcess[i] );
if ( hProcess != NULL )
{
HMODULE hmp[100];
DWORD dwSize;
int ret = EnumProcessModules( hProcess, hmp, sizeof(hmp), &dwSize );
if ( ret != 0 )
{
char buf[1000];
GetModuleFileNameEx( hProcess, hmp[0], buf, sizeof(buf) - 1 );
if( ExeFile.AnsiCompareIC(buf) == 0 )
{
id = idProcess[i];
achou = true;
CloseHandle( hProcess );
break;
}
}
CloseHandle( hProcess );
}
}
return achou;
}