The typical way to define an integer constant to use inside a function is:
const int NumbeOfElements = 10;
the same for using within a class:
class Class {
...
static const int NumberOfElements = 10;
};
It can then be used as a fixed-size array bound which means it is known at compile time.
Long ago compilers didn't support th...
I need to ask questions and get responses as quickly as possible. I know Stack Overflow is really very good, but I want to get another forum better suited for discussions with other programmers.
...
I'm running a QT app (VS2005) and have spawned a dialog from that app, but if I add a cancel button to that dialog with a reject() slot then yes, the dialog closes and returns the correct result but my whole app closes down as well.
This is annoying me and I can't find any hint as to why; any suggestions gratefully recieved
...
I've run into an issue catching a std::invalid_argument exception that I'm not able to trace. I'm using gcc 4.4.0 (windows), pthreads-win32 2.8.0 the GC2 dll.
Basically, from two threads (main thread and a thread started using pthread_create), I try to create an instance of class A at roughly the same time. The constructor throws an st...
Dears,
I've got a DLL for injection. This is injected via CBT-hook. Now, when the desired
process is encountered via CBT, I've detoured WinAPI's ExtTextOutW with my own. The specification of ExtTextOutW is:
BOOL ExtTextOutW(HDC hdc,
INT x,
INT y,
UINT fl...
Banging my head today ;)
Over here I asked about translating an ASM file to C, and from the responses it looked like there was no reasonable way to do it. Fine. So one of the responses suggested I just make use of the functions as-is and be done with it. Sounds good.
But how?
Holy crap I've tried everything I can think of! I'm usi...
In Eclipse, is there a keyboard shortcut for switching the editor view from viewing a .cpp file to a corresponding .h file, and vice versa?
...
My personal opinion is that any programmer should learn (procedural) C/C++. You can only benefit from learning it, even if you don’t use it regularly.
But is it worth programming with OOP in C++? Are there any advantages that you can gain from doing this?
What do you think?
...
I have this serious problem. I have an enumeration within 2 namespaces like this :
namespace FANLib {
namespace ERROR {
enum TYPE {
/// FSL error codes
FSL_PARSER_FILE_IERROR,...
and somewhere else in my code, I use it like this :
FANLib::Log::internalLog(FSLParser::FILE_IERROR, file_ierror, true, FANLib::ERROR::FSL_PARSER_FIL...
What would the usage of .NET give me, that i don't have using Win32 - and sometimes maybe googling for some 50-100 Lines of code i can reuse?
I am developing Win32 since it exists (> 15 years). Its straight forward and very robust, although sometimes it needs some more calls than you'd expect, and of course you need to keep track of han...
Hi,
sorry, I was looking for information about this topic but I did not find anything useful so I post here the probably trivial question.
I use eclipse galileo cdt in mac os x. I create watchpoints, and for some of them I am able to specify that the debug run stops when the variable takes some value, for instance aaa==10. But I want n...
Hi there,
in the past we encountered various memory-leaks in our software. We found out that these happened mostly due to incorrect usage of our own "free"-Methods, which free Queue-Message-Data and the likes.
The problem is, in our deepest tool-functions there are two methods to free up dynamically allocated memory, with the followin...
I have a custom Menu class written in C++. To seperate the code into easy-to-read functions I am using Callbacks.
Since I don't want to use Singletons for the Host of the Menu I provide another parameter (target) which will be given to the callback as the first parameter (some kind of workaround for the missing "this" reference).
Regis...
This is a C++ question. I have a class that contains a string:
class MyClass{
public:
std::string s;
};
And I have an array of MyClass objects:
MyClass * array = MyClass[3];
Now I want to write the array as binaries into a file. I cannot use:
Ofstream.write((char *)array, 3 * sizeof(MyClass))
because the size of MyClass varies.
...
I'm writing some C++ code that needs to call the CopyFileEx function. The documentation for CopyFileEx, like most other WIN32 functions, says:
If the function fails, the return value is zero. To get extended error information, call GetLastError.
Which is all well and good - however does anyone know where I can find a list of the error...
Hello,
I want to test left and right buttons of mouse in C++.
I have float variable its value is 100.00f,If I click left button,its value will increase 1.5f.
When I click right button,its value will decrease 1.5f.
How can I do this?
Could you help me please?
Best Regards...
...
I am very new to C++ and I am wondering how you output/write variables declared as double to a txt file. I know about how to output strings using fstream but I cant figure out how to send anything else. I am starting to think that you can't send anything but strings to a text file is that correct? If so then how would you convert the inf...
Our app is built using Qt and I would like to use a framework similar to Sparkle in our Windows version, to replace our custom solution. Is there anything like this ?
...
I would like to be able to measure the features in our application that are being used.
For example how much certain windows are opened, certain controls are clicked.
I can imagine a tool that measures this and sends a report to a web server, that can further process it to create meaningful data from it
...
Hello!
I'm trying to run elevated process, say, file_copier.exe, from another host process with ShellExecuteEx and lpVerb = "runas" on Vista. It shows UAC dialog and runs elevated, and copies files to "dangerous" folders, but it does not overwrite existing files (exe's).
I've read here: http://www.codeproject.com/KB/vista-security/UAC...