Click here to Skip to main content
15,915,513 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
GeneralRe: closing form Pin
MoustafaS6-May-05 2:14
MoustafaS6-May-05 2:14 
GeneralRe: closing form Pin
Anonymous6-May-05 6:08
Anonymous6-May-05 6:08 
GeneralRe: closing form Pin
Dave Kreskowiak6-May-05 7:30
mveDave Kreskowiak6-May-05 7:30 
GeneralHelp Me to port to Win98 Pin
Saksida Bojan5-May-05 23:30
Saksida Bojan5-May-05 23:30 
GeneralRe: Help Me to port to Win98 Pin
Dan_P5-May-05 23:43
Dan_P5-May-05 23:43 
GeneralRe: Help Me to port to Win98 Pin
Saksida Bojan6-May-05 1:34
Saksida Bojan6-May-05 1:34 
GeneralRe: Help Me to port to Win98 Pin
Dave Kreskowiak6-May-05 7:18
mveDave Kreskowiak6-May-05 7:18 
GeneralRe: Help Me to port to Win98 Pin
Saksida Bojan6-May-05 10:54
Saksida Bojan6-May-05 10:54 
I Will yust put out my code.

These keys i am looking egsist in both XP and 98

I hope it will help you

#pragma once
#include <iostream>

#define MAX_LINE 10000

namespace ArtMoneyLanguageTranslator
{
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
using namespace std;
using namespace Microsoft::Win32;
using namespace System::IO;

// Global Variable
bool bPathExist = true;
int LinLNG = 0;

__forceinline String *GetArtMoneyPath(void)
{

RegistryKey *pKey = Registry::ClassesRoot;
pKey = pKey->OpenSubKey(S"ArtMoneyTable\\Shell\\Open\\Command");
Object *pValue = pKey->GetValue(S"");
String *temp1 = pValue->ToString();
Char temp2[] = temp1->ToCharArray(1, (temp1->Length - 1));
for (int temp3 = 0; temp3 <= (temp1->Length - 1); temp3 ++)
{
if (temp2[temp3] == '.'
&& temp2[temp3+1] == 'e'
&& temp2[temp3+2] == 'x'
&& temp2[temp3+3] == 'e')
{
Char path[] = temp1->ToCharArray(1, (temp3 - 8));

String *ArtMoneyPath = new String(path);
ArtMoneyPath = ArtMoneyPath->Concat(ArtMoneyPath, "Plugin");


return ArtMoneyPath;
}
}
return NULL;

}
///
/// Summary for Form1
///
/// WARNING: If you change the name of this class, you will need to change the
/// 'Resource File Name' property for the managed resource compiler tool
/// associated with all .resx files this class depends on. Otherwise,
/// the designers will not be able to interact properly with localized
/// resources associated with this form.
///

public __gc class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
}

static String *SourceLNG = "";
static String *TranslatedLNG = "";

static bool bSourceLNG = false;
static bool bTranslatedLNG = false;

static int Lines;
static int index;

static Array *SrcLNG = Array::CreateInstance(__typeof(String), MAX_LINE);
static Array *TrsLNG = Array::CreateInstance(__typeof(String), MAX_LINE);

protected: System::Windows::Forms::ListView * SourceLNGView;


private: System::Windows::Forms::TextBox * SourceText;
private: System::Windows::Forms::TextBox * TranslatedText;
private: System::Windows::Forms::Button * btnExit;
private: System::Windows::Forms::Button * button1;
private: System::Windows::Forms::Button * button3;
private: System::Windows::Forms::LinkLabel * linkLabel1;
private: System::Windows::Forms::Label * label1;




private: System::Windows::Forms::ColumnHeader * columnHeader1;



protected:
void Dispose(Boolean disposing)
{
if (disposing && components)
{
components->Dispose();
}
__super::Dispose(disposing);
}
private: System::Windows::Forms::OpenFileDialog * OpenDLG;
private: System::Windows::Forms::SaveFileDialog * SaveDLG;
private: System::Windows::Forms::Button * button2;

