|
What do you mean by "called exactly once"?
You wanna prevent from "calling the dll function for a second time", or just make no
effect when "calling the dll function for a second time"?
|
|
|
|
|
You could try sticking the code you want executed exactly once in the DllMain for the DLL. Unfortunately there are some restrictions as to what can go in DllMain - don't do anything that might trigger another DLL load or it could go horribly wrong.
Another option is to create an initialisation function and either just call it once or use a language feature of C# to make sure it's only called once. I don't know C# and it's idioms enough to suggest a relevant feature. You can make sure your initialisation function is only called once in the DLL using something like:
extern "C"
bool FOO_EXPORT initialise_foo_lib()
try
{
static bool initialised = false;
if( !initialised )
{
initialised = true;
}
return initialised;
}
catch( std::exception & )
{
return false;
}
Cheers,
Ash
|
|
|
|
|
Hi,
would anyone if I can get Crect structure/CLass from the current selection
I would like to create Rgn to paint the Background of a bitmap displayed on my Richeditctrl
thankx
|
|
|
|
|
I'm assuming you're using MFC.
The CRichEditCtrl class has a method called GetSel which returns the index to the starting and ending characters in the selection.
Now use CRichEditCtrl::PosFromChar on the starting and ending characters to get their X and Y positions.
You can now build a CRect using the 2 CPoint structures returned.
|
|
|
|
|
Thankx
To create a region then to fill the background, I am going to try it, but I think I'll have to do ClienttoScreen afterwards since the regions is a area of the display
|
|
|
|
|
|
Thanx I going to try Supermans method
to fill the background then yours
thankx again
|
|
|
|
|
Hello,
I need to know about good C++ Reflection API(Would be better if Microsoft API is available) which enables me to determine the types(classes,structs,enums,ints,float,doubles...)identification at run time, declaring them and finally to call methods on those types at run time too.
Regards
Usman
|
|
|
|
|
Don't think that exists for C++.
see lengthy discussion on stackoverflow[^]
Watched code never compiles.
|
|
|
|
|
There isn't a good one - if you want to do Java style "create from arbitrary string" or "call method by string" then you won't be able to do it generally. If you're only interested in a subset of classes that you want to handle like that then have a look at the factory and abstract factory patterns, they might be enough for what you want, as might be COM (create an object by name, see if that object supports a particular interface) or CORBA.
Cheers,
Ash
|
|
|
|
|
Go managed.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Sorry ,but C++ types runtime information is very limited.You could only get C++ clas instance type like this sample but calling a methods at runtime is not possible in general.
Life is a stage and we are all actors!
|
|
|
|
|
As other said before, this is not possible to do in C++. However, if you explain what exact situation you are trying to handle we might be able to suggest you an appropriate solution.
|
|
|
|
|
May be this is not what you want, but qt c++ framework do that.
|
|
|
|
|
Hi, is there any technics (owner draw class, function, subclass method and so on) to change backgroud color of datetimecontrol
Thank you
viliam
|
|
|
|
|
Check out the WM_CTLCOLOR , and related, messages.
If that does not work, you might look at the DTM_SETMCCOLOR message. Or, subclass the control and handle the WM_ERASEBKGND and WM_PAINT messages.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
WM_CONTROL is not called for this type of control
viliam
|
|
|
|
|
viliam wrote: WM_CONTROL is not called for this type of control
I've not ever heard of that message. Is it new?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Sorry, my typing error. I should be WM_CTLCOLOR
viliam
|
|
|
|
|
viliam wrote: Sorry, my typing error.
Don't "type" your code here. Please copy and paste!
Workout progress:
Current arm size: 14.4in
Desired arm size: 18in
Next Target: 15.4in by Dec 2010
Current training method: HIT
|
|
|
|
|
Hi,
Does anyone know how to load a map of maps? I've declared the map of maps as follows:
map<double,map<double,double>> a;
As a simple example, I'd like to load the following (in reality I'll be loading this format for nearly 500,000 entries):
0.0 1.57 2.65
0.5 0.00 3.21
1.0 6.52 0.00
1.5 0.17 4.54
The first column is the key (it is time in seconds).
Thanks,
|
|
|
|
|
you're using a map to store a matrix ?
Watched code never compiles.
|
|
|
|
|
|
For storing a matrix like this wouldn't a better representation be:
std::map< std::pair<unsigned, unsigned>, double > matrix;
and you can address the elements as:
matrix[ std::make_pair( 0, 0 ) ] = 0.5;
Cheers,
Ash
|
|
|
|
|
Use the Matrix[^] class from the Boost library.
|
|
|
|