Click here to Skip to main content
15,943,798 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: 6F00 return on reading of smard card ? Pin
Le@rner4-Apr-12 22:44
Le@rner4-Apr-12 22:44 
GeneralRe: 6F00 return on reading of smard card ? Pin
Richard MacCutchan4-Apr-12 23:58
mveRichard MacCutchan4-Apr-12 23:58 
QuestionQuestion regarding MFC Pin
tasumisra3-Apr-12 17:40
tasumisra3-Apr-12 17:40 
AnswerRe: Question regarding MFC Pin
_AnsHUMAN_ 3-Apr-12 18:03
_AnsHUMAN_ 3-Apr-12 18:03 
AnswerRe: Question regarding MFC Pin
Chandrasekharan P3-Apr-12 20:06
Chandrasekharan P3-Apr-12 20:06 
GeneralRe: Question regarding MFC Pin
tasumisra3-Apr-12 20:34
tasumisra3-Apr-12 20:34 
GeneralRe: Question regarding MFC Pin
Chandrasekharan P3-Apr-12 20:42
Chandrasekharan P3-Apr-12 20:42 
Questionerrors adding to windows form creator Pin
Member 79972643-Apr-12 11:20
Member 79972643-Apr-12 11:20 
Hi everybody. I have a question regarding adding a method to premade code using visual c++. Here is the method:
C++
void GetAllFiles( string sPath )
{
    WIN32_FIND_DATA FindFileData;
    string sTmpPath = sPath;
    sTmpPath += "\\*.*";

    HANDLE hFind = FindFirstFile( sTmpPath.c_str(), &FindFileData );

    if ( hFind == INVALID_HANDLE_VALUE )
        return;
    else {
        do {
            if ( ( FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) ) {
		// if directory:
                if ( strcmp(".", FindFileData.cFileName ) && strcmp("..", FindFileData.cFileName) ) {
		    sTmpPath = sPath;
                    sTmpPath += "\\";
		    sTmpPath += FindFileData.cFileName;
                    GetAllFiles( sTmpPath.c_str() );
                }
            }
            else // if file:
            {
		sTmpPath = sPath;
                sTmpPath += "\\";
		sTmpPath += FindFileData.cFileName;
                cout << sTmpPath << endl;
            }
        } while ( FindNextFile( hFind, &FindFileData) != 0 );

        FindClose( hFind );
    }
    return;
}


When I add it to the bottom of my form.h (below) file it comes up with these errors (bottom):

C++
	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;

	/// <summary>
	/// Summary for Form1
	/// </summary>
	public ref class Form1 : public System::Windows::Forms::Form
	{
	public:
		Form1(void)
		{
			InitializeComponent();
			//
			//TODO: Add the constructor code here
			//
		}

	protected:
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		~Form1()
		{
			if (components)
			{
				delete components;
			}
		}
	private: System::Windows::Forms::TextBox^  textBox1;
	protected: 
	private: System::Windows::Forms::Label^  label1;
	private: System::Windows::Forms::ListBox^  list;
	private: System::Windows::Forms::Button^  button1;
	private: System::Windows::Forms::Button^  button2;


	private:
		/// <summary>
		/// Required designer variable.
		/// </summary>
		System::ComponentModel::Container ^components;

#pragma region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		void InitializeComponent(void)
		{
			this->textBox1 = (gcnew System::Windows::Forms::TextBox());
			this->label1 = (gcnew System::Windows::Forms::Label());
			this->list = (gcnew System::Windows::Forms::ListBox());
			this->button1 = (gcnew System::Windows::Forms::Button());
			this->button2 = (gcnew System::Windows::Forms::Button());
			this->SuspendLayout();
			// 
			// textBox1
			// 
			this->textBox1->Location = System::Drawing::Point(97, 23);
			this->textBox1->Name = L"textBox1";
			this->textBox1->Size = System::Drawing::Size(518, 20);
			this->textBox1->TabIndex = 0;
			this->textBox1->TextChanged += gcnew System::EventHandler(this, &Form1::textBox1_TextChanged);
			// 
			// label1
			// 
			this->label1->AutoSize = true;
			this->label1->Location = System::Drawing::Point(12, 26);
			this->label1->Name = L"label1";
			this->label1->Size = System::Drawing::Size(79, 13);
			this->label1->TabIndex = 1;
			this->label1->Text = L"Libray Location";
			// 
			// list
			// 
			this->list->FormattingEnabled = true;
			this->list->Location = System::Drawing::Point(15, 63);
			this->list->Name = L"list";
			this->list->Size = System::Drawing::Size(757, 238);
			this->list->TabIndex = 2;
			// 
			// button1
			// 
			this->button1->Location = System::Drawing::Point(697, 337);
			this->button1->Name = L"button1";
			this->button1->Size = System::Drawing::Size(75, 23);
			this->button1->TabIndex = 3;
			this->button1->Text = L"Play";
			this->button1->UseVisualStyleBackColor = true;
			// 
			// button2
			// 
			this->button2->Location = System::Drawing::Point(616, 337);
			this->button2->Name = L"button2";
			this->button2->Size = System::Drawing::Size(75, 23);
			this->button2->TabIndex = 4;
			this->button2->Text = L"Refresh";
			this->button2->UseVisualStyleBackColor = true;
			this->button2->Click += gcnew System::EventHandler(this, &Form1::button2_Click);
			// 
			// Form1
			// 
			this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
			this->ClientSize = System::Drawing::Size(784, 372);
			this->Controls->Add(this->button2);
			this->Controls->Add(this->button1);
			this->Controls->Add(this->list);
			this->Controls->Add(this->label1);
			this->Controls->Add(this->textBox1);
			this->Name = L"Form1";
			this->Text = L"Form1";
			this->ResumeLayout(false);
			this->PerformLayout();

		}

		private: System::Void textBox1_TextChanged(System::Object^  sender, System::EventArgs^  e) {
			
		}
	private: System::Void button2_Click(System::Object^  sender, System::EventArgs^  e) {
			//textBox1->Text
			//list->Items->Add();
		}

		void GetAllFiles( string sPath )
{
    WIN32_FIND_DATA FindFileData;
    string sTmpPath = sPath;
    sTmpPath += "\\*.*";

    HANDLE hFind = FindFirstFile( sTmpPath.c_str(), &FindFileData );

    if ( hFind == INVALID_HANDLE_VALUE )
        return;
    else {
        do {
            if ( ( FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) ) {
		// if directory:
                if ( strcmp(".", FindFileData.cFileName ) && strcmp("..", FindFileData.cFileName) ) {
		    sTmpPath = sPath;
                    sTmpPath += "\\";
		    sTmpPath += FindFileData.cFileName;
                    GetAllFiles( sTmpPath.c_str() );
                }
            }
            else // if file:
            {
		sTmpPath = sPath;
                sTmpPath += "\\";
		sTmpPath += FindFileData.cFileName;
                cout << sTmpPath << endl;
            }
        } while ( FindNextFile( hFind, &FindFileData) != 0 );

        FindClose( hFind );
    }
    return;
}

};


1>------ Build started: Project: TestForms, Configuration: Debug Win32 ------
1>  TestForms.cpp
1>c:\users\steve\documents\visual studio 2010\projects\testforms\testforms\Form1.h(134): error C2061: syntax error : identifier 'string'
1>c:\users\steve\documents\visual studio 2010\projects\testforms\testforms\Form1.h(136): error C2065: 'WIN32_FIND_DATA' : undeclared identifier
1>c:\users\steve\documents\visual studio 2010\projects\testforms\testforms\Form1.h(136): error C2146: syntax error : missing ';' before identifier 'FindFileData'
1>c:\users\steve\documents\visual studio 2010\projects\testforms\testforms\Form1.h(136): error C2065: 'FindFileData' : undeclared identifier
1>c:\users\steve\documents\visual studio 2010\projects\testforms\testforms\Form1.h(137): error C2065: 'string' : undeclared identifier
1>c:\users\steve\documents\visual studio 2010\projects\testforms\testforms\Form1.h(137): error C2146: syntax error : missing ';' before identifier 'sTmpPath'
1>c:\users\steve\documents\visual studio 2010\projects\testforms\testforms\Form1.h(137): error C2065: 'sTmpPath' : undeclared identifier
1>c:\users\steve\documents\visual studio 2010\projects\testforms\testforms\Form1.h(137): error C2065: 'sPath' : undeclared identifier

AnswerRe: errors adding to windows form creator Pin
Richard Andrew x643-Apr-12 12:29
professionalRichard Andrew x643-Apr-12 12:29 
GeneralRe: errors adding to windows form creator Pin
Member 79972643-Apr-12 15:10
Member 79972643-Apr-12 15:10 
AnswerRe: errors adding to windows form creator Pin
Richard Andrew x643-Apr-12 15:16
professionalRichard Andrew x643-Apr-12 15:16 
GeneralRe: errors adding to windows form creator Pin
Member 79972643-Apr-12 17:25
Member 79972643-Apr-12 17:25 
AnswerRe: errors adding to windows form creator Pin
Wes Aday3-Apr-12 15:23
professionalWes Aday3-Apr-12 15:23 
GeneralRe: errors adding to windows form creator Pin
Member 79972643-Apr-12 17:50
Member 79972643-Apr-12 17:50 
GeneralRe: errors adding to windows form creator Pin
Wes Aday4-Apr-12 1:48
professionalWes Aday4-Apr-12 1:48 
Questiondelete pointer Pin
ITISAG3-Apr-12 11:03
ITISAG3-Apr-12 11:03 
AnswerRe: delete pointer Pin
Chuck O'Toole3-Apr-12 11:19
Chuck O'Toole3-Apr-12 11:19 
GeneralRe: delete pointer Pin
ITISAG3-Apr-12 11:21
ITISAG3-Apr-12 11:21 
AnswerRe: delete pointer Pin
Chuck O'Toole3-Apr-12 11:31
Chuck O'Toole3-Apr-12 11:31 
GeneralRe: delete pointer Pin
ITISAG3-Apr-12 11:26
ITISAG3-Apr-12 11:26 
AnswerRe: delete pointer Pin
Chuck O'Toole3-Apr-12 11:34
Chuck O'Toole3-Apr-12 11:34 
GeneralRe: delete pointer Pin
Richard MacCutchan3-Apr-12 22:00
mveRichard MacCutchan3-Apr-12 22:00 
GeneralRe: delete pointer Pin
ggggfjeicfh5-Apr-12 16:26
ggggfjeicfh5-Apr-12 16:26 
GeneralRe: delete pointer Pin
ggggfjeicfh5-Apr-12 16:40
ggggfjeicfh5-Apr-12 16:40 
QuestionmousePress crash 64 bit mfc application Pin
appollosputnik3-Apr-12 8:11
appollosputnik3-Apr-12 8:11 

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.