|
How can i use application in win98. I used .NET Framework 1.1. I have instaled in win98. When i use that program, i got System.NullReferenceExpliction. Under xp, i don't have a problem. I have programd in C++ 2003
|
|
|
|
|
What exactly are you doing? It's not really clear if your using managed c++ or where the exception is being thrown.
Anyway some things like EventLogs don't exist on windows 98.
Have a look at this list[^] of supported features.
|
|
|
|
|
I Don't Use eventLogs
I use RegistryKey Does this support.
I din't find anything at that link
|
|
|
|
|
Some registry keys that exist under an NT Kernel (NT/2000/XP/2003) don't exist under 98. Your code should have been written to check return values before trying to use them. You'r going to have to go back and write some tracing code into your code so you can see where this error is taking place.
Without knowing anything about your code, what you're doing, where the error in your code is occuring, ..., it's impossible to tell you what's wrong. I mean, all your told us is, literally, "My program works on XP, but breaks on 98". There's absolutely nothing we can do with a description like this.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
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");
}
};
};
|
|
|
|
|
You're kidding, right? You don't pay me enough to debug your code for you, especially a chunk of code this long. I'm telling you how to find it yourself. You hope it helps me?!? No. Help yourself...
Let me show your what your NOT doing. I told you to check your return values before you try to use them. You're not doing that. For example:
RegistryKey *pKey = Registry::ClassesRoot;
pKey = pKey->OpenSubKey(S"ArtMoneyTable\\Shell\\Open\\Command");
Object *pValue = pKey->GetValue(S"");
Did OpenSubKey actually return a Registry object or is it null ? You're not checking this. You're just assuming that it worked and returned the object you expected. Now, your next line immediately tries to use the returned object, calling its GetValue method. If OpenSubKey returned null , which exception do you think will be throw when you try and execute?
Object *pValue = null->GetValue(S"");
I'm not saying this is your codes' problem, but this is a glaring example of why your code is failing and you can't find where the problem is. Always check your return values before you try to use them!
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks It Worked. I am sory for the trouble, and i am only a begginer.
|
|
|
|
|
Thanks for your attention.
Currently I am working on a image processing program for PPC (using C#), yet there are two problems remained to be solved:
1. Rotating an image. Compact framework doesn't support the methods such as "Image.RotateFlip" or "Graphics.DrawImage(Image, Point[])", so I need to implement the rotation function completely by manually coding. Therefore I need an algorithm, which doesn't invoke any special system-provided method, to perform image rotation.
2. Saving an image. The compact framework doesn't support the Image.Save method, so I have to find another way to save a Bitmap object into a JPEG file.
Any kind of help will be greatly appreciated. Thanks.
|
|
|
|
|
I have code in C++ using Editbox, appending \r\n to each line to make a new line.
In .NET, using Textbox, I actually SEE the \r\n and everything is on one line.
Help!
Top 10 Geek Resulutions:
5. To decipher what that big room is, which has the blue ceiling and poor climate control.
|
|
|
|
|
|
Thanks.
BTW, I was using editBox.Text += "\r\n" and it wasn't working.
Using Environment.Newline works great.
I've never used the @ prefix in literals.
Top 10 Geek Resulutions:
5. To decipher what that big room is, which has the blue ceiling and poor climate control.
|
|
|
|
|
Hi,
I created a backup file containing sources around 2.5G. The compressed CAB file size is around 1 G.
Now when I am trying to extract the contents of the cab file, I am getting an error FDICopy() Failed: code 11[User aborted] while it reaches one particular file.
I tried viewing the list of files in the cab, I could see all the files I had asked to be archived.
Even when I tried to extract using Winzip, the winzip also encountered problems at the same file. I was trying to extract the cab file onto my D:\. The following was the error message -
"CAB file is continued on disk as in drive D:\...." "D:\ is not a CAB file..." "Error processing multi-part CAB file"
Pls help me as I need the cab file contents!
Thanks, Sheela
|
|
|
|
|
Hello, I am designing a very basic video game, and I want an image to move relative to key presses. This image is on top of a background image. I use picture boxes, however there is a rectangle surrounding the image I wish to move, and it does not look right. Is there a way to make it so that the moving image appears to be part of the background image, so when I move it around? Much like any video game out there with characters that move. Thank you very much
Michael L. Allen
|
|
|
|
|
Don't use picturebox ,but use Graphics.DrawImage() as it will draw over the back ground and when you call this.Refresh(),It will re paint the back ground and you casn after this call immediatly draw it again in another location.
|
|
|
|
|
Is there a specific way to call that function; I have tried this so far:
Bitmap* MyImage;<br />
System::String* image = "Resource/wiggle.gif";<br />
<br />
MyImage = new Bitmap(image);<br />
Graphics* Dr = new Graphics;<br />
Dr.DrawImage((dynamic_cast<Image*>(MyImage)),50,50);
however I get errors. Thank you very much for the help you have given me thus far.
Mike
|
|
|
|
|
Hi, I'm developing a stand alone system for Pocket PC. Currently facing problem on how to create database for Pocket PC. I using VB .net to develop the system. Anyone can help here? Thanks in advance!
|
|
|
|
|
The SQL Server CE tools on the PDA have a simple Query Analzyer tool, you can execute sql or visually design the tables with this tool.
|
|
|
|
|
Thank Dan_P for your reply. Just try to confirm with you. The SQL server CE tools is pre-installed on the PDA or it needed to get the software install in it.
|
|
|
|
|
|
Also the first time you deploy an app that uses SqlServer CE, it installs it.
Top 10 Geek Resulutions:
5. To decipher what that big room is, which has the blue ceiling and poor climate control.
|
|
|
|
|
This might not be the best forum for this question but I hope someone will be able to answer it anyway.
I have a bunch of nunit tests that I want to run. The problem is that they fail if run them all. If I run them one by one they work fine. These tests tests some sockets network code. The network connection is done using a static object. This means all tests use the same network connection object. I thought that the tests run one after the other, but it seems they run in parallell sometimes. This has the effect that a test connects to the server and starts doing what the test does and then another test opens a new connection with the effect that the state needed in the first tests is lost, and thereby causing the first test to fail.
So the real question is how NUnit runs the tests? Does it run them one after the other or (atleast to some degree) in parallell?
|
|
|
|
|
I've not noticed them running in parallel and I don't believe that they do but I have had similar problems and upon closer inspection determined that I have introduced some state dependencies. Anyway, the solution for me was to use Setup and Teardown (Nunit things) code to make sure state was setup correctly for each test that I ran.
That just might work for you too.
|
|
|
|
|
I've set Contolbox = false on mdi children so it appears to the user that the children are part of the mdi parent. This workls fine, but when the child is first created it has a titlebar that disappears after a split second, but it is there long enough to make the whole form appear to "bounce" when the titlebar goes away, causing the entire form to shift upward. I'm using VS 2003 and C#.
Any suggestions would be greatly appreciated.
|
|
|
|
|
I do this kind of UI trick here at work all the time so try what I do, just turn off the border altogether, that works great!
|
|
|
|
|
Hi...I'm working on the windows mobile 2003 platform (e200 spv) and would like to get the phones' location info and write it to a txt file.
Any suggestions?
dboy.spv
|
|
|
|
|