private:
///
/// Required designer variable.
///

System::ComponentModel::Container * components;

///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///

void InitializeComponent(void)
{
this->OpenDLG = new System::Windows::Forms::OpenFileDialog();
this->SaveDLG = new System::Windows::Forms::SaveFileDialog();
this->button2 = new System::Windows::Forms::Button();
this->SourceLNGView = new System::Windows::Forms::ListView();
this->columnHeader1 = new System::Windows::Forms::ColumnHeader();
this->SourceText = new System::Windows::Forms::TextBox();
this->TranslatedText = new System::Windows::Forms::TextBox();
this->btnExit = new System::Windows::Forms::Button();
this->button1 = new System::Windows::Forms::Button();
this->button3 = new System::Windows::Forms::Button();
this->linkLabel1 = new System::Windows::Forms::LinkLabel();
this->label1 = new System::Windows::Forms::Label();
this->SuspendLayout();
//
// OpenDLG
//
this->OpenDLG->DefaultExt = S"*.lng";
this->OpenDLG->Filter = S"Language Files (*.lng)|*.lng";
//
// SaveDLG
//
this->SaveDLG->DefaultExt = S"*.lng";
this->SaveDLG->Filter = S"Language Files (*.lng)|*.lng";
this->SaveDLG->Title = S"ArtMoney Translated Language";
//
// button2
//
this->button2->Location = System::Drawing::Point(8, 264);
this->button2->Name = S"button2";
this->button2->Size = System::Drawing::Size(96, 32);
this->button2->TabIndex = 1;
this->button2->Text = S"Open &Source LNG";
this->button2->Click += new System::EventHandler(this, button2_Click);
//
// SourceLNGView
//
System::Windows::Forms::ColumnHeader* __mcTemp__1[] = new System::Windows::Forms::ColumnHeader*[1];
__mcTemp__1[0] = this->columnHeader1;
this->SourceLNGView->Columns->AddRange(__mcTemp__1);
this->SourceLNGView->FullRowSelect = true;
this->SourceLNGView->GridLines = true;
this->SourceLNGView->HeaderStyle = System::Windows::Forms::ColumnHeaderStyle::Nonclickable;
this->SourceLNGView->Location = System::Drawing::Point(0, 0);
this->SourceLNGView->MultiSelect = false;
this->SourceLNGView->Name = S"SourceLNGView";
this->SourceLNGView->Size = System::Drawing::Size(504, 176);
this->SourceLNGView->TabIndex = 3;
this->SourceLNGView->View = System::Windows::Forms::View::Details;
this->SourceLNGView->DoubleClick += new System::EventHandler(this, SourceLNGView_DoubleClick);
this->SourceLNGView->SelectedIndexChanged += new System::EventHandler(this, SourceLNGView_SelectedIndexChanged);
//
// columnHeader1
//
this->columnHeader1->Text = S"Translation";
this->columnHeader1->Width = 483;
//
// SourceText
//
this->SourceText->Location = System::Drawing::Point(8, 184);
this->SourceText->Name = S"SourceText";
this->SourceText->ReadOnly = true;
this->SourceText->Size = System::Drawing::Size(488, 20);
this->SourceText->TabIndex = 4;
this->SourceText->Text = S"";
//
// TranslatedText
//
this->TranslatedText->AcceptsReturn = true;
this->TranslatedText->Location = System::Drawing::Point(8, 208);
this->TranslatedText->Name = S"TranslatedText";
this->TranslatedText->Size = System::Drawing::Size(488, 20);
this->TranslatedText->TabIndex = 5;
this->TranslatedText->Text = S"";
this->TranslatedText->KeyPress += new System::Windows::Forms::KeyPressEventHandler(this, TranslatedText_KeyPress);
//
// btnExit
//
this->btnExit->Location = System::Drawing::Point(400, 264);
this->btnExit->Name = S"btnExit";
this->btnExit->Size = System::Drawing::Size(96, 32);
this->btnExit->TabIndex = 6;
this->btnExit->Text = S"E&xit";
this->btnExit->Click += new System::EventHandler(this, btnExit_Click);
//
// button1
//
this->button1->Location = System::Drawing::Point(112, 264);
this->button1->Name = S"button1";
this->button1->Size = System::Drawing::Size(96, 32);
this->button1->TabIndex = 7;
this->button1->Text = S"Open &Translated LNG";
this->button1->Click += new System::EventHandler(this, button1_Click);
//
// button3
//
this->button3->Enabled = false;
this->button3->Location = System::Drawing::Point(216, 264);
this->button3->Name = S"button3";
this->button3->Size = System::Drawing::Size(96, 32);
this->button3->TabIndex = 8;
this->button3->Text = S"S&ave Translated LNG";
this->button3->Click += new System::EventHandler(this, button3_Click);
//
// linkLabel1
//
this->linkLabel1->Location = System::Drawing::Point(128, 232);
this->linkLabel1->Name = S"linkLabel1";
this->linkLabel1->Size = System::Drawing::Size(224, 23);
this->linkLabel1->TabIndex = 9;
this->linkLabel1->TabStop = true;
this->linkLabel1->Text = S"E-Mail To Me";
this->linkLabel1->LinkClicked += new System::Windows::Forms::LinkLabelLinkClickedEventHandler(this, linkLabel1_LinkClicked);
//
// label1
//
this->label1->Location = System::Drawing::Point(8, 232);
this->label1->Name = S"label1";
this->label1->Size = System::Drawing::Size(120, 16);
this->label1->TabIndex = 10;
this->label1->Text = S"Author: Saksida Bojan";
//
// Form1
//
this->AutoScaleBaseSize = System::Drawing::Size(5, 13);
this->ClientSize = System::Drawing::Size(504, 304);
this->Controls->Add(this->label1);
this->Controls->Add(this->linkLabel1);
this->Controls->Add(this->button3);
this->Controls->Add(this->button1);
this->Controls->Add(this->btnExit);
this->Controls->Add(this->TranslatedText);
this->Controls->Add(this->SourceText);
this->Controls->Add(this->SourceLNGView);
this->Controls->Add(this->button2);
this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::FixedSingle;
this->MaximizeBox = false;
this->MinimizeBox = false;
this->Name = S"Form1";
this->StartPosition = System::Windows::Forms::FormStartPosition::CenterScreen;
this->Text = S"ArtMoney Language Translator";
this->Load += new System::EventHandler(this, Form1_Load);
this->ResumeLayout(false);

}
private: System::Void Form1_Load(System::Object * sender, System::EventArgs * e)
{
// String *path = GetArtMoneyPath();
// if (path == NULL)
// {
// MessageBox::Show(S"ArtMoney isn't instaled", S"ArtMoney Language Translator", MessageBoxButtons::OK, MessageBoxIcon::Asterisk);
// bPathExist = false;
// }
}

