combination a;
a.make_combinations(0);

If your combination class has member m_progress which you are initializing in OnButton2() function. But to call
make_combinations fucntion you are creating another object of class combination whose m_progress is not yet initialized.

see this code

void combination::OnButton2()
{
    // TODO: Add your control notification handler code here
    m_progress.SetRange(0,100); // first set range
    m_progress.SetPos(0); // then set position
    make_combinations(0);
}

Making member private make them hidden from outside world. So that only class's public member(which is only accessible from outside world) can modify them. Which is called abstraction in OOP.

This is the great feature defined by OOP and adopted by c++, c#, java like languages. Hiding data member prevents accidental modification of data member which is very normal thing.

Say for example you as a software company buy a third party DLL by spending huge amount of money, which provides you lots of classes for graphics manipulation . What if they dont make thier data member private and your developer changes them wrongly and your graphic software crashes. Will you blame the third party that their classes are not working properly. To prevent such kind of obious situation if third party make data members of class as private and expose some public methods which adds validation of data that you are accidentally providing wrong can handle a lot critical errors.

Providing public methods to access private data called encapsulation in OOP.

Banfa commented: Good explaination, encapsulation is 1 of the 3 main tenents of OOP the other 2 being inheritance and polymorphism +0

As per my knowledge due to some security issue on vista and above os's SendMessage and PostMessage Api are disabled if they used to send message across process. You can use this API to send msg within process, parent wnd to child wnd. We had faced same problem. To overcome this we used pipes and memory mapped files.

Thanks a lot for reply.

Hi Guys,

Is this right to say Heap is RAM and Stack is Pagefile(HardDrive)? Sorry for silly question. :?:

MSDN documentation is good enough for MFC classes instead of looking books for them.
[URL="

[COLOR="Red"]i got this error: "Error 1 error C2146: syntax error : missing ';' before identifier 'word' in "base.h" " in visual 2008[/COLOR]

the error you are getting for "string". you will need to tell the compiler where string is defined. cin, cout are defined in iostream.h header file under namespace [B]std[/B]. Also string is defined under std namespace.

include <iostream> first in your base.h

If you have support to MFC library then you can use CImage class. Its very easy to saving image as jpeg using CImage. Just pass handle to bitmap to CImage or load it from hard drive. Call Save function and specify jpeg as saving type.

jonsca commented: Good idea +5

Nice said mike.... Really valuable information

[URL="

Most probably you have defined entry point in linker advance setting in visual studio 2008. Make sure there is no additional entry point.

ok. So what i am doing in second case is completely invalid and by luck it is working.
Thanks to both of you for solving.

[CODE]class Base
{
public:
void virtual test()
{
cout << "Base Test";
}
};

class Derived : public Base
{
int i;
int j;
public:

void test()
{
    cout << "Derived Test";
}

void testD()
{
    i = 8;
    j = 9;
    cout << "Derived TestD";
}

};

int _tmain(int argc, _TCHAR* argv[])
{

Base* pBase = new Base();

// Case 1:
Derived* pDerived = dynamic_cast<Derived*> (pBase);

//this is causing crash (access violation). Perfectly valid derived dont have memroy for its data member
pDerived->testD();

// Case 2:
Derived* pDerived1 = static_cast<Derived*> (pBase);

//not causing crash (access violation). Executing fine. what is the reason????
pDerived1->testD();

return 0;

}[/CODE]

still working.

Actually my question is not related to virtual function. I just want to cast derived object to base object. Base doesnt know about derive. derived know about base. So derived's object in memory will have upper portion made of base and lower portion of itself.
Now if i am forcefully casting base pointer to derived then derived will have only upper portion that is of base not its own. So if there is no derived portion then its data member also wont have memory. So calling testD() function is valid because function gets separate shared memory in address space of process. I added 2 data members and modifying them in testD(). If derived dont have memory allocated to it then how its data member get modified.

Hi,

I am just trying to do some down casting.

here is the code.

[CODE]
class Base
{
public:
void virtual test()
{
cout << "Base Test";
}
};

class Derived : public Base
{
int i;
int j;
public:
void testD()
{
i = 8;
j = 9;
cout << "Derived TestD";
}
};

int _tmain(int argc, _TCHAR* argv[])
{

Base* pBase = new Base();

// Case 1:
Derived* pDerived = dynamic_cast<Derived*> (pBase);

//this is causing crash (access violation). Perfectly valid derived dont have memroy for its data member
pDerived->testD();

// Case 2:
Derived* pDerived1 = static_cast<Derived*> (pBase);

//not causing crash (access violation). Executing fine. what is the reason????
pDerived1->testD();

return 0;

}
[/CODE]

[B]pDerived1->testD();
not causing crash (access violation). Executing fine. what is the reason????[/B]

Yes, #include "windows.h"

This will solve your problem
[CODE]HWND console = GetConsoleWindow();
RECT ConsoleRect;
GetWindowRect(console, &ConsoleRect);

MoveWindow(console, ConsoleRect.left, ConsoleRect.top, 800, 600, TRUE);[/CODE]

Are you creating Win32 GUI application?

If yes, in your
HWND CreateWindow( LPCTSTR lpClassName,
LPCTSTR lpWindowName,
DWORD dwStyle,
int x,
int y,
int nWidth,
int nHeight,
HWND hWndParent,
HMENU hMenu,
HINSTANCE hInstance,
LPVOID lpParam
);
function set the nWidth and nHeight parameter.

To adjust size of your console window, only modify the size of cmd.exe console.
Because implicitly cmd.exe provides console to our exe

Here is the steps:

  1. Goto Run
  2. type cmd
  3. Right click on TitleBar
  4. Goto Property
  5. Set the height and width as per your requirement
  6. Press OK and Check option "Save properties for future windows".

Hi,
My Application's icon is not getting displayed after disabling "System Menu" option from Dialog Property. I don't want to use the system menu and close button.

See the attachment for detail.

[URL="

hi,
I misunderstood your problem.

Here you will not receive wParam for WM_MOUSEWHEEL notification.

lparam->MOUSEHOOKSTRUCT will contain the handle to window which will receive the mouse message corresponding to the mouse event.

Refence taken from MSDN
wParam
The high-order word indicates the distance the wheel is rotated, expressed in multiples or divisions of WHEEL_DELTA, which is 120. A positive value indicates that the wheel was rotated forward, away from the user; a negative value indicates that the wheel was rotated backward, toward the user.

That is not the solution. Donald was asking right question.
There is only two way
1st is to build ur binary with static link to MFC dll or
2nd U will need to ship MFCVC80.dll with ur binary

may be this help
[URL="

[QUOTE]Thanks, but I won't be able to use it since I was never taught the std:: or &. [/QUOTE]
std is namespace in which cin is defied. If you specify [CODE]using namespace std[/CODE] you dont need to write std:: .
See the signature of [B]get[/B] function. For[B] &[/B] do some googling.

[QUOTE=mattjbond;1198804]I wonder how people are supposed to learn anything if we just give em answers verbatim? Why not gently point people in the right direction and let them find the solution by themselves?[/QUOTE]
this is the forum in which we try to solve problem of those people who shows effort. I did that nothing else. dont wonder.

here is the solution

[CODE]
char c;
std::cin.get(&c, 2, '\n');
[/CODE]

You can try PCRE library also which is compatible with c++.

what is content of your batch file?