|
How can anyone answer this? We have no idea what sort of card you are using, what interface it is connected to and what code you are using to access it. Please give some useful information about your problem.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
while reading a smart card according to GSM standard its return 9000 at the end of response string ,as a normal ending of the command,
but for device its reaturn 6f00 so no data is fetched here.
thanks.
|
|
|
|
|
And exactly what is that supposed to tell us? Try reading the documentation to find out what 6F00 indicates.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Hi Guys!
Nowadays i am appearing for interviews with expertise in COM+/DCOM/Web-services.
I have done little work in MFC may be close to 8 months for a maintenance project.
During interviews interviewers are more focused in MFC rather than my core expertise,now i am planning to learn MFC as well...
I have been asked about many macros in the interviews..
I have following question:
1)Do i need learn about all or most of the important classes..?
2)Do i need to know all the Macros..?
3)how about win32..?
what else i should learn in this...
what you guys would advise me in this ???
i bought a MFC book "MFC Programming from the ground up"
Please help and Thanks in advance.
vikas da
|
|
|
|
|
tasumisra wrote: 1)Do i need learn about all or most of the important classes..?
The scope of this question is quite wide and the answer would be "Yes" and a "No". Basically the interviewers try to understand your in depth knowledge about MFC. A few classes like CObject,CArchive(helps in Serialization), CCmdTarget (foundation class for message map architecture), CWinThread etc would help. The questions put in front of you might depend on the project requirement.
tasumisra wrote: 2)Do i need to know all the Macros..?
Expected is "yes". But it seems hard to gather the knowledge on everything. BEGIN_MESSAGE_MAP etc should be known.
tasumisra wrote: 3)how about win32..?
Win32 is the base for MFC as it is built on top of it. Read Windows Internals to understand how things work.
Many people would also suggest to have a little or more knowledge of everything in MFC. But the crux is "The more you code, the better you become in terms of knowledge, understanding and preparation"
You talk about Being HUMAN. I have it in my name
AnsHUMAN
|
|
|
|
|
I have attended a lot of interviews for VC++ and MFC Requirements. it depends from person to person. You certainly need to know the basics of MFC, and win32. You would not have used all the macros that is available in MFC. So what you know can be explained to them really well so that they can get convinced that you have reall y worked on them or have knowledge on it...
You can get a job by learning a lot of things but what really matters is the practical experience. I wish you all the best for your interviews.
Every new day is another chance to change your life.
|
|
|
|
|
Thank you so much AnsHUMAN and Chandra..
I guess i need to work hard for MFC...
vikas da
|
|
|
|
|
Your Welcome
Every new day is another chance to change your life.
|
|
|
|
|
Hi everybody. I have a question regarding adding a method to premade code using visual c++. Here is the method:
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 ( strcmp(".", FindFileData.cFileName ) && strcmp("..", FindFileData.cFileName) ) {
sTmpPath = sPath;
sTmpPath += "\\";
sTmpPath += FindFileData.cFileName;
GetAllFiles( sTmpPath.c_str() );
}
}
else {
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):
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;
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
}
protected:
~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:
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
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();
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);
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";
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;
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;
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);
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) {
}
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 ( strcmp(".", FindFileData.cFileName ) && strcmp("..", FindFileData.cFileName) ) {
sTmpPath = sPath;
sTmpPath += "\\";
sTmpPath += FindFileData.cFileName;
GetAllFiles( sTmpPath.c_str() );
}
}
else {
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
|
|
|
|
|
try
#include "windows.h"
#include <string>
at the top of the file
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
 It got rid of most of the errors I was looking at but now I have some more.
1>------ Build started: Project: TestForms, Configuration: Debug Win32 ------
1> TestForms.cpp
1>c:\users\steve\documents\visual studio 2010\projects\testforms\testforms\Form1.h(149): error C2664: 'strcmp' : cannot convert parameter 2 from 'WCHAR [260]' to 'const char *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\users\steve\documents\visual studio 2010\projects\testforms\testforms\Form1.h(149): error C2664: 'strcmp' : cannot convert parameter 2 from 'WCHAR [260]' to 'const char *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\users\steve\documents\visual studio 2010\projects\testforms\testforms\Form1.h(152): error C2679: binary '+=' : no operator found which takes a right-hand operand of type 'WCHAR [260]' (or there is no acceptable conversion)
1> C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstring(777): could be 'std::basic_string<_Elem,_Traits,_Ax> &std::basic_string<_Elem,_Traits,_Ax>::operator +=(const std::basic_string<_Elem,_Traits,_Ax> &)'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>,
1> _Ax=std::allocator<char>
1> ]
1> C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstring(782): or 'std::basic_string<_Elem,_Traits,_Ax> &std::basic_string<_Elem,_Traits,_Ax>::operator +=(const _Elem *)'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>,
1> _Ax=std::allocator<char>
1> ]
1> C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstring(787): or 'std::basic_string<_Elem,_Traits,_Ax> &std::basic_string<_Elem,_Traits,_Ax>::operator +=(_Elem)'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>,
1> _Ax=std::allocator<char>
1> ]
1> while trying to match the argument list '(std::string, WCHAR [260])'
1>c:\users\steve\documents\visual studio 2010\projects\testforms\testforms\Form1.h(160): error C2679: binary '+=' : no operator found which takes a right-hand operand of type 'WCHAR [260]' (or there is no acceptable conversion)
1> C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstring(777): could be 'std::basic_string<_Elem,_Traits,_Ax> &std::basic_string<_Elem,_Traits,_Ax>::operator +=(const std::basic_string<_Elem,_Traits,_Ax> &)'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>,
1> _Ax=std::allocator<char>
1> ]
1> C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstring(782): or 'std::basic_string<_Elem,_Traits,_Ax> &std::basic_string<_Elem,_Traits,_Ax>::operator +=(const _Elem *)'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>,
1> _Ax=std::allocator<char>
1> ]
1> C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xstring(787): or 'std::basic_string<_Elem,_Traits,_Ax> &std::basic_string<_Elem,_Traits,_Ax>::operator +=(_Elem)'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>,
1> _Ax=std::allocator<char>
1> ]
1> while trying to match the argument list '(std::string, WCHAR [260])'
1>c:\users\steve\documents\visual studio 2010\projects\testforms\testforms\Form1.h(161): error C2065: 'cout' : undeclared identifier
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Any idea how to fix this?
|
|
|
|
|
Your project properties are probably set to use Unicode instead of ANSI for all your strings.
Either change the project properties to use ANSI, or use the Unicode version of the strcmp function.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Thank you very much you solved all my problems. I can't thank you enough.
|
|
|
|
|
Also check to make sure that your project is set to use native C++ code in your CLI project. Not sure if that will help or not.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
modified 3-Apr-12 21:57pm.
|
|
|
|
|
I do not fully understand what you mean. Is that an option in Visual Studio? I also came up with another question. How can I convert my System::String^ (in button2_click()) to std::string (in GetAllFiles(string))?
|
|
|
|
|
Member 7997264 wrote: I do not fully understand what you mean
You are trying to use native C++ code in your managed C++ project. See this article[^]
Member 7997264 wrote: System::String^ (in button2_click()) to std::string
See this article[^]
You might get a better response if you asked your questions in the managed c++ forum, here[^]. This forum is for unmanaged C++.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
|
|
|
|
|
Why does the follwing throw an error @ delete []pBuffer;
char *pBuffer = new char[1024];
CString csBuf = (CString)pMember->m_member_label;
pBuffer = csBuf.GetBuffer(sizeof(pBuffer));
xtext=(GLfloat)(((pMember->m_xs)+(pMember->m_xe))/2.0);
ytext=(GLfloat)(((pMember->m_ys)+(pMember->m_ye))/2.0);
ztext=(GLfloat)(((pMember->m_zs)+(pMember->m_ze))/2.0);
m_bmf->DrawStringAt((GLfloat)(xtext), (GLfloat)(ytext+5), (GLfloat)(ztext), pBuffer);
delete []pBuffer;
|
|
|
|
|
ARRRRGH. You overwrite pBuffer with the result of CString's GetBuffer(), which gives you a pointer to a buffer you don't own. Then you try to delete it. BOOM.
You cannot delete the pointer returned by GetBuffer(), that memory belongs to the CString Object and it will delete it when the object is deleted or goes out of scope.
Plus, you've lost the pointer to the char[1024] that you did allocate with new, leaving a memory leak for that memory.
|
|
|
|
|
Thanks.
So, I'm an idiot. What do I do?
I did this, and it at least ran:
pBuffer=NULL;
delete []pBuffer;
|
|
|
|
|
Setting pBuffer = NULL and then deleting it is a big NOP, a no-operation. You might as well just deleted the "delete" statement.
Instead, if your sole purpose in doing the "GetBuffer" is to pass a string to DrawStringAt(), then you don't need to "new" or "delete" anything in that program. All you need is:
CString csBuf = (CString)pMember->m_member_label;
char *pBuffer = csBuf.GetBuffer(1);
xtext=(GLfloat)(((pMember->m_xs)+(pMember->m_xe))/2.0);
ytext=(GLfloat)(((pMember->m_ys)+(pMember->m_ye))/2.0);
ztext=(GLfloat)(((pMember->m_zs)+(pMember->m_ze))/2.0);
m_bmf->DrawStringAt((GLfloat)(xtext), (GLfloat)(ytext+5), (GLfloat)(ztext), pBuffer);
Or better yet, avoid the GetBuffer() entirely and pass "csBuf" to DrawStringAt() and let the compiler convert from CString to char * as needed.
|
|
|
|
|
This did it: (you approve?)
CString csBuf = (CString)pMember->m_member_label;
char *pBuffer = csBuf.GetBuffer(sizeof(pBuffer));
xtext=(GLfloat)(((pMember->m_xs)+(pMember->m_xe))/2.0);
ytext=(GLfloat)(((pMember->m_ys)+(pMember->m_ye))/2.0);
ztext=(GLfloat)(((pMember->m_zs)+(pMember->m_ze))/2.0);
m_bmf->DrawStringAt((GLfloat)(xtext), (GLfloat)(ytext+5), (GLfloat)(ztext), pBuffer);
pBuffer=NULL;
delete []pBuffer;
|
|
|
|
|
Nope, see my response to the earlier post
|
|
|
|
|
You really need to study this[^] carefully. You also need to learn about the sizeof [^], new [^] and delete [^] operators.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
why pBuffer=NULL;
and then delete []pBuffer;
delete what? Only a invalid pointer
|
|
|
|
|
What in m_member_label is a CString pointer or not?
Or you should not do any thing, CString class local instance will destroy at the end of the fun automatically except a pointer from other place?
|
|
|
|
|