|
Saurabh.Garg wrote: Are you sure this code has a bug?
Unfortunatly, yes. I mean you're right, this code is valid(i have been using it for years in another project). But when i have ported it into an new project and after splitting the two classes the corruption takes place. Did you use two *.h and *.cpp file, or did't you implement them in a single file.
Saurabh.Garg wrote: This cannot be true because if you comment out this line then you will have to comment it in wrapper's constructor and destructor. If you do that than the class do nothing so it cannot corrupt memory.
Correct, i commented the usage of the function pointer in the constructor and destructor. Maybe I shouldn't have showed them in this example.
Learn from the mistakes of others, you may not live long enough to make them all yourself.
|
|
|
|
|
Well I tried with separate files, just like you mentioned, and I tried within a single file and this code runs perfectly fine.
Btw I am using VS 2008.
-Saurabh
|
|
|
|
|
Saurabh.Garg wrote: Btw I am using VS 2008.
I'm still using VS 2005.
But I have found a way to get it working.
When i replace the forward class declaration with in including of the class,
everything works fine??
#pragma once
class functional;
#include "functional.h"
class wrapper
{
public:
wrapper(functional* pFun);
~wrapper(void);
void (functional::*pExitFunction)();
functional* _pFun;
};
Maybe its a bug in the VS 2005 compiler, I'm really not getting this.
Either way its working now,
thanks for the response anyway.
Learn from the mistakes of others, you may not live long enough to make them all yourself.
|
|
|
|
|
Hmmm thats interesting, it seems too simple to be a bug. Anyway its good you got it working.
-Saurabh
|
|
|
|
|
void Separate::WordSeparate1(ArrayList* start,ArrayList* end)
{
ArrayList** wordStart=new ArrayList*();
ArrayList** wordEnd=new ArrayList*();
IEnumerator *wordStartEnumerator,*wordEndEnumerator;
ArrayList** wordStart1=new ArrayList*();
ArrayList** wordEnd1=new ArrayList*();
}
the concept of double pointer is only available in vs2003....now i need to work this function in vs2005. how can i use the concept of double pointer in VS2005???
regards,
amit
|
|
|
|
|
Double pointers are still available, but this "new ArrayList*();" wont work. Use some kind of PointerList.
Greetings from Germany
|
|
|
|
|
|
Hi,
I'm having a problem creating a CDialog in a dll. The dll adds a menu entry to explorer context menus and executes some action when user clicks on menu entry. It should display a dialog (derived from CDialog). The dll had enable-MFC checkbox checked in the new-project wizard. But there's a problem with the resource handles. When the dialog is created it gives an assert in this code in AFXWIN1.INL:
_AFXWIN_INLINE HINSTANCE AFXAPI AfxGetResourceHandle()
----> { ASSERT(afxCurrentResourceHandle != NULL);
return afxCurrentResourceHandle; }
|
|
|
|
|
put the following code before you create the dialog.
AFX_MANAGE_STATE( AfxGetStaticModuleState());
|
|
|
|
|
Many thanks, it worked!
|
|
|
|
|
Please refer here[^] for more information.
Regards,
Paresh.
|
|
|
|
|
I have created and project in MS visual studio 6.0 as below
#include "stdafx.h"
#include <iostream.h>
class Rational
{
double r;
public:
Rational(int numerator, int denominator)
{
r = numerator/denominator;
}
operator double()const
{
cout<<r<<endl;
}
};
int main(int argc, char* argv[])
{
Rational r(1,2);
cout<<r;
cout<<endl;
return 0;
}
It works fine.
But when I build the same in MS visual studio 2005, the following error comes
1>c:\problemimplicittypeconversion\implicittypeconversion.cpp(5) : fatal error C1083: Cannot open include file: 'iostream.h': No such file or directory
How to rectify this problem
VIBIN
"Fool's run away,where angle's fear to tread"
|
|
|
|
|
Change to
#include <iostream>
using namespace std; // and add this line if you don't want to write std::cout everytime
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
|
|
Is vc 2005 express edition?
--
"Programming is an art that fights back!"
|
|
|
|
|
vibindia wrote: How to rectify this problem
Have you checked if the file exists or not?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
hi friends
I am an application programmer, now i want learn threading concept in VC++ ..please guide me ..how to study and please give some sample application ...and also how to communicate client to server ...please give one sample ....
thanks n advance
Nisha
|
|
|
|
|
The search functionality on CP is still active and you can search on google too. Just put Threading as the keyword in the search field
If you need to write some sample for your understanding, you can simply create two threads and do some task like moving an image, counting numbers and printing them on screen etc etc...
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
|
|
Codeproject has lot of good articles about it.
|
|
|
|
|
atlsmtpconnection.h is available in VS 2005 but not in VS 2008. Also I am not able to find other classes like CMimeMessage etc in VS 2008. Does anyone have any idea whether I need to install anything else to get these classes?
the fruits of your success will be in direct ratio to the honesty and sincerity of your own efforts in keeping your own records, doing your own thinking and, reaching your own conclusions.
..surviving in autumn..in love with spring..
|
|
|
|
|
Hello everyone,
If there is an arbitrary address (e.g. 0x12345678), how to check whether it is code or data or stack? Any command to display the information (suppose I have symbol file) in the arbitrary address? Could we use WinDbg tool?
thanks in advance,
George
|
|
|
|
|
Will the PEDUMP tool do the job for you?
« Superman »
|
|
|
|