private: System::Void button2_Click(System::Object * sender, System::EventArgs * e)
{
OpenDLG->FileName = "";


if (bPathExist == false)
OpenDLG->InitialDirectory = ".";
else
OpenDLG->InitialDirectory = GetArtMoneyPath();

OpenDLG->Title = "Open Source Language File";

OpenDLG->ShowDialog();

if (OpenDLG->FileName == "")
return;

if (TranslatedLNG->Equals(OpenDLG->FileName))
{
MessageBox::Show(S"Source and translated files can't be the same", S"ArtMoney Language Translator!", MessageBoxButtons::OK, MessageBoxIcon::Information);
return;
}
SourceLNG = OpenDLG->FileName;
bSourceLNG = true;
OpenLNG(SourceLNG, SrcLNG);
if (bTranslatedLNG == false)
Array::Copy(SrcLNG, TrsLNG, MAX_LINE);

UpdateList();
button3->Enabled = true;

}

void UpdateList()
{
if (bSourceLNG == false)
return;

ListClear();

for (int i=1; i<=Lines; i++)
{
try
{
String *temp1;
String *temp2;
temp1 = SrcLNG->GetValue(i)->ToString();
temp2 = TrsLNG->GetValue(i)->ToString();

if (temp1->Equals(temp2))
{
AddToList(SrcLNG->GetValue(i)->ToString(), false);
}
else
{
AddToList(TrsLNG->GetValue(i)->ToString(), true);
}
}
catch (System::NullReferenceException *)
{
break;
}
}
}

void AddToList(String *pText, bool IsTranslated)
{
ListViewItem *pItem = new ListViewItem();
if (IsTranslated == false)
pItem->BackColor = Color::FromArgb(0xFFC0FFC0);
pItem->Text = pText;
SourceLNGView->Items->Add(pItem);


}

void ListClear()
{
SourceLNGView->Clear();
ColumnHeader *pCH = new ColumnHeader();
pCH->Text = "Translation";
pCH->Width = 483;
SourceLNGView->Columns->Add(pCH);
}

void OpenLNG(String *file, Array *Arr)
{
FileStream *fs = new FileStream(file, FileMode::Open, FileAccess::Read);
StreamReader *sr = new StreamReader(fs);
String *temp;
int nLng = 0;

while (true)
{
nLng++;

temp = sr->ReadLine();
if (!temp)
break;

Arr->SetValue(temp, nLng);
}

sr->Close();
fs->Close();

Lines = nLng;


}
private: System::Void SourceLNGView_SelectedIndexChanged(System::Object * sender, System::EventArgs * e)
{
ListView::SelectedIndexCollection *pSI = SourceLNGView->SelectedIndices;
try
{
SourceText->Text = SrcLNG->GetValue(pSI->Item[0]+1)->ToString();
}
catch(System::ArgumentOutOfRangeException *)
{
}
try
{
index = pSI->Item[0]+1;
TranslatedText->Text = TrsLNG->GetValue(pSI->Item[0]+1)->ToString();
}
catch(System::ArgumentOutOfRangeException *)
{
}
catch(System::NullReferenceException *)
{
}
}

private: System::Void btnExit_Click(System::Object * sender, System::EventArgs * e)
{
Form1::Close();
}

private: System::Void button1_Click(System::Object * sender, System::EventArgs * e)
{
OpenDLG->FileName = "";

if (bPathExist == false)
OpenDLG->InitialDirectory = ".";
else
OpenDLG->InitialDirectory = GetArtMoneyPath();

OpenDLG->Title = "Open Translated Language File";

OpenDLG->ShowDialog();

if (OpenDLG->FileName == "")
return;

if (SourceLNG->Equals(OpenDLG->FileName))
{
MessageBox::Show(S"Source and translated files can't be the same", S"ArtMoney Language Translator!", MessageBoxButtons::OK, MessageBoxIcon::Information);
return;
}

TranslatedLNG = OpenDLG->FileName;
bTranslatedLNG = true;
OpenLNG(TranslatedLNG, TrsLNG);

UpdateList();

}

private: System::Void TranslatedText_KeyPress(System::Object * sender, System::Windows::Forms::KeyPressEventArgs * e)
{
if (e->KeyChar == 13 && TranslatedText->Text->Length == 0)
{
MessageBox::Show(S"You haven't type anything!", S"Error", MessageBoxButtons::OK, MessageBoxIcon::Exclamation);
return;
}
if (e->KeyChar == 13)
{
TrsLNG->SetValue(TranslatedText->Text, index);
ModifyItem(TranslatedText->Text, index, SrcLNG, TrsLNG);
UpdateList();
e->Handled = true;
}
}





private: System::Void button3_Click(System::Object * sender, System::EventArgs * e)
{
if (bPathExist == false)
SaveDLG->InitialDirectory = ".";
else
SaveDLG->InitialDirectory = GetArtMoneyPath();
SaveDLG->ShowDialog();

if (SaveDLG->FileName == "")
return;

if (File::Exists(SaveDLG->FileName))
File::Delete(SaveDLG->FileName);

SaveTranslation(SaveDLG->FileName, TrsLNG);

}
private: void SaveTranslation(String *file, Array *arrSave)
{
FileStream *fs = new FileStream(file, FileMode::CreateNew, FileAccess::Write);
StreamWriter *sw = new StreamWriter(fs);

try
{
for (int i=1; i<lines; i++)
="" {
="" string="" *temp="arrSave-">GetValue(i)->ToString();
if (temp == "")
break;
if (i==Lines-1)
sw->Write(temp);
else
sw->WriteLine(temp);
}
}
catch (System::NullReferenceException *)
{
}
sw->Close();
fs->Close();
}

void ModifyItem(String *text, int nIndex, Array *arrSrc, Array *arrDes)
{
ListViewItem *pItem = new ListViewItem();
pItem = SourceLNGView->Items->Item[nIndex];
pItem->Text = text;
if (arrSrc->GetValue(nIndex)->ToString()->Equals(arrDes->GetValue(nIndex)->ToString()))
{
pItem->BackColor = Color::FromArgb(0xFFC0FFC0);
}
else
{
pItem->BackColor = Color::FromArgb(255,255,255);
}
}

private: System::Void SourceLNGView_DoubleClick(System::Object * sender, System::EventArgs * e)
{
TranslatedText->Focus();
}

private: System::Void linkLabel1_LinkClicked(System::Object * sender, System::Windows::Forms::LinkLabelLinkClickedEventArgs * e)
{
System::Diagnostics::Process::Start("mailto:bsaksida@mail386.com");
}

};

};
GeneralRe: Help Me to port to Win98 Pin
Dave Kreskowiak6-May-05 12:24
mveDave Kreskowiak6-May-05 12:24 
GeneralThank For Help Pin
Saksida Bojan7-May-05 3:04
Saksida Bojan7-May-05 3:04 
GeneralPocket PC image processing problems Pin
redleafong5-May-05 18:35
redleafong5-May-05 18:35 
QuestionWhy is Textbox not working? Pin
Richard Jones5-May-05 9:30
Richard Jones5-May-05 9:30 
AnswerRe: Why is Textbox not working? Pin
Colin Angus Mackay5-May-05 10:42
Colin Angus Mackay5-May-05 10:42 
GeneralRe: Why is Textbox not working? Pin
Richard Jones6-May-05 2:20
Richard Jones6-May-05 2:20 
GeneralExtracting cab file : FDICopy() Failed: code 11[User aborted] Pin
Sheela Krishnan5-May-05 5:42
Sheela Krishnan5-May-05 5:42 
GeneralOverlapping Images with Windows Forms/PictureBox Pin
pcxboy4-May-05 18:27
pcxboy4-May-05 18:27 
GeneralRe: Overlapping Images with Windows Forms/PictureBox Pin
MoustafaS5-May-05 1:47
MoustafaS5-May-05 1:47 
GeneralRe: Overlapping Images with Windows Forms/PictureBox Pin
pcxboy5-May-05 2:59
pcxboy5-May-05 2:59 
QuestionHow to create database for smart device like Pocket PC Pin
Member 19358804-May-05 7:28
Member 19358804-May-05 7:28 
AnswerRe: How to create database for smart device like Pocket PC Pin
Dan_P4-May-05 14:57
Dan_P4-May-05 14:57 
GeneralRe: How to create database for smart device like Pocket PC Pin
Member 19358804-May-05 17:25
Member 19358804-May-05 17:25 
GeneralRe: How to create database for smart device like Pocket PC Pin
Dan_P4-May-05 18:02
Dan_P4-May-05 18:02 
GeneralRe: How to create database for smart device like Pocket PC Pin
Richard Jones6-May-05 2:23
Richard Jones6-May-05 2:23 
GeneralProblems running NUnit tests Pin
G.Ringbom4-May-05 4:53
G.Ringbom4-May-05 4:53 
GeneralRe: Problems running NUnit tests Pin
keith maddox4-May-05 11:01
keith maddox4-May-05 11:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.