I've some dialogs that I use as child dialogs in a FormView driving them with a TabControl.
My problem is that when dialogs are shown, they doesn't catch events like mouse click, so that
the user cannot handle any control inside the window.
If I switch the windows property from Child to Popup any control works properly but the windows are
not shown correctly within the TabControl.
So.. how can I let all events work fine for child dialogs ?
My only thought is that the windows are visible, but disabled.
Use Spy++, and check the WS_VISIBLE / WS_DISABLED for the windows involved.
I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need contract work done, give me a job! http://cv.imcsoft.co.uk/[^]
I have a static class I use for caching data. This will now be accessed from multiple threads which means I need to add a CRITICAL_SECTION to make updating the cache thread safe. I now have the problem of who initialises the CRITICAL_SECTION given a static class doesn't have a constructor.
static std::map<int,std::string> m_cache_map;
static CRITICAL_SECTION m_critical_section; //<-- Where do I initialize this?public:
std::string read(int index)
// Add value to cache// Adjust iterator
// The following call could be issued by multiple threads
Instead of having all members static, you could use a singleton pattern: it is a design pattern that makes sure your class is created only once. I won't go into much details here but I suggest you google for "Thread safe singleton pattern". Basically, you add a public static function that returns a pointer to your single instance (CMY_CACHE* CMY_CACHE::instance for example).
Once your class is a singleton, you can simply create your critical section in the class constructor. Your read method is no more a static function and you call it this way:
The idea that I can be presented with a problem, set out to logically solve it with the tools at hand, and wind up with a program that could not be legally used because someone else followed the same logical steps some years ago and filed for a patent on it is horrifying.
- John Carmack
I have a project (VS6 C++ MFC) and my 'project.rc' file appears to be corrupted or somehow has missing data - all has been working fine until recently, is there any easy way to recover the missing data?
Yeah I perhaps should have mentioned that when I try to open the resources for the project in the resource view I get a "Guideline must specify type" message whatever that means. Also I have an older version of the file which has lines missing that I am pretty sure aren't due to any of my edits
Please have a look at the link I posted, perhaps you can find something that fits your needs. If you want to write a GUI application with networking it could be worth to have a look at event-based examples (e.g. using MFC's CAsyncSocket) it saves you the hassle of using threads and locks.
Btw, there are other socket libraries than MFC out there:
That's a big number to find the factorial of! You won't be able to do it with the existing datatypes, and normal arithmetic techniques. But you could use something like the BigNum[^] library. It is an excellent library and has been around for a while.
FYI, I just calculated the factorial of 10000 online (using BigNum) and the answer is: here[^]
I just want to get an idea, not the source code.
FYI, BigNum is free of cost and open source (LGPL).
2- can you translate that into code ?
2.5- did you even try something ?
Unfortunately I think that in this specific case, just translating the factorial logic into code simply won't work. If we use the datatypes that are available to us, and assuming that we use a 64 bit unsigned integer, the largest number that it can hold would be barely sufficient to hold the value of 20 factorial. For holding the resultant value of the computation of 40 factorial, there are no datatypes offered by the tools and languages used usually (it would be larger than what an 128 bit integer can hold!)
And the OP wants to find the factorial of not 40, but the factorial of *cough* 10000. The way I know of is to use arbitrary precision arithmetic and the OP didn't know it. He just wanted to know how to get started with it.
However, I do agree with you that he could have done a bit of Googling around.
“Follow your bliss.” – Joseph Campbell
Last Visit: 31-Dec-99 18:00 Last Update: 27-Sep-23 15:32