visual-c++

no appropriate default constructor available . (when creating a child class)

I am creating some custom exception classes doing the following class GXException { public: GXException(LPCWSTR pTxt):pReason(pTxt){}; LPCWSTR pReason; }; class GXVideoException : GXException { public: GXVideoException(LPCWSTR pTxt):pReason(pTxt){}; LPCWSTR pReason; }; When I created GXVideoException to extend GXExcep...

Any Alternate way for writing to a file other than ofstream

Hi All, I am performing file operations (writeToFile) which fetches the data from a xml and writes into a output file(a1.txt). I am using MS Visual C++ 2008 and in windows XP. currently i am using this method of writing to output file.. 01.ofstreamhdr OutputFile; 02./* few other stmts */ 03.hdrOutputFile.open(fileName, std::ios::o...

Is stack address shared by Heap addresses ??

I read On most operating systems, the addresses in memory starts from highest to lowest. So I am wondering if the heap, stack, and global memory all fall under the same ordering..? If I created... pointerType* pointer = new pointerType //creates memory address 0xffffff And then created a local varible on the stack localObject objec...

How to change the text color in a disabled edit box using MFC?

Hello all, I have a dialog in which the edit box is disabled but the text should be displayed in red instead of the default grey. I tried the following: void CMyEdit::OnEnable(BOOL bEnable) { CEdit::OnEnable(bEnable); if (bEnable) { m_BackGroundColor = kRGBWhite; } else { m_BackGroundColor = kRGBDefaultGray; } ...

Crash with new/delete, but not with malloc/free in C++ code

My developement environment is [Windows 7; visual studio 2010; x86]. I have a dll that was built for server 2003 long time back. When I use it in my project and follow new/delete sequence to use a class, application crashes during delete call. I verified the same even without any other call between new and delete. When I replace new/del...

Create and use HTML full text search index (C++)

I need to create a search index for a collection of HTML pages. I have no experience in implementing a search index at all, so any general information how to build one, what information to store, how to implement advanced searches such as "entire phrase", ranking of results etc. I'm not afraid to build it myself, though I'd be happy t...

how to convert char array to wchar_t array ?

char cmd[40]; driver = FuncGetDrive(driver); sprintf_s(cmd, "%c:\\test.exe", driver); I cannot use cmd in sei.lpFile = cmad; so, how to convert char array to wchar_t array ? ...

code of ftp upload in C++

I m trying to upload my files to the ftp server through coding. And I want to bind that code with my searching application. ...

Convert unicode character to corresponding text ?

Hi All, I want to know is there any way to convert unicode char to its text rather than using static map ? e.g. $ -> Dollar Sign , A - >Latin Capital Letter A I wish to do exactly same as charmap.exe utility. Thanks in advance... ...

does DEFINE Macro work on all platforms ???

I am a newb and I am trying to better myself at good practice and design so consider this before reading the following. I am creating a singleton class, and I have quite a few static members. Instead of calling the members every time like this... THECLASS::member I was thinking about using a define macro to make it shorter. #define...

How do I get the pixel color under the cursor?

I need a fast command line app to return the color of the pixel under the mouse cursor. How can I build this in VC++, I need something similar to this, but ideally not in .NET so it can be run many times per second? ...

Changing the "debugging / working directory" globally (not per-user) in VS2008

I have a C++ solution in VS2008 with multiple projects. This solution contains files that are needed at runtime, which are loaded according to a path relative to the solution directory (e.g. "Testing/data/" + "dataN.bin"). In order for this solution to work, I must set the working directory setting in the project(s) so that it will poin...

Error Msg: cannot convert parameter 1 from 'Node *' to 'Node'

I'm writing an expression tree. The Node class has instances of itself as members left, right and parent. Thanks to James McNellis in this post, I declared them as pointers. class Node { public: char *cargo; int depth; Node *parent; Node *left; Node *right; //constructors/destr...

Different ways of loading DLL into MFC?

Hi What are the different ways to load a win32 or MFC DLL into an MFC application? I know there are 2 ways to link a DLL. 1.) Include the lib file created with the DLL 2.) Using .def file and LoadLibrary function. Is there any other ways to link the DLL? Regards, AH ...

MSVC++ erroring on a divide by 0 that will never happen! fix?

const int bob = 0; if(bob) { int fred = 6/bob; } you will get an error on the line where the divide is done: "error C2124: divide or mod by zero" which is lame, because it is just as inevitable that the 'if' check will fail, as it is the divide will result in a div by 0. quite frankly I see no reason for the compiler to even eval...

how costly are call backs ??

I am creating a Rendering Engine. And theres 2 ways of me creating a task management system. Creating my own custom call backs that get called before and after render, Or implementing a task management system in which I would have to derive a class from a parent TaskClass and then throw it into queue. Honestly I feel creating callbacks ...

pure C++ vs Managed C++

How to build pure C++ application so that it doesn't have any dependencies? i am using VS 2008. I mean, dependencies like dotnetfx framework, etc, other things required by managed C++ programs. ...

How to send toolbar message from c++?

I am creating a Internet Explorer 6 plugin using VC++. I would like to know, how can I send messages like TBN_TOOLBARCHANGE from my C++ ? ...

PostThreadMessage to another process

I want to post a message to a thread that is running as another process (in particular as a windows service). I've read the documentation for PostThreadMessage but there are some things unclear for me. How do I get a handle for my service's thread? The system only does marshalling for system messages (those in the range 0 to (WM_USE...

How do I show and hide forms in Visual C++?

Hey guys, I'm brand new to Visual C++, but not C++. I'm having issues trying to figure out how to show/hide forms. Let's say I have a form Form1 and another form TestForm. In a button click function in Form1.h I have the code: Form1::Hide(); TestForm^ form = gcnew TestForm(); form->Show(); And it works fine. I click the button, and F...