Thanks Pallini, This is one approach, other than this do we have another approach available. Regards, Nandu
Nandu_77b
Posts
-
Need best approach to use a class inside other class -
Need best approach to use a class inside other classI have a base class say “ClassBase” and I have derived two classes “Classdrv1” & “Classdrv2” from base class as shown below. Now I am not sure how to use class “Classdrv2” in “Classdrv1”. For this implementation there should not be any code change in base class. What is the best approach for the same? Class ClassBase { } class Classdrv1 : public ClassBase { // need to use classdrv2 here, how? } class Classdrv2 : public ClassBase { } Thanks, Nandu
-
How to build "debug" and "release" in one command line for VS2008To build a solution, you can simple pass in the path to the solution file and optionally a configuration, such as debug or release. Projects are compiled by using the Project switch, and you can build one project at a time, also optionally specifying the configuration to use. The syntax to use is: devenv solutionfile.sln /build [solutionconfig] [/project projectnameorfile [/projectconfig name]] My question is, 1)if we dont specify configuration either "debug" or "release" as it is optional, will it build both debug and release or any one (debug or release) by default. 2) Any idea how to build both "debug" and "release" in one command line. Thanks, Nandu
-
Diference between hash_map and hash_multi map. how to implement hash_multimap in VS2008 (for C++)- I tried the below and got the error: ommb.h(398) : error C2065: 'hash' : undeclared identifier #include #include //maha using namespace std; //maha using namespace stdext; //maha struct eqstr { bool operator()(const char* s1, const char* s2) const { return strcmp(s1, s2) == 0; } }; typedef hash_multimap, eqstr> map_type; void lookup(const map_type& Map, const char* str) { cout << str << ": "; pair p = Map.equal_range(str); for (map_type::const_iterator i = p.first; i != p.second; ++i) cout << (*i).second << " "; cout << endl; } 2) then i tried changing the type def to typedef hash_multimap test; and below is the error: error C2903: 'rebind' : symbol is neither a class template nor a function template C:\Program Files\Microsoft Visual Studio 9.0\VC\include\xhash(148) : see reference to class template instantiation 'stdext::_Hmap_traits<_Kty,_Ty,_Tr,_Alloc,_Mfl>' being compiled with [ _Kty=const char *, _Ty=CCommNode *, _Tr=functorHashString, _Alloc=functorEqualStrings, _Mfl=true ] C:\Program Files\Microsoft Visual Studio 9.0\VC\include\hash_map(182) : see reference to class template instantiation 'stdext::_Hash<_Traits>' being compiled with [ _Traits=stdext::_Hmap_traits Can any please help me where i am going wrong. Thanks, Nandu
-
Diference between hash_map and hash_multi map. how to implement hash_multimap in VS2008 (for C++)Hi, What is the difference between hash_map and hash_multimap? Can you please help me in implementing hash_multimap in VS 2008 (for C++) with Key as const char* Value as Class (some class say mycalss). After implementation how to insert the values? Thanks, nandu
-
error C2487error C2487: 'CSingleton<T>::ms_pSingleton' : member of dll interface class may not be declared with dll interface When I try to compile the below code in VS2008 above is the error. I am not sure hw to fix this, as the class is not exported (i am getting this error even when i try to export the member alone). So please suggest me a better solution. template <typename T> class CSingleton { private: ExportSlotCoreLib static T* ms_pSingleton; CSingleton(const CSingleton&); protected: CSingleton() { //assert(ms_pSingleton == NULL); int offset = (char*)(T*)1 - (char*)(CSingleton <T>*)(T*)1; ms_pSingleton = reinterpret_cast<T*>(reinterpret_cast<char*>(this) + offset); } ~CSingleton() { //assert(ms_pSingleton != NULL); ms_pSingleton = NULL; } public: static T& GetSingleton() { return (T&)*ms_pSingleton; } static T* GetSingletonPtr() { return ms_pSingleton; } }; Thanks, Nandu
-
About creating and hiding window in win32What will happen or what will be the problem if I hide and create window as mentioned above. Why we should go that way and problem it will cause and why is it a bad idea?
-
About creating and hiding window in win32As I mentioned mywindow2 is not a child of mywindow1. mywindow2 is total a separate window.
-
About creating and hiding window in win32I have created a win32 application, in which a window is created say mywindow1 and after that I am creating other window in the same application say mywindow2. Based upon some condition Mywindow2 is created, if the condition is not satisfied mywindow2 will not be created that is fine (no problem with this scenario). But when Mywindow2 is created it is not a child of mywindow1. While creating the mywindow2 I am using findwindow(null, “mywindow1”) method to get the handle and then using hidewindow(mywindow1hndl) mywindow1 is hided. Now my question is, finding a window handle using window name and hiding the window is a good idea or not in the real time application. Will this create a problem in the future? If not what is the best way to do it? Thanks, Nandu
-
Issue in porting code from VS6.0 to VS2008 [modified]Thanks, I got the answer. In VS6.0 Client(const &Client); compiles fine, where as in VS2008 it throws compilation error. For VS2008 it should be Client(const Client&); - For copy con -Nandu
-
Issue in porting code from VS6.0 to VS2008 [modified]Hi, class Client; Client(const Client&); The above code compiles fine with VSC++6.0, when same is compiled with VSC++ 2008 throw’s the following is the compilation error "error C4430: missing type specifier - int assumed. Note: C++ does not support default-int" Then I have changed the code as below, it got compiled with VSC++ 2008. Client(const &Client); So can any one help me what is the cause of the problem and whether this "Client(const &Client); " is correct approach. Thanks, Nandu
modified on Friday, September 18, 2009 7:48 AM
-
Function out of scopeHi, In the below code ret value become invalid as it comes out of the funcation scope. can any suggest better idea to solve this. CString ToStr() { CString ret = "test"; return ret; } void fun() { CString val = ToStr(); // it returns nothing (bad pointer) } I have compiled this code in MS VC++2005 under winxp OS. Thanks, Nandu
-
const TCHAR* to TCHAR*Thank you to all.
-
const TCHAR* to TCHAR*Which is the right way to do and why? TCHAR *gClassName = 0; bool CreateCabinetMainWindow(const TCHAR* classname) { DeleteCabinetMainWindow( ); gClassName = (TCHAR*)classname; } OR const TCHAR *gClassName = 0; bool CreateCabinetMainWindow(const TCHAR* classname) { DeleteCabinetMainWindow( ); gClassName = classname; } Thanks in advance, Nandu
-
VS 2008, error C4430class base { protected: base(){} base(const&base) {} }; int _tmain(int argc, _TCHAR* argv[]) { base obj; return 0; } Even if the above case same error.
-
VS 2008, error C4430Constructor can have return type?
-
VS 2008, error C4430class base { protected: base(const&base) {} }; When the above code is compiled with VS 6.0 compiles without any error, but if the same is compiled in VS 2008 following is the error “error C4430: missing type specifier - int assumed. Note: C++ does not support default-int” Can you please let me know what causes this error.
-
error C2664 in VS2005 VC++std::list < xlong > ClientConfig:: GetHistory(int id) { .... doing something .... return 0; } When the above code is compailed in VS 2005 (VC++), following is the error error C2664: 'stlp_std::list<_Tp>::list(const stlp_std::list<_Tp> &)' : cannot convert parameter 1 from 'int' to 'const stlp_std::list<_Tp> &' with [ _Tp=xlong ] Reason: cannot convert from 'int' to 'const stlp_std::list<_Tp>' with [ _Tp=xlong ] Constructor for class 'stlp_std::list<_Tp>' is declared 'explicit' with [ _Tp=xlong ] resdata.cpp I tried to return xlong value, but still getting the same error Can any once help to fix the same
-
error C2664 with VS 2005std::list < xlong > ClientConfig:: GetHistory(int id) { .... doing something .... return 0; } When the above code is compailed in VS 2005 (VC++), following is the error error C2664: 'stlp_std::list<_Tp>::list(const stlp_std::list<_Tp> &)' : cannot convert parameter 1 from 'int' to 'const stlp_std::list<_Tp> &' with [ _Tp=xlong ] Reason: cannot convert from 'int' to 'const stlp_std::list<_Tp>' with [ _Tp=xlong ] Constructor for class 'stlp_std::list<_Tp>' is declared 'explicit' with [ _Tp=xlong ] resdata.cpp I tried to return xlong value, but still getting the same error Can any once help to fix the same
-
Add support for Memory leak detectionThanks, But the above mentioned will not support VS6.0, I need a similar solution for VS 6.0 -Nandu