I have a C/C++ program that's a plugin to Firefox. Because it's a plugin, it has non-main entry points. Those entrypoints need to be compiled in C because otherwise they get name mangled.However, other functions are over-loaded, so they need to be C++. The solution is extern "C". That much I've already figured out.
However, if I extern ...
i have some code(inline assembly).
void NativeLoop()
{
int m;
__asm
{
PUSH ECX
PUSH EDX
MOV ECX, 100000000
NEXTLOOP:
MOV EDX, ECX
AND EDX, 0X7FFFFFFF
MOV DWORD PTR m, EDX
DEC ECX
JNZ NEXTLOOP
POP EDX
POP ECX
}
}
MS C++ Automagical...
Not coding in C++ right now but a question came up when I have a question in C#. Hope experts here can easily give a anwser.
Class A{
#ifdef AFlag
public void methodA(){...}
#endif
}
Class B{
...
A a;
a.methodA();
...
}
Class C {
...
A a;
a.methodA();
...
}
If the AFlag is NOT defined anywhere, what will happen? A comp...
I have a templated class
template <T>
class Example
{
...
};
inside which there
are many methods of the following type:
template <class U> <class V> method(....)
Inside these I use tr1::shared_ptr to U or V or T.
Its tedious typing tr1::shared_ptr<const U> or tr1::shared_ptr<const V>.
The obvious thing to do:
template <typenam...
I am new to C++.
Could anybody tell me the difference between method overriding anf virtual function concepts in c++.
The functionality of virtual functions can be over-ridden in its derived classes.
Redefining a function in a derived class is called function overriding.
why do we actually have virtual functions?
...
I have the following code in a class:
operator string() {
return format("CN(%d)", _fd);
}
And wanted to know what this operator does.
I am familiar with the usual string operators:
bool operator==(const string& c1, const string& c2);
bool operator!=(const string& c1, const string& c2);
bool operator<(const string& c1, const ...
I'm using Qt/C++ and trying to draw a large and complex QGraphicsScene. Once I add a lot of objects, panning and zooming become unpleasantly slow. (No surprise here, of course). I've played with device coordinate caching (helps with panning to a point) and minimal viewport updates and so on, but eventually there's just too many object...
Is there a way to specify how many characters of a string to print out (similar to decimal places in ints)
printf ("Here are the first 8 chars: %s\n", "A string that is more than 8 chars");
Would like it to print: "Here are the first 8 chars:A string"
...
How would I capture the user pressing CTRL twice (CTRL + CTRL) globally. I want to be able to have my application window hidden and then make it visible when the user invokes it with the CTRL+CTRL key presses similar to Google Quick Search Box. The user may have focus on a different window. I've looked at RegisterHotKey, but that seems t...
I'm going to have two class functions. The first class function opens the file. Then it calls a second function that writes to the file and recursively calls itself. When the second function finishes, the original function closes the file.
Is it possible to do this?
...
I have a reasonably simple C++ program that I can successfully compile on OSX 10.6 using:
g++ -O3 -funroll-loops -I /usr/local/include/boost-1_39/ myfile.cpp -o build/myfile
However, a user on OSX 10.5 gets the error:
dyld: unknown required load command
A support forum post suggests adding
-isysroot /Developer/SDKs/MacOSX10.5.sdk ...
How to get list of folders in this folder?
...
This is related to regular assert(...)
There are two scenarios that I'm interested to improve in my code.
1) a debug build app is started regularly, if there is an assertion I'm getting "Debug assertion failed" dialog box with "Abort", "Retry", "Ignore". Abort and Ignore answers are working fine. The problem with Retry. If I hit retry I'...
Hi
What are difference between The GNU C++ Library (libstdc++), "C++ Standard Library", "Standard Template Library" and "SGI STL". When programming in Linux with compiler GCC and programming in Windos in MSVC (MicroSoft Visual C++), which the standard C++ libraries are using by default?
Thanks!
...
Question is in the title, how do I initialize a char*[] and give values to it in C++, thank you.
...
I am compiling my application with a third party lib and there seems to be some weird behaviour that suggests a stack overflow issue (this is just a guess).
But when I add a print statement after the line that's crashing the application runs fine. If I remove the print statement (a simple cout << "print something" << endl; statement) t...
Is it possible to detect whether cookies are enabled in Internet Explorer through the IWebBrowser2 Interface or through some other WebBrowser Control C/C++ interface? I can't see any obvious way to do it, but was wondering whether there is a subtle way.
...
I have a drawing function that just takes an HDC.
But I need to show an EXACT scaled version of what will print.
So currently, I use
CreateCompatibleDC() with a printer HDC and
CreateCompatibleBitmap() with the printer's HDC.
I figure this way the DC will have the printer's exact width and height.
And when I select fonts into this HDC,...
I am trying to write an XML file using MSXML4. It works fine except when I have a data element with a trailing space which must be preserved.
Given the following code to insert a new element:
const _bstr_t k_Parent (ToBSTR("ParentNode"));
const _bstr_t k_Child (ToBSTR("ChildNode"));
const _bstr_t k_Data (ToBSTR("Data...
How do you create a transparent window that can be placed over another window that is actively having streaming video drawn to it. I want to create a window on top of the video window that I can draw on without video constantly drawing back over it.
I can create a window from a transparent dialog resource and set its z-order using SetW...