|
Can anybody point me to an example or show me how to create a "Window Tiling Function" in an MDI application in MFC. I basically want the same functionality that you get when you do "Tile Windows Horizantally", "Cascade Windows" etc.
thanks
ali
|
|
|
|
|
In your mdi, find out what function that id for the actual menu item is mapped to, then look at the mfc source.
Who are all these people and what are they doing in my house?...Me in 30 years, inside a grocery store
bdiamond
|
|
|
|
|
Ali Niaz wrote:
I basically want the same functionality that you get when you do "Tile Windows Horizantally"...
Send a WM_MDITILE message and set wParam equal to MDITILE_HORIZONTAL .
Ali Niaz wrote:
..."Cascade Windows"
Send a WM_MDICASCADE message and set wParam equal to 0.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Hello,
Consider the following code:
<br />
class A<br />
{<br />
public:<br />
A() {}<br />
~A() <br />
{ <br />
static int i = 0;<br />
std::cout << "Destructor called " << ++i << " time(s)" <br />
<< std::endl;<br />
}<br />
};<br />
<br />
void main()<br />
{<br />
try<br />
{<br />
throw A;<br />
}<br />
catch(A ex)<br />
{<br />
} <br />
}<br />
When I run the code, the output is the following:
Destructor called 1 time(s)
Destructor called 2 time(s)
Destructor called 3 time(s)
Press any key to continue
I can figure why the destructor is called 2 times, but why is it called the 3d time???
Multiply it by infinity and take it beyond eternity and you'll still have no idea about what I'm talking about.
|
|
|
|
|
It has to do with how many times the object is being copied. If you replace the code with the following it will only call the destructor 2 times:
class A
{
public:
A() {}
~A()
{
static int i = 0;
std::cout << "Destructor called " << ++i << " time(s)"
<< std::endl;
}
};
void main()
{
try
{
throw A();
}
catch(A & ex)
{
}
}
[EDIT]
Here is a version that will only be called once:
class A
{
public:
A() {}
~A()
{
static int i = 0;
std::cout << "Destructor called " << ++i << " time(s)"
<< std::endl;
}
};
void main()
{
try
{
throw new A();
}
catch(A * pEx)
{
delete pEx;
}
}
[/EDIT]
John
|
|
|
|
|
Thanks, this solved my issue with handles getting closed to often
Multiply it by infinity and take it beyond eternity and you'll still have no idea about what I'm talking about.
|
|
|
|
|
Please, could someone explain me why there are errors in the following code?
#include <iostream>
#include <string>
using namespace std;
class Log
{
public:
explicit Log(const string& msg) { cout << msg << endl; }
};
int main()
{
string msg = "Hello, World!";
Log(msg.c_str()); // This Works...
Log(msg); // ... but this doesn't; Errors C2371 and C2512!
return 0;
}
I'm using VC++ .NET 2003.
Thanks in advance.
|
|
|
|
|
Hello,
I, once again, am wondering about some C++ thing. This time it is about the cleanup of thrown exceptions.
Consider the following code:
<br />
throw new CSomeException(ErrorNumber);<br />
<br />
catch(CSomeException *pEx)<br />
{<br />
}<br />
I want to know if the destructor is called when the catch-block is left, or does this lead to a memory leak?
Multiply it by infinity and take it beyond eternity and you'll still have no idea about what I'm talking about.
|
|
|
|
|
Bob Stanneveld wrote:
I want to know if the destructor is called when the catch-block is left, or does this lead to a memory leak?
It leads to a memory leak. If someone throws a pointer to an exception, it won't automatically be deleted.
Nathan Holt
|
|
|
|
|
Hello,
Thanks for the information.
Multiply it by infinity and take it beyond eternity and you'll still have no idea about what I'm talking about.
|
|
|
|
|
You can know this by yourself debugging. Put a breakpoint in your descructor, for exemple.
|
|
|
|
|
I know, but I'm always looking for an excuse to surf to codeproject.com
Multiply it by infinity and take it beyond eternity and you'll still have no idea about what I'm talking about.
|
|
|
|
|
Hello, I'm using VC++ .NET 2003 and I'm fairly new to it and to GUI programming in general. For my current project I need to interact with some legacy C code that uses character arrays for strings.
I was able to convert from a system::string to a character array using the "PtrToStringChars" method but I can't, for the life of me, figure out how to convert an old-school char array back into a system::string.
Oh and the reasoning is that basically I need to parse a textbox in my form, convert the contents to a char array for the c code, then take a char array returned by the c code and convert it back to a managed string to be displayed in another textbox on the form. Make sense?
So... how do I do it!?
|
|
|
|
|
Dear Friends,
I got a CString. What i want to find out is whether the first character in that CString is a Number (i.e 0 to 9). How can i do so ??
|
|
|
|
|
Use isdigit() .
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Yes, use IsDigit(), and you can reference the first character of a CString like a char array (ie mystring[0] )
[A brave person isn't always necessarily a smart person]
bdiamond
|
|
|
|
|
Yep
Multiply it by infinity and take it beyond eternity and you'll still have no idea about what I'm talking about.
|
|
|
|
|
Cool!! Didn't know you could access it like an array.
|
|
|
|
|
Does anyone know how to run a C# procedure that is located in a dll from a C++ .net dll?
Thanks
Max
|
|
|
|
|
Hello !
I just started DirectX programming (based on samples I found on several websites). In fact I want to make a game (so in fullscreen mode). Everything is ok for that part but the problem when using this exclusive & fullscreen mode is that you cannot debug anymore (the screen remains black when a break point is reached in your code).
So I wanted to first start by using a windowed game for debugging purpose. But there the problem is when I try to create the front buffer using CreateSurface (with CooperativeLevel flags set to DDSCL_NORMAL):
DDSURFACEDESC2 ddsd;<br />
ZeroMemory( &ddsd, sizeof( ddsd ) );<br />
<br />
ddsd.dwSize = sizeof( ddsd );<br />
ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT;<br />
<br />
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE |<br />
DDSCAPS_FLIP |<br />
DDSCAPS_COMPLEX;<br />
<br />
ddsd.dwBackBufferCount = 1;<br />
<br />
hRet = m_pDirectDraw->CreateSurface(&ddsd, &m_pFrontBuffer, NULL );
The function returns DDERR_NOEXCLUSIVEMODE ...
How can I solve the problem ??
|
|
|
|
|
I recall having that same problem before about breakpoints in fullscreen mode. I think you can alt+tab or something like that to get back to the development environment.
[A brave person isn't always necessarily a smart person]
bdiamond
|
|
|
|
|
No, in fact what happens is that when I reached a breakpoint, I can see the taskbar but the rest of the screen is still black (wathever I do, also using alt+tab...). This is quite annoying
|
|
|
|
|
You may want to invest in a second monitor. You can then run the IDE on the second monitor and debug your DirectX application on the first monitor.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
Mhh, yes that could be a solution but this project is just for spare time and so, I don't want to buy a second monitor just for that...
Isn't it possible to debug DirectX applications ????
|
|
|
|
|
cedric moonen wrote:
Isn't it possible to debug DirectX applications ????
I have had the same trouble debugging a fullscreen DX application with a single monitor. I don't think there is an easy way round this given a single monitor setup and the standard IDE.
There is a debugging tool called SoftIce. We use it at work to debug drivers and shared memory between applications. SoftIce has the advantage of freezing the applications and switching to its own debug screen (text driven screen). This would allow you to debug DX applications quite easily.
http://www.compuware.com/products/driverstudio/softice.htm[^]
Not sure on the cost of this though!
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|