In my destructor, I have to clean up a few resources. Let say I have three calls to clear resources that could throw. Since it is not good for letting an exception to leave a destructor, what should be my design pattern? Apparently the way below is not scalable.
Thanks.
class B::~B(){
try{
clearResourceA()
}
catch{
try{
...
Quoted from here:
Size of the incoming signal, expressed
through the Win32 SIZE structure as
the image rectangle's width and height
in pixels.
For a compressor, the size is taken
from the width and height members of
the Win32 BITMAPINFOHEADER structure
in the input pin's AM_MEDIA_TYPE
structure.
For a capture ...
Is it possible to toggle a window between modal and non modal after it is visible?
This is what I need... call a method passing the window handle and set if I want it to be modal or not.
If possible, any sample will help a lot!
.net, c++ etc
thanks!
EDIT:
Why?
In this case, I'm using TWAIN to scan images, and "some" data sources doe...
Hi!
I can't seem to find any walk-trough on how to create a MFC DLL using Visual Studio 2008. My problem is the following. I need to use wininet.h with my DLL and my solution to that was to use MFC DLL. Anyhow trying to link my project gives me 5 Link errors
I believe that the error is of a kind that I need to add Additional Library Dire...
Hi,
I would like to write Nodes like
<name>Peter</name>
(with start and end tag) into a QDomDocument.
When I create QDomElements and append them as child to a parent element:
QDomElement node = doc.createElement("node");
parent.appendChild(node);
They are added as
<node/>
to the parent element. The parent automatically gets ...
I've recently started reading Modern C++ Design by Andrei Alexandrescu. After reading Compile-Time Assertions, I tried the following code:
template<bool> struct CompileTimeChecker
{
CompileTimeChecker(...){};
};
template<> struct CompileTimeChecker<false>{};
#define STATIC_CHECK(expr, msg) \
{\
class ERROR_##msg{}; \
(void...
I tried googling this, but I was unable to come up with a suitable answer. Could any C++ gurus tell me why C++ requires you to declare OuterClass<T>::Innerclass with the typename keyword?
I am a TA for a data structures course and I see this error all of the time. I know to tell my students that they need to put typename in front of th...
Hello,
I am a beginner at C++ and I'm trying to use the getline() function for the first time.
When I wrote this code, 2 errors showed up.
What is this code supposed to do?
It is supposed to read 4 numbers from read.txt then calculate it to find the mean and write the output in output.txt.
The 4 numbers (in read.txt) are all on separ...
I am trying to create an application to detach a secondary monitor from Windows boxes (long story).
Here is Microsoft's sample code that I used as a basis:
http://support.microsoft.com/kb/308216/en-us
Here is my code:
#include <iostream>
#include <windows.h>
void DetachDisplay()
{
BOOL FoundSecondaryDisp = FALSE;
D...
Hi, I am using Visual studio 2008.
For below code
double main()
{
}
I get error:
error C3874: return type of 'main'
should be 'int' instead of 'double'
But if i use below code
char main()
{
}
No errors.
After running and exiting the output window displays
The program '[5856] test2.exe: Native'
has exited with code -8...
Possible Duplicate:
pointer to a specific fixed address
An interesting discussion about this started here but no one have been able to provide the C++ way of doing:
#include <stdio.h>
int main(void)
{
int* address = (int *)0x604769;
printf("Memory address is: 0x%p\n", address);
*address = 0xdead;
printf("Content o...
My question is pretty much the title.
Example
#include <iostream>
int main()
{
using std::cout; //legal?
{
using std::cin; //legal?
}
}
...
Is there a way (in C++ & windows XP) to detect if one process spawns any other processes?
for example,
write.exe in system32 spawns wordpad.exe then disappears, is there a function that tells me if the process is about to do this?
for those interested i solved the problem using this section of msdn:
http://msdn.microsoft.com/en-us/lib...
I have written a function template and an explicitly specialized templated function which simply takes in 3 arguments and calculates the biggest among them and prints it.
The specialized function is causing an error,whereas the template works fine.
But I want to work with char* type.
This is the error I get=>
error: template-id ‘Max<>...
I was having a discussion about the relative cost of fork() Vs thread() for parallelization of a task.
We understand the basic differences between processes Vs Thread
Thread:
Easy to communicate between threads
Fast context switching.
Processes:
Fault talarance.
Communicating with parent not a real problem (open a pipe)
Communica...
Hi all,
In Effective C++ (3rd edition), Scott Meyers, in Item 31, suggests that classes should have, on top of their classic Declaration (.h) and Definition (.cpp) files, a Forward Declaration Include File (fwd.h), which class that do not need the full definition can use, instead of forward declaring themselves.
I somewhat see the case...
How to exclude pointer from boost::ptr_vector without his deletion? =)
...
Is there a way in c++ to convert from ö to o, or ß to s, in general from utf-8 to the corresponding char from ASCII ?
...
While reading this, I'm confused with the following examples:
// Example 2: Explicit specialization
//
template<class T> // (a) a base template
void f( T );
template<class T> // (b) a second base template, overloads (a)
void f( T* ); // (function templates can't be partially
// specialized; they overl...
I'm working on a problem where I need to have a way to convert a user inputted filename to a unique path name. Let's say I let the user specify a path name that points to a file that contains some data. I can then do Data* pData=Open(PathName). Now if the user specifies the same path name again, I'd like to be able to have a table of ...