|
i have a question. do you really want the member pMyStr to be a CString pointer ??
anyway, what does this line produce if you replace the line within func2() :
*pMyStr = CString("test3");
|
|
|
|
|
the point is, The pointer in Class2 shows that it is pointing to the write place, because when I set it in Class 2 it works. And In Class1, setting the value by pointer works also, so I know that one is pointing to the right place to. It is the value that is set in the main function that is somehow getting overwritten or NULL'ed, and i can't understand why.
|
|
|
|
|
just a guess, try to use your debugger with some breakpoints to figure out where the data is NULL'ed.
also, if you can use references instead of pointers, i advise you to ; using pointers and allocating memory on the heap is driving you into trouble if you don't handle them perfectly...
|
|
|
|
|
ok.. but how do I get the reference into the scope of the intire class. I was using member pointers to do it. is their another way?
class Class1
{
int *m_ptr;
}
Class1::Class1(int& num)
{
m_ptr = #
}
Class1::func1()
{
//I have access to the reference
m_ptr = 5;
}
|
|
|
|
|
I FIXED IT !!!!
it was not a problem with pointers, classes, member pointers or references at all. I had an event that was triggering before any data was set and it was in fact NULLifying the value. Thanks for the help
|
|
|
|
|
I ve come across a problem,
I want to Run an application as a Service using VC++
It is an MFC application with ATL Support
I ve registered the exe using /RegServer and in my service program I ve a function like
if(SUCCEEDED(hResult))
{
hResult = CoCreateInstance(__uuidof(QBFeeder), 0,
CLSCTX_SERVER, __uuidof(IQBFeeder), (void **)&m_pQBFeeder);
}
if(!SUCCEEDED(hResult))
{
return E_FAIL;
}
but the CoCreateInstance function returns a value -2147467262.It gives an error like "no such interfaces supported"
It works in one of my machines(AMD) but it fails in another machines(Intel)....
Has anyone come across a similar situation?
Can anyone give me a solution?
Regards,
Jomon Jacob
|
|
|
|
|
I would suspect the AMD vs Intel thing is a red herring. Try using a quick test app to grab the IQBFeeder interface. If it works just fine in your 10 line dialog based MFC app, then the bug is in your software.
It may be an apartment thing. After all, your creating a COM object from within a COM object.
Maby there are conditions that QBFeeder will refuse to like you. I had a library fail sometimes with the "no interface" error, and it was a misrepresented error. The hardware is was meant to control was missing a license dongle. So, it gave the wrong error.
Maybe the QBFeeder COM object has got a problem being created from a service - it runs in a different account to you as a user. Maybe try ImpersonateUser around it?
You can use tools like regmon and filemon from www.sysinternals.com to see what is failing if it's a security thing.
Good luck,
Iain.
|
|
|
|
|
Hi,
Horizontal scroll bar automatically gets added in CListCtrl when data exceeds the list control.
The scroll bar moves up, i want it to be down so i can see the last item inserted.
Note: due to some i can't use EnsureVisible(counter-1, FALSE);
Is there any other way.
|
|
|
|
|
I have used the UML cabalities of VS2005 for a few C# projects, but I have a couple of MFC C++ projects which I have converted to VS2005. I would like to generate class dialgrams for these MFC C++ projects but cannot seem to work out how to do it in VS2005. I guess that this is not possible for MFC C++ projects at the moment! Does anyone know of any way to generate class diagrams for MFC C++ projects? Will this be possible in VS2008?
|
|
|
|
|
As I know, Visual Studio 2005 only supports diagram generation for C#.
Maxwell Chen
|
|
|
|
|
Hello friends,
I have got a problem with one of my C++ program. One of my friend asked me to a program for her but it needs to be done by using vector. Though i have knowledge about string and class but no idea about vector. Please responce if you are able..thanks
1) void displayList(const vector<string>& nameList, const vector<int>& teleNumList) : This function displays the name and the corresponding number of all the persons in stored in nameList. The nameList contains the name list and teleNumList contains the corresponding telephone numbers. The pre-conditions are that both nameList and teleNumList have the same size and nth element of nameList corresponds to the nth element of teleNumList.
2) void append(const string& name, int teleNum, vector<string>& nameList, vector<int>& teleNumList) : This function appends the person name and the corresponding telephone number teleNum to the nameList and the teleNumList respectively.
3) bool update(const string& name, int teleNum, const vector<string>& nameList, vector<int>& teleNumList) : This function updates the telephone number of the person name to teleNum. The nameList and the teleNumList are the name list and the corresponding telephone number list. If it fails to find the person, it returns false otherwise it returns true.
4) bool erase(const string& name, vector<string>& nameList, vector<int>& teleNumList) : This function erases the person and the corresponding telephone number of the person name. The nameList and the teleNumList are the name list and the corresponding telephone number list. If it fails to find the person, it returns false otherwise it returns true.
%%{a man widout face}%%
|
|
|
|
|
So what's your question?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
My question is how to write code with vector ? if u can please write it for my friend
|
|
|
|
|
|
watz dat man ? ru trying to say to use google? well i did but i didnt get exactly answer wat im looking for. If u can please post here.
|
|
|
|
|
oronnorh wrote: watz dat man ?
a wise piece of help
oronnorh wrote: ru trying to say to use google?
in a certain manner, yes
oronnorh wrote: well i did but i didnt get exactly answer wat im looking for
that's probably because you didn't look at the right place. is this[^] a better link for you ?
|
|
|
|
|
Is Google banned at your place?
vector<int> this_is_a_vector_of_ints;
this_is_a_vector_of_ints.push_back(867);
this_is_a_vector_of_ints.push_back(5);
this_is_a_vector_of_ints.push_back(309);
vector<int>::iterator first = this_is_a_vector_of_ints.begin();
vector<int>::iterator last = this_is_a_vector_of_ints.end();
while (first != last)
cout << *first++ << endl; or
copy(first, last, ostream_iterator<int>(cout, "\n"));
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
sorry im not gud in programming like u.. if u r genious please show that to solve my four problem... thanks
|
|
|
|
|
oronnorh wrote: sorry im not gud in programming like u..
nor at speaking proper english either
is it too difficult to type the full word ? are you sms-typing from your cell-phone ?
|
|
|
|
|
toxcct wrote: is it too difficult to type the full word ? here i am not going to write a book so that i have to maintain my typing for you. If you can't understand what i am writting then please don't read it. Better stop looking.. And for your problem i typed properly this time .. see if you can read it.
|
|
|
|
|
oronnorh wrote: And for your problem i typed properly this time .. see if you can read it
thank you for this. I would add a little more thing that you probably don't know, which would help you understand why i am asking you to type properly.
The Code Project population is very cosmopolite and many people don't speak english as a their mother tongue... that is, if you don't make the effort to be understood, other people won't make any effort to understand your question.
see what i mean ?
|
|
|
|
|
|
oronnorh wrote: here i am not going to write a book so that i have to maintain my typing for you.
Instead you are asking a Question where you want him to program your homework. And that is not a reason to be polite.
Remember, its not us who are wanting you to be here...Its you. It is perfectly OK for you being here as long as you adhere to the code of conduct.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
jhwurmbach wrote: It is perfectly OK for you being here as long as you adhere to the code of conduct
well said
|
|
|
|
|
oronnorh wrote: Can Some one please help me out very urgent ?
what an explicit description of your problem, isn't it ?
oronnorh wrote: One of my friend asked me to a program for her but it needs to be done by using vector
so, she asked you to do her homeworks ?!
oronnorh wrote: Please responce if you are able
I am, but i think she/you should read the doc and/or the std::vector class interface and try to understand it first...
come on, it's not that hard. you can do it !
|
|
|
|