I have the following C++ function definition, which I am trying to call through PInvoke from managed code:
bool FooBar(SIZE_T* arg1);
My managed declaration looked as follows:
[DllImport("mydll", SetLastError=true, CharSet=CharSet.Unicode)]
private static extern bool FooBar(ref uint arg1);
Some of you may notice the same bug I even...
In one of my applications I have a class which is responsible for user input. The default method of input is the console (keyboard), and I want to write some unit tests for it to make sure it is correct.
I am considering using the google-test framework for my unit testing, which makes it easy to automate all the testing. However, I ...
I am trying to make a C++ implementation of the board game Carcassonne. I am trying to make a tile object which has four sides and one of three basic terrains(field, road, city).
The best interface for tile creation I could think of was of the form:
City city;
city_city_city_city = new Tile(city, city, city, city);
Where a Tile clas...
I've tried to compile a program on VSEXPRESS 2008 EDITION coupled with fltk-1.1.9 but I coutinuosly get the following error:
fatal error C1083: Cannot open include file: 'FL/Fl.h': No such file or directory
Can anyone one help me out?
Thanks a lot
...
Hi,
I am currently writing a bot for a MMORPG. Though, currently I am stuck at trying to figure out how to nicely implement this. The design problem is related to casting the character spells in the correct order. Here is a simple example to what I need to archieve. It's not related to casting them, but doing it in the correct order. I ...
Let's say I have a generic Object class, and a generic List class. I want to maintain a list of these Objects. Should I store them as List<Object> or List<Object*>?
If I use List<Object> and I have a method like:
if(some_condition) {
Object obj;
myObjectList.append(obj);
}
And my list class only keeps a reference to the objec...
I think I might have done something right, headByRating and headByName both refer to the same address.
I have been drawing diagras working all day trying new things etc, and i havent really made any progress.
I have two list pointers, headByRating and headByName.
and two node pointers nextByName and nextByRating.
Somehow I need to be ...
I have the convenient object factory template that creates objects by their type id names. The implementation is pretty obvious: ObjectFactory contains the map from std::string to object creator function. Then all objects to be created shall be registered in this factory.
I use the following macro to do that:
#define REGISTER_CLASS(cla...
Hi Friend's
I am new to windows mobile development. I have certain doubts related to windows mobile development which are as follows.
1) What is the major difference between C# and C (C++) as far as selecting language for development. ( not syntactically ) .
2) Which language should i select for development and Why ??
3) If i go...
I'm looking for a C++ Component Framework like EJB3 (sure, it's Java only) or Corba Components. But I'm not looking for Corba Components.
My requirements are
portable (linux, unix, optional Windows)
C++ interfaces (so, it's not a requirement for the framework itself to be written in C++)
optinal well documented or good examples given
...
What can be a reason for converting an integer to a boolean in this way?
bool booleanValue = !!integerValue;
instead of just
bool booleanValue = integerValue;
All I know is that in VC++7 the latter will cause C4800 warning and the former will not. Is there any other difference between the two?
...
I am looking for a regular exression matching spaces only if thos spaces are not enclosed in double quotes ("). For example, in
Mary had "a little lamb"
it should match the first an the second space, but not the others.
I want to split the string only at the spaces which are not in the double quotes, and not at the quotes.
I am usin...
Working on this question, I found an inconsistent behavior.
Why reference binding behave different in a constructor from a common function?
struct A {
};
struct B : public A {
B(){}
private:
B(const B&);
};
void f( const B& b ) {}
int main() {
A a( B() ); // works
A const & a2 = B(); // C++0x: works, C++03: fails
f( B() ...
Hello,
I obtained three dimensional data from my optical system in Visual C++.And I want to show this profiler on windows form application.Is there any special library you could advise to me?And How can I customize this library in Visual C++.
Could you help me please?
Yours Sincerely....
...
I have .net dll, i want to convert its content to char array,
result will be like this
int Length=10;
unsigned char MyArray[Length] =
{
0x4D, 0x5A, 0x90, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00
};
for dll this Length may be for example 300000. Do You know any software or other way to do this?
...
I have this copied code from Example: Calling a Provider Method, it modified it now should it change CPU fan speed:
#define _WIN32_DCOM
#include <iostream>
using namespace std;
#include <comdef.h>
#include <Wbemidl.h>
# pragma comment(lib, "wbemuuid.lib")
int main(int iArgCnt, char ** argv)
{
if(IsDebuggerPresent())cout<<"Debugee...
Following code will compile but crash at run time:
int main() {
try {
throw;
}
catch(...){
cout<<"In catch";
}
return 0;
}
Result: “Unhandled exception at 0x7c812a5b in hello.exe: Microsoft C++ exception: [rethrow] @ 0x00000000”
Why compiler allows the code to compile? it looks not so difficult ...
Im trying to pick up the forward and back buttons being pressed in an activex control (ie) but im having no luck finding what value they are.
Is TranslateAccelerator the correct place to pick this up? And what are the defines that represent the extra mouse buttons.
Visual studio 2008
c++
win32
...
The basic_string class was apparently designed as a general purpose container, as I cannot find any text-specific function in its specification except for the c_str() function. Just out of curiosity, have you ever used the std::basic_string container class for anything else than storing human-readable character data?
The reason I ask th...
Hi,
I have a class CFoo with a private inner class CBar. I want to implement a stream ouput operator for CFoo, which in turn uses a stream output for CBar in it's implementation. I can get this working when CFoo is in the common namespace, but when i place it in a new namespace (namespace foobar), the operator can no longer access the pr...