示例#1
0
文件: fMain.cpp 项目: japgo/mygithub
String TfrmMain::refreshVersion()
{
    DWORD dwHandle = 0, dwVersionInfoSize;
    UINT uLength;
    LPVOID pFileInfo, ptr;
    String sOut; // 리턴될 버전 정보.

    String filename = Application->ExeName;

    dwVersionInfoSize = GetFileVersionInfoSize(filename.c_str(), &dwHandle);

    pFileInfo = (LPVOID) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwVersionInfoSize);

    GetFileVersionInfo(filename.c_str(), dwHandle, dwVersionInfoSize, pFileInfo);
    VerQueryValue(pFileInfo, TEXT("\\VarFileInfo\\Translation"), &ptr, &uLength);

    WORD *id = (WORD *) ptr;
    String sQuery =  "FileVersion";//{"CompanyName", "FileDescription", "FileVersion", "InternalName", "LegalCopyright", "LegalTradeMarks", "OriginalFileName", "ProductName", "ProductVersion", "Comments"};
    String szString = "\\StringFileInfo\\" + IntToHex(id[0], 4) + IntToHex(id[1], 4) + "\\" + sQuery;

    VerQueryValue(pFileInfo, szString.c_str(), &ptr, &uLength);
    sOut = String((wchar_t *) ptr);
    HeapFree(GetProcessHeap(), 0, pFileInfo );
    return sOut;
}
示例#2
0
void __fastcall TDesignFrm::btStartNewClick(TObject *Sender)
{
    if(SourceGenDesignFrm->StartDesign() == false)
        return;

    String  fileName, head, subHead;
    m_WorkSpaceManager->BeginUpdate();
    for(int i=0; i<SourceGenDesignFrm->GetHeadCount(); i++)
    {
        for(int j=0; j<SourceGenDesignFrm->GetSubHeadCount(); j++)
        {
            head = IntToHex(i+1, 2);
            subHead = IntToHex(j+1, 2);
            fileName = FormatStr("Pack_%s_%s.eggxp", head, subHead);
            WorkSpace	*  selWorkSpace = m_WorkSpaceManager->CreateNewWorkSpace();
            selWorkSpace->InitWorkSpace(m_WorkSpaceManager->GetFilePath(),
						fileName, head + " " + subHead);

			selWorkSpace->GetFileManager()->CreateNew();
            selWorkSpace->SaveToFile();            
        }
    }

    m_WorkSpaceManager->ReloadWorkSpacePack();
    WorkspaceToGUI();
    m_WorkSpaceManager->EndUpdate();
}
//---------------------------------------------------------------------------
// TImageBuffer constructor
//
__fastcall TImageBuffer::TImageBuffer(int Size, int Count) {

  FAllocSister = NULL;

  Sync = new TMultiReadExclusiveWriteSynchronizer();

  ChunkSize = Size;
  ChunkCount = 1 << (int)Ceil(Log2(Count));
  IndexMask = ChunkCount - 1;
  Chunks = new TBufferChunk *[ChunkCount];
  ChunkStates = new TBufferChunkState [ChunkCount];

  NextReadChunkIndex = NextWriteChunkIndex = 0;

  // Create all the buffer chunks
  for (unsigned n = 0; n < ChunkCount; n++) {
    Chunks[n] = new TBufferChunk(ChunkSize, n);
    ChunkStates[n] = csFree;
  }  // for (unsigned n = 0; n < nChunkCount; n++)

  // Initialize our event objects
  ReadChunkReady  = new TEvent(NULL, true, false, IntToHex((int)this, 8) + ":Read");
  if (!ReadChunkReady->Handle)
    throw ESelfImageSystemError("Failed to create image buffer read event object.");
  WriteChunkReady = new TEvent(NULL, true, false, IntToHex((int)this, 8) + ":Write");
  if (!WriteChunkReady->Handle)
    throw ESelfImageSystemError("Failed to create image buffer write event object.");

}  // TImageBuffer::TImageBuffer(int nChunkSize, int nChunkCount)
示例#4
0
void __fastcall TDesignFrm::btClearHeadDefClick(TObject *Sender)
{
    int result = Application->MessageBox(L"这个清空动作会清空所有文件!  是否继续?",L"删除询问",MB_OKCANCEL);
    if(result == IDCANCEL)
    {
        return;
    }

    m_WorkSpaceManager->BeginUpdate();
    for(int i=m_WorkSpaceManager->GetWorkSpaceCount()-1; i>=0; i--)
    {
        m_WorkSpaceManager->DeleteWorkSpace(i);
    }


    //添加一条新数据
    String  head = IntToHex(0, 2);
    String  subHead = IntToHex(0, 2);
    String  fileName = FormatStr("Pack_%s_%s.eggxp", head, subHead);
    WorkSpace	*  selWorkSpace = m_WorkSpaceManager->CreateNewWorkSpace();
    selWorkSpace->InitWorkSpace(m_WorkSpaceManager->GetFilePath(),
				fileName, head);

	selWorkSpace->GetFileManager()->CreateNew();
	selWorkSpace->SaveToFile();

	m_WorkSpaceManager->ReloadWorkSpacePack();

	WorkspaceToGUI();
	m_WorkSpaceManager->EndUpdate();
}
示例#5
0
QString Cdebug_ti57cpu::Decode(TI57regs *r) {
    QString Result;

//    qWarning()<<QString("OP:%1").arg(r->OP,4,16,QChar('0'));

    if (r->OP & 0x1000) {
        if (r->OP & 0x0800) Result=BranchOP(r);
        else Result=CallOP(r);
    }
    else {
        r->MF = (r->OP >> 8);
        switch (r->MF) {
        case 0:
        case 1:
        case 2:
        case 3:
        case 4:
        case 5:
        case 7:
        case 8:
        case 9:
        case 0x0a:
        case 0x0d:
        case 0x0f: Result = MaskOP(r); break;
        case 0x0C: Result = FlagOP(r); break;
        case 0x0E: Result = MiscOP(r); break;
        default: Result="Error: Invalid Instruction"; break;
        }
    }
    Result.prepend(IntToHex(r->PC).append(" ").append(IntToHex(r->OP,4)).append(" "));

    return Result;
}
示例#6
0
//---------------------------------------------------------------------------
AnsiString TDrawingItem::Encode()
{
    //文字列で記述
    AnsiString result;

    result += IntToHex(m_nType, 8) + IntToHex(m_nPenColor, 8) + IntToHex(m_nBrushColor, 8) + IntToHex(Count, 8);
    for (int i = 0 ; i < 4 ; i++) {
        result += IntToHex(*(int*)&m_Rect[i], 8);
    }
    for (int i = 0 ; i < Count ; i++) {
        result += IntToHex((int)Items[i], 8);
    }
    return result;
}
示例#7
0
//---------------------------------------------------------------------------
AnsiString TDrawing::Encode(bool bAll)
{
    //文字列で記述
    AnsiString result;
    int count = 0;
    for (int i = 0 ; i < Count ; i++) {
        if (bAll || DItem(i)->m_bSelected) {
            //エンコード対象のアイテム
            AnsiString S = DItem(i)->Encode();
            result += IntToHex(S.Length(), 8) + S;
            count++;
        }
    }

    return IntToHex(count, 8) + result;
}
示例#8
0
void __fastcall TForm1::setLight(TObject *Sender)
{
	/* Метод расчета и передачи значения состояния управляющих освещением выводов */

	if (Sender->ClassName() == "TCheckBox") {
		// Значение (2 байта) состояния управляющих выходов (0x0000 .. 0xFFFF)
		unsigned short int light = 0x0000;

        // Опрос состояния выключателей с целью расчета значения
		for (int i = 1; i < GroupBox1->ControlsCount; i++) {
			if (GroupBox1->Controls->Items[i]->ClassName() == "TCheckBox")
				if (((TCheckBox*)GroupBox1->Controls->Items[i])->IsChecked)
					light ^= (1 << i-1);
		}

        // Передача данных в структуру
		DeviceConfig.light = light;

		// Отправка данных устройству
		deviceSend(DeviceConfig);

        // DEBUG: Вывод отладочной информации
		Memo1->Lines->Strings[0] = ("Light: 0x" + IntToHex(light, 4));
	}
}
void main() {
     unsigned char write = 'A';
     unsigned char read;
     
     char buffer[10];
     
     TWI_Init(100000);
     Lcd_Init();
     
     Write24C64_Byte(DEV24C64_ADDR, 0x00, write);
     read = Read24C64_Byte(DEV24C64_ADDR, 0x00);
     
     IntToHex(read, buffer);
     Lcd_Out(1, 1, buffer);
     
     while (1);
     
     if( write == read ) {
         Lcd_Out(1, 1, "Successfully written");
     } else {
         Lcd_Out(1, 1, "Data writing failed");
     }
     

     while (1) {

     }
}
示例#10
0
//---------------------------------------------------------------------------
int __fastcall TFormGrepStringsDialog::PutAllStringsInStringGrid(TStringList * ActiveList)
{
        //TODO: Add your source code here
 int i, Pos;
 AnsiString Full, Address, Str;
 
 if (ActiveList->Count==0) return 0;
 ClearStringGrid();
 StringGrid->RowCount=ActiveList->Count+1;
 for (i=0; i<ActiveList->Count; i++)
  {
    Full=ActiveList->Strings[i];
    Pos=Full.Pos(":");
    Address=Full.SubString(0, Pos-1).TrimRight();
    Str    =Full.SubString(Pos+1, Full.Length()-Pos).Trim();
    StringGrid->Cells[0][i+1]=i+1;
    if (CheckBHexAdress->Checked==true)
        StringGrid->Cells[1][i+1]=IntToHex(StrToInt(Address), 8);
    else
        StringGrid->Cells[1][i+1]=Address;
    StringGrid->Cells[2][i+1]=Str;
  }
 StatusBar->Panels->Items[2]->Text=" Count = "+ IntToStr(i);
 return i;
}
示例#11
0
BSTR CCommonUtils::BinaryToHex(LPVOID lpData, ULONG ulSize)
{
    LPWSTR lpString = NULL;
    BSTR   bstrRet = NULL;
    LPBYTE lpBytes = (LPBYTE)lpData;
    DWORD dwSize = 0;

    dwSize = ulSize*2*sizeof(WCHAR)+sizeof(WCHAR);
    // Alloc enough for two chars per byte plus NUL
    lpString = (LPWSTR)LocalAlloc(LPTR, dwSize);
    if(!lpString)
    {
        throw _com_error(E_OUTOFMEMORY);
    }

    memset(lpString, 0, dwSize);
    for(UINT pos = 0; pos < ulSize; pos++)
    {
        lpString[pos*2] = IntToHex(lpBytes[pos] >> 4);
        lpString[pos*2+1] = IntToHex(lpBytes[pos] & 0xF);
    }

    bstrRet = ::SysAllocString(lpString);
    LocalFree(lpString);

    return bstrRet;
}
示例#12
0
QString Cdebug_ti57cpu::BranchOP(TI57regs *r) {
    QString Result="";
    if (r->OP & 0x0400) Result="BRC ";
    else Result="BRNC ";
    Result.append(IntToHex((r->PC & 0x0400) | (r->OP & 0x03FF)));
    return Result;
}
示例#13
0
void __fastcall TForm1::setVolume(TObject *Sender)
{
	/* Метод расчета и передачи значения уровня громкости */

	// Положение ползунка громкости (0 .. 127)
	float level = TrackBar1->Value;

    // Значение (1 байт) уровня громкости (0x00 .. 0x7F)
	unsigned char volume_level = 0x00;

	// Расчет значения уровня для передачи устройству
	// DEBUG: возможность инвертирования значения
	if (CheckBox16->IsChecked) {
		volume_level = (unsigned char) (TrackBar1->Max - level);
	}
	else
		volume_level = (unsigned char) level;

	// Расчет и отображение уровня громкости в процентах
	Label1->Text = "Уровень: " + FloatToStrF(level*100/TrackBar1->Max, ffNumber, 3, 0) + "%";

	// Передача данных в структуру
	DeviceConfig.volume_level = volume_level;

	// Отправка данных устройству
	deviceSend(DeviceConfig);

	// DEBUG: Вывод отладочной информации
	Memo1->Lines->Strings[1] = ("Level: 0x" + IntToHex(volume_level, 2));
}
示例#14
0
//---------------------------------------------------------------------------
UnicodeString __fastcall TFrDeviceExplorer::ConverToHex(TByteDynArray Bytes)
{
	Integer I;
	UnicodeString ResultString;
	for(int i = 0; i < Bytes.get_length(); i++){
	  ResultString = ResultString + IntToHex(Bytes.operator [](i), 1);
	}
	return ResultString;
}
示例#15
0
  QString Cdebug_ti57cpu::Debugging(TI57regs *r) {
      QString s="";
  s=QString("A\t= ").append(Reg(r->RA)).append("\n");
  s.append("B\t= ").append(Reg(r->RB)).append("\n");
  s.append("C\t= ").append(Reg(r->RC)).append("\n");
  s.append("D\t= ").append(Reg(r->RD)).append("\n");
  s.append("COND\t= %1").arg(r->COND).append("\n");
  s.append("BASE\t= %1\n").arg(r->BASE);
  s.append("R5\t= ").append(IntToHex(r->R5,2)).append("\n");
  s.append("RAB\t= ").append(IntToHex(r->RAB,1)).append("\n\n");
  s.append("ST\t= ").append(IntToHex(r->ST[0],3)).append(" ").append(IntToHex(r->ST[1],3)).append(" ").append(IntToHex(r->ST[2],3)).append("\n\n");
  for (int i=0; i<8;i++)
      s.append(QString("X%1 = %2   Y%3 = %4\n").arg(i).arg(Reg(r->RX[i])).arg(i).arg(Reg(r->RY[i])));
  //if Application.MessageBox(PChar(s),PChar(Decode),MB_OKCancel)<>IDOK then
//Debugger=False;

  return s;
}
示例#16
0
void __fastcall TForm1::Button1Click(TObject *Sender)
{
  try {
      //Привязка к серийному номеру винта.
        unsigned long  aa = MAX_PATH;
        char  VolumeName[MAX_PATH], FileSystemName[MAX_PATH];
        unsigned long  VolumeSerialNo;
        unsigned long  MaxComponentLength, FileSystemFlags;

        GetVolumeInformation("C:\\", VolumeName, aa, &VolumeSerialNo,
                             &MaxComponentLength,&FileSystemFlags,
                             FileSystemName,aa);

        AnsiString as1 = "VName = "; as1 = as1 +  + VolumeName;
        AnsiString as2 = "FSName = "; as2 = as2 +  + FileSystemName;

        Memo1->Clear();
        Memo1->Lines->Add("C:\\");
      //  Memo1->Lines->Add(as1);
        Memo1->Lines->Add("SerialNo = $"+IntToHex((int)VolumeSerialNo,8));
      /*  Memo1->Lines->Add("CompLen = "+IntToStr(MaxComponentLength));
        Memo1->Lines->Add("Flags = $"+IntToHex((int)FileSystemFlags,4));
        Memo1->Lines->Add(as2);*/
        Memo1->Lines->Add("");
        Memo1->Lines->Add("");


        GetVolumeInformation("D:\\", VolumeName, aa, &VolumeSerialNo,
                             &MaxComponentLength,&FileSystemFlags,
                             FileSystemName,aa);

        as1 = "VName = "; as1 = as1 +  + VolumeName;
        as2 = "FSName = "; as2 = as2 +  + FileSystemName;

        Memo1->Lines->Add("D:\\");
      //  Memo1->Lines->Add(as1);
        Memo1->Lines->Add("SerialNo = $"+IntToHex((int)VolumeSerialNo,8));
      /*  Memo1->Lines->Add("CompLen = "+IntToStr(MaxComponentLength));
        Memo1->Lines->Add("Flags = $"+IntToHex((int)FileSystemFlags,4));
        Memo1->Lines->Add(as2);*/
  } catch ( ... ) {
  }
}
示例#17
0
文件: myfunc.cpp 项目: RalphSu/pula
//将1字节数组转化为对应16进制字符串
AnsiString f_bytetohex(UCHAR *buff,int ilen)
{
 AnsiString s1;
 int i;
 s1="";
 for(i=0;i<ilen;i++)
 {
   s1=s1+IntToHex(buff[i],2);
 };
 return s1;
}
示例#18
0
//===========================================================================
void __fastcall TfrmMain::FormCreate(TObject *Sender)
{
   // ---------------------------------------------------
    frmLogoDiALab = new TfrmLogoDiALab(NULL);
    //frmLogoDiALab->Show();
    Application->ProcessMessages();
    Sleep(2300);
   // ---------------------------------------------------
      WhoUseProgram = wupSensei;
      //WhoUseProgram = wupTsisarzh;
      //WhoUseProgram = wupTanjaKvant;

      if (WhoUseProgram == wupTsisarzh) { // ---- ѕровер¤ем винты ------// || WhoUseProgram == wupSensei
            unsigned long  aa = MAX_PATH;
            char           VolumeName[MAX_PATH], FileSystemName[MAX_PATH];
            unsigned long  VolumeSerialNo;
            unsigned long  MaxComponentLength, FileSystemFlags;

            GetVolumeInformation("C:\\", VolumeName, aa, &VolumeSerialNo,
                                 &MaxComponentLength,&FileSystemFlags,
                                 FileSystemName,aa);

            AnsiString  HexVolumeSerialNo = IntToHex((int)VolumeSerialNo,8);

            if ( HexVolumeSerialNo != "0D471DF1" && HexVolumeSerialNo != "104E16FB" && HexVolumeSerialNo != "256E13FC") {
                Error_None_LicenseProgram(Handle);
                ExitProcess(0);
            }
      }

   // ---------------------------------------------------
      Left   = 0;
      Top    = 0;
      Height = 730;
      EnabledTVModivication = true;

   // ---- –егистрирую в ¬индовсе расширение ------------
      RegisterFileType("dls", Application->ExeName, 1);
      AddNewFileToMainMenu(pmFile, "Load", LoadProjectFromMenu);

   // ------- «аполн¤ем “ри¬ью —писками элементов -----
      SetupTreeView();

   // -------
      aAllAction(aNewScheme);

   // ------- »нициализаци¤ пути ќпен и —айф ƒиалога --------
      OpenDialog1->InitialDir =  ExtractFilePath( Application->ExeName );
      SaveDialog1->InitialDir =  ExtractFilePath( Application->ExeName );

   // -----
      TimerLogo->Enabled = true;
}
示例#19
0
文件: DSound.cpp 项目: krkrz/krdevui
//---------------------------------------------------------------------------
void __fastcall CreateSoundBuffer(const WAVEFORMATEXTENSIBLE * wfx)
{
	// 0.25 秒間のセカンダリバッファを作成する

	/* wfx.Format の nAvgBytesPerSec や nBlockAlign は変な値になっていないかどうか
	   チェックが必要 */

	if(SoundBuffer)
	{
		SoundBuffer->Release();
		SoundBuffer = NULL;
	}

	// プライマリバッファのフォーマットを再設定
	if(SoundPrimaryBuffer)
	{
		SoundPrimaryBuffer->SetFormat((const WAVEFORMATEX *)wfx);
	}

	// セカンダリバッファの作成
	memset(&SoundBufferDesc,0,sizeof(DSBUFFERDESC));
	SoundBufferDesc.dwSize=sizeof(DSBUFFERDESC);
	SoundBufferDesc.dwFlags=
		DSBCAPS_GETCURRENTPOSITION2/* | DSBCAPS_CTRLPAN */| DSBCAPS_CTRLVOLUME
		 |DSBCAPS_GLOBALFOCUS ;
	SoundBufferDesc.dwBufferBytes = wfx->Format.nAvgBytesPerSec /4;
	SoundBufferDesc.dwBufferBytes /=  wfx->Format.nBlockAlign * 2;
	SoundBufferDesc.dwBufferBytes *=  wfx->Format.nBlockAlign * 2;
	SoundBufferBytes = SoundBufferDesc.dwBufferBytes;
	SoundBufferBytesHalf = SoundBufferBytes / 2;

	Frequency = wfx->Format.nSamplesPerSec;
	Channels = wfx->Format.nChannels;
	SampleSize = wfx->Format.nBlockAlign;

	SoundBufferDesc.lpwfxFormat = (WAVEFORMATEX*)wfx;


	// セカンダリバッファを作成する
	HRESULT hr = Sound->CreateSoundBuffer(&SoundBufferDesc,&SoundBuffer,NULL);
	if(FAILED(hr))
	{
		SoundBuffer=NULL;
		throw Exception("セカンダリバッファの作成に失敗しました"
			"/周波数:"+AnsiString(wfx->Format.nSamplesPerSec)+
			"/チャネル数:"+AnsiString(wfx->Format.nChannels)+
			"/ビット数:"+AnsiString(16)+
			"/HRESULT:"+IntToHex((int)hr,8));
	}

	ResetSoundBuffer();
}
示例#20
0
//---------------------------------------------------------------------------
//Called when the user dubbleclicks on the image
void __fastcall TIColorSelect::ImageDblClick(TObject *Sender)
{
  //If editing of colors is enabled then show the color dialog and
  //update the select box with the user chosen color
  if(!EditColor)
    return;
  TColorDialog *ColorDialog=new TColorDialog(this);
  ColorDialog->Color = ColorList[SelectedBox.x][SelectedBox.y];
  ColorDialog->CustomColors->Add(("ColorA=")+IntToHex((int)ColorDialog->Color,8));
  if(ColorDialog->Execute())
    DrawBox(SelectedBox,ColorDialog->Color);
  delete ColorDialog;
}
示例#21
0
void TRadioManager::TransmitMsg(TRadioMsg * msg, TRfd * sender)
{
    TListItem * new_item = formMain->lvLog->Items->Add();
    new_item->MakeVisible(false);
    new_item->Caption = FormatFloat("#000", msg->Sender_Node->MAC_Address);

    new_item->SubItems->Add( (msg->Recipient_Node == MSG_RECIPIENT_ALL_NODES) ?
                              (AnsiString)"<ALL>" : (AnsiString) FormatFloat("#000", msg->Recipient_Node->MAC_Address) );
    AnsiString data;
    for ( sint32 i = 0; i < msg->Msg_Length; i++ )
    {
        data += IntToHex(msg->Msg_Data[i], 2) + " ";
    }
    new_item->SubItems->Add(data);

    // Transmit the message to all nodes that match the recipient address and are within transmission range
    const sint32 sender_pos_x = sender->Node_Body->Left + (sender->Node_Body->Width / 2);
    const sint32 sender_pos_y = sender->Node_Body->Top + (sender->Node_Body->Height / 2);
    for (sint32 i = 0; i < formMain->Node_List->Count; i++ )
    {
        TRfd * rx_node = (TRfd *)formMain->Node_List->Items[i];
        if ( (rx_node->MAC_Address != msg->Sender_Node->MAC_Address) &&
             ((msg->Recipient_Node == rx_node) || (msg->Recipient_Node == MSG_RECIPIENT_ALL_NODES)) )
        {
            // The address matches. Now check the range
            const sint32 rx_node_pos_x = rx_node->Node_Body->Left + (rx_node->Node_Body->Width / 2);
            const sint32 rx_node_pos_y = rx_node->Node_Body->Top + (rx_node->Node_Body->Height / 2);
            const sint32 dx = rx_node_pos_x - sender_pos_x;
            const sint32 dy = rx_node_pos_y - sender_pos_y;
            const sint32 dx2 = dx * dx;
            const sint32 dy2 = dy * dy;
            const sint32 node_dist_sq = dx2 + dy2;
            if ( node_dist_sq <= (sender->Tx_Range * sender->Tx_Range) )
            {
                // Create a copy of the message to send to each recipient
                TRadioMsg * msg_copy = new TRadioMsg(*msg);
                rx_node->Msg_Buffer->Add(msg_copy);

                // Leave a random time before the node reads the message.
                // This simulates latency and allows different nodes to answer braodcast messages in different orders
                if ( ! rx_node->Msg_Timer->Enabled )
                {
                    rx_node->Msg_Timer->Interval = Random(80) + 20;
                    rx_node->Msg_Timer->Enabled = true;
                }
            } // end of Tx range check
        } // End of address check
    } // End of node list scan loop
} // End of TransmitMsg
示例#22
0
//---------------------------------------------------------------------------
void TdRegTest::Compare(sPrData *pPrData)
{
  String Str;
  BYTE itmp;
  bool bTestRez = true;
  int mask;

	for(int i=0; i<pPrData->iToW; i++)
	{
        if((pPrData->cDataW[pPrData->iWInd[i]] & pPrData->cTestMap[pPrData->iWInd[i]]) != (pPrData->cDataR[pPrData->iWInd[i]] & pPrData->cTestMap[pPrData->iWInd[i]]))
        {
          bTestRez = false;
          Str = "Reg Addr = ";
          Str = Str + pPrData->iWInd[i];
          Str = Str + " Failed (Write/Read Values): ";
          itmp = pPrData->cDataW[pPrData->iWInd[i]] & 0x00FF;
          Str = Str + IntToHex(itmp, 2);
          Str = Str + " / ";
          //itmp = pPrData->cDataR[pPrData->iWInd[i]] & (BYTE)pPrData->cTestMap[pPrData->iWInd[i]];
          itmp = pPrData->cDataR[pPrData->iWInd[i]];
          Str = Str + IntToHex(itmp, 2);
          reInfo->Lines->Add(Str);
        };
  };

  if(pPrData->iToW == 0) reInfo->Lines->Add("Length Wrong!");

  if(bTestRez)
  {
    reInfo->Lines->Add("Module test with this pattern is OK.");
  }
  else
  {
    reInfo->Lines->Add("Module test with this pattern FAILED!");
  };
};
示例#23
0
BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam)
{
  TStringGrid *grid = (TStringGrid *)lParam;
  AnsiString str, cname, caption;
  str.SetLength(1024);
  GetClassName(hwnd,str.c_str(),1023);
  cname = str;
  str.SetLength(1024);
  GetWindowText(hwnd,str.c_str(),1023);
  caption = str;
  grid->Tag++;
  grid->Rows[grid->Tag]->Text = "0x" + IntToHex((int)hwnd,6) + "\n" + cname + "\n" + caption;
  grid->Rows[grid->Tag]->Objects[0] = (TObject *)hwnd;
  return true;
}
示例#24
0
文件: U1.cpp 项目: pal73/fat470
void __fastcall TForm1::Edit2Change(TObject *Sender)
{
AnsiString temp_a;
 char temp;
if(Edit2->Modified)
{
temp_a=(Edit2->Text);

try
     {
     temp=temp_a.ToInt();
     }
catch ( EConvertError& )
     {
     }

bukva=temp;
Edit1->Text=bukva;
Edit3->Text=IntToHex(bukva,2);


if(indikator==0)
     {
     int ptr;
     ptr=((int)bukva)*6;
     simbol_vert[0]=simbol_all[ptr];
     ptr++;
     simbol_vert[1]=simbol_all[ptr];
     ptr++;
     simbol_vert[2]=simbol_all[ptr];
     ptr++;
     simbol_vert[3]=simbol_all[ptr];
     ptr++;
     simbol_vert[4]=simbol_all[ptr];
     ptr++;
     simbol_vert[5]=simbol_all[ptr];
     ptr++;
     simbol_vert[6]=simbol_all[ptr];
     ptr++;
     simbol_vert[7]=simbol_all[ptr];
     ptr++;

     horiz_create();
     qwads_drow();
     }
 }
}
示例#25
0
//---------------------------------------------------------------------------
void __fastcall TServerForm::ServerWSocketSessionAvailable(TObject *Sender,
    WORD Error)
{
    TClientThread *ClientThread;

    // Create a new thread to handle client request
    ClientThread              = new TClientThread(ServerWSocket->Accept());

    // Assign the thread's OnTerminate event
    ClientThread->OnTerminate = ClientThreadTerminate;

    // Add the thread to the listbox which is our client list
    ClientListBox->Items->Add(IntToHex(Integer(ClientThread), 8));

    // Then start the client thread work
    // because it was created in the blocked state
    ClientThread->Resume();
}
示例#26
0
//---------------------------------------------------------------------------
__fastcall TDlgSettings::TDlgSettings(TComponent* Owner)
	: TForm(Owner)
{
    cbShowSplashScreen->Checked = config.SHOW_SPLASH;
    cbShowWelcomeScreen->Checked = config.SHOW_WELCOME;
    cbQuerySaving->Checked = config.QUERY_SAVING;
    cbToolBarVisible->Checked = WndMain->ToolBar3->Checked;
    cbShowTextLabels->Checked = WndMain->TextLabels1->Checked;
    cbAlwaysColour->Checked = WndMain->AlwaysColour1->Checked;
    bcToolbarBitmap->Checked = WndMain->MainPanel2->Bitmap!=NULL;
    tbBitmapName = config.tbBitmapName;
    if(bcToolbarBitmap->Checked)
    	Image1->Picture->Bitmap->Assign(WndMain->MainPanel2->Bitmap);

    for(int i=0;i<TOTAL_RES_TYPES;i++)
        DefaultResourceType->Items->Add(resTypes[i].name);
    DefaultResourceType->ItemIndex = config.ewsDefResType;

    for(int i=0;i<4;i++)
        cbViewStyle->Items->Add(vsNames[i]);
    cbViewStyle->ItemIndex = config.ewsViewStyle;

    cbShowPreview->Checked = config.ewsSHOW_PREVIEW;
    cbFlatScroll->Checked  = config.ewsFLAT_SCROLL;
    cbGridLines->Checked   = config.ewsGRID_LINES;
    cbHotTrack->Checked    = config.ewsHOT_TRACK;
    cbHandPoint->Checked   = config.ewsHAND_POINT;
    cbUnderlineC->Checked  = config.ewsUNDERLINEC;
    cbUnderlineH->Checked  = config.ewsUNDERLINEH;

    shBkColour->Brush->Color = WndMain->Color;
    edBkColour->Text       = IntToHex(shBkColour->Brush->Color,6);
    SpeedButton1->Font->Color = (TColor)((~shBkColour->Brush->Color)&0x00FFFFFF);

    cbSepScrWnds->Checked  = config.ewsSEP_SCR_WNDS;

    cbAsResourcemap->Checked	= config.RegExtInfo[0].Set;
    cbAsSC->Checked				= config.RegExtInfo[1].Set;
    cbAsSH->Checked				= config.RegExtInfo[2].Set;
    cbFolderShortcut->Checked	= config.RegExtInfo[3].Set;

    udMaxUndos->Position		= config.maxUndos;
    udMaxUndosClick(this,(TUDBtnType)NULL);
}
示例#27
0
//---------------------------------------------------------------------------
AnsiString __fastcall Encode(AnsiString msg)
{
    int        I;
    AnsiString Result;
    char       ch;

//    Result = new AnsiString;
    Result = "";
    for (I = 1; I < msg.Length(); I++) {
        ch = (msg)[I];
        if (ch == ' ')
            Result = Result + "+";
        else if ((toupper(ch) < 'A') || (toupper(ch) > 'Z'))
            Result = Result + "%" + IntToHex(ch, 2);
        else
            Result = Result + ch;
    }
    return(Result);
}
示例#28
0
//---CLEAR-------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
    unsigned char buff[8];

    buff[0]=0x55;
    buff[1]=0x55;
    buff[2]=0x5c;
    buff[3]=0x5d;
    buff[4]=0x5e;
    buff[5]=0x5f;
    buff[6]=0x50;
    buff[7]=0x51;

    WritePort1(buff,8);

    buff[0]=0x00;            //claer buffer [0]
    ReadPort2(buff,8);
    Form1->Memo1->Lines->Add("CLEAR Result     0x"+IntToHex((__int64)buff[0], 2));
    if (buff[0]==0xcc) Form1->Memo1->Lines->Add("Error ");

}
示例#29
0
//---------------------------------------------------------------------------
int __fastcall TFormGrepStringsDialog::PutStringsInStringGrid(TStringList * ActiveList, AnsiString StrToSearch)
{
        //TODO: Add your source code here
 int i, j, Pos;
 AnsiString Full, Address, Str;
// StringGrid->Rows->BeginUpdate();
 ClearStringGrid();
 if (ActiveList==NULL) return 0;
 if (ActiveList->Count==0) return 0;
 for (i=0, j=1; i<ActiveList->Count; i++)
  {
    Full=ActiveList->Strings[i];
    Pos=Full.Pos(":");
    Address=Full.SubString(0, Pos-1).TrimRight();
    Str    =Full.SubString(Pos+1, Full.Length()-Pos).Trim();

//    if (StrToSearch!="")
      {
        Pos=Str.Pos(StrToSearch);
        if (CheckBContainString->Checked==true) // Si puede estar en cualquier lugar
          {
            if (Pos==0) continue;   // No la contiene, continuar.
          }
        else
          {  // Tiene que estar al principio de la cadena
            if (Pos !=1) continue; // No fue al principio, continuar.
          }
      }
    StringGrid->RowCount=j+1;
    StringGrid->Cells[0][j]=j;
    if (CheckBHexAdress->Checked==true)
        StringGrid->Cells[1][j]=IntToHex(StrToInt(Address), 8);
    else
        StringGrid->Cells[1][j]=Address;
    StringGrid->Cells[2][j]=Str;
    j++;
  }
 StatusBar->Panels->Items[2]->Text=" Count = "+ IntToStr(j-1) + " of " + IntToStr(i);
 return j-1;
}
示例#30
0
文件: U1.cpp 项目: pal73/fat470
void __fastcall TForm1::Edit1Change(TObject *Sender)
{

AnsiString temp_a;
unsigned char temp;
if(Edit1->Modified)
{
temp_a=(Edit1->Text);
//temp=*((char*)temp_a);
bukva=*(temp_a.c_str());
Edit2->Text=bukva;
Edit3->Text=IntToHex(bukva,2);
Edit1->SelectAll();

if(indikator==0)
     {
     int ptr;
     ptr=((int)bukva)*6;
     simbol_vert[0]=simbol_all[ptr];
     ptr++;
     simbol_vert[1]=simbol_all[ptr];
     ptr++;
     simbol_vert[2]=simbol_all[ptr];
     ptr++;
     simbol_vert[3]=simbol_all[ptr];
     ptr++;
     simbol_vert[4]=simbol_all[ptr];
     ptr++;
     simbol_vert[5]=simbol_all[ptr];
     ptr++;
     simbol_vert[6]=simbol_all[ptr];
     ptr++;
     simbol_vert[7]=simbol_all[ptr];
     ptr++;

     horiz_create();
     qwads_drow();
     }
}
}