Click here to Skip to main content
14,663,253 members
Home » Discussions » C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Background color on Text Boxes and other controls Pin
see me7-Aug-06 18:05
Membersee me7-Aug-06 18:05 
GeneralRe: Background color on Text Boxes and other controls Pin
Reagan Conservative8-Aug-06 3:29
MemberReagan Conservative8-Aug-06 3:29 
AnswerRe: Background color on Text Boxes and other controls Pin
anu_887-Aug-06 18:35
Memberanu_887-Aug-06 18:35 
GeneralRe: Background color on Text Boxes and other controls Pin
Reagan Conservative8-Aug-06 3:30
MemberReagan Conservative8-Aug-06 3:30 
AnswerRe: Background color on Text Boxes and other controls Pin
Hamid_RT7-Aug-06 19:29
MemberHamid_RT7-Aug-06 19:29 
GeneralRe: Background color on Text Boxes and other controls Pin
Reagan Conservative8-Aug-06 3:30
MemberReagan Conservative8-Aug-06 3:30 
GeneralRe: Background color on Text Boxes and other controls Pin
Hamid_RT8-Aug-06 6:53
MemberHamid_RT8-Aug-06 6:53 
QuestionWierd memory error [modified] Pin
CoffeeAddict197-Aug-06 10:54
MemberCoffeeAddict197-Aug-06 10:54 
I'm getting a really wierd error. I started it as an empty .NET project, and everything is posted here but the int main() file:

The program compiles without any errors or warnings reported by the debugger, but when it runs, I get this error:

"An unhandled exception of type 'System.NullReferenceException' occurred in NumberConversion.exe

Additional information: Object reference not set to an instance of an object."

It points to this line inside memcpy.asm:
mov     [edi],al        ;U - write second byte to destination


The code:

Implementation file:
#include "Menu_Class.h"
#include "CommonStructDefs.h"
#include <iostream>
#include <string>

using namespace std;

Menu::Menu()
{
	NumMenuOptions = 2; //number of menu options
	InitializeMenuOptions();
}
void Menu::PrintOptions()
{
	cout<<"Availible menu options:"<<endl;
	for(int i=0; i < NumMenuOptions; i++)
		PrintMenuOption(i);
	cout<<"Please enter a menu option: [1-"<<NumMenuOptions<<"]: ";
}
void Menu::PrintMenuOption(int MenuOption)
{
	cout<<MenuOptions[MenuOption].OptionNumber<<". ";
	cout<<MenuOptions[MenuOption].OptionName<<": ";
	cout<<MenuOptions[MenuOption].OptionDescription<<endl;
}
void Menu::InitializeMenuOptions()
{
	for(int i=0; i < NumMenuOptions; i++)
		MenuOptions[i].OptionNumber = i + 1;

	MenuOptions[0].OptionName = "Decimal -) Binary";
	MenuOptions[1].OptionName = "Binary -) Decimal";
	MenuOptions[2].OptionName = "Exit Program";

	MenuOptions[0].OptionDescription = "Convert a base 10 number to a base 2 number.";
	MenuOptions[1].OptionDescription = "Convert a base 2 number to a base 10 number.";
	MenuOptions[2].OptionDescription = "Exit the program.";
}


Specification file:
#include "CommonStructDefs.h"

#ifndef MENU_CLASS_H
#define MENU_CLASS_H

using namespace std;

class Menu
{
public:
	Menu(); //default constructor
	void PrintOptions(); //print all menu options
	void PrintMenuOption(int MenuOption); //print a single menu option
protected:
private:
	void InitializeMenuOptions(); //inits MenuOptions array structure
	int NumMenuOptions; //number of menu options
	MenuOptionType MenuOptions[2]; //structure of menu options
};

#endif


Defenitions:

#include <iostream>
#include <string>

using namespace std;

#ifndef COMMON_STRUCT_DEFS_H
#define COMMON_STRUCT_DEFS_H

struct MenuOptionType
{
	string OptionName;
	string OptionDescription;
	int OptionNumber;
};

#endif


Any help would be appreciated.


-- modified at 16:55 Monday 7th August, 2006
AnswerRe: Wierd memory error Pin
led mike7-Aug-06 11:17
Memberled mike7-Aug-06 11:17 
QuestionPage fault count in a simple dialog box Pin
Varchas R S7-Aug-06 10:05
MemberVarchas R S7-Aug-06 10:05 
AnswerRe: Page fault count in a simple dialog box Pin
Zac Howland7-Aug-06 10:26
MemberZac Howland7-Aug-06 10:26 
GeneralRe: Page fault count in a simple dialog box Pin
Varchas R S7-Aug-06 10:32
MemberVarchas R S7-Aug-06 10:32 
QuestionRe: Page fault count in a simple dialog box Pin
David Crow7-Aug-06 11:05
MemberDavid Crow7-Aug-06 11:05 
AnswerRe: Page fault count in a simple dialog box Pin
Varchas R S7-Aug-06 19:47
MemberVarchas R S7-Aug-06 19:47 
GeneralRe: Page fault count in a simple dialog box Pin
David Crow8-Aug-06 2:44
MemberDavid Crow8-Aug-06 2:44 
QuestionVB6 Boolean to bool Pin
Andre xxxxxxx7-Aug-06 8:46
MemberAndre xxxxxxx7-Aug-06 8:46 
QuestionRe: VB6 Boolean to bool Pin
David Crow7-Aug-06 10:00
MemberDavid Crow7-Aug-06 10:00 
AnswerRe: VB6 Boolean to bool Pin
Andre xxxxxxx7-Aug-06 10:06
MemberAndre xxxxxxx7-Aug-06 10:06 
QuestionREAD DATAS FROM MS access Table and display it MFC list control Pin
Arul Joseph7-Aug-06 8:06
MemberArul Joseph7-Aug-06 8:06 
AnswerRe: READ DATAS FROM MS access Table and display it MFC list control Pin
David Crow7-Aug-06 8:12
MemberDavid Crow7-Aug-06 8:12 
GeneralRe: READ DATAS FROM MS access Table and display it MFC list control Pin
Arul Joseph7-Aug-06 8:19
MemberArul Joseph7-Aug-06 8:19 
QuestionRe: READ DATAS FROM MS access Table and display it MFC list control Pin
David Crow7-Aug-06 8:35
MemberDavid Crow7-Aug-06 8:35 
QuestionCrystal Reports SDK??????? Pin
javad_20057-Aug-06 7:56
Memberjavad_20057-Aug-06 7:56 
QuestionDialog Controls Palette Pin
Reagan Conservative7-Aug-06 6:50
MemberReagan Conservative7-Aug-06 6:50 
AnswerRe: Dialog Controls Palette Pin
David Crow7-Aug-06 8:40
MemberDavid Crow7-Aug-06 8:40 

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.