I'm using CreateWindowEx() function to create an "EDIT" window, i.e. where a user can type.
g_hwndMain = CreateWindowEx(0,
WC_TEXT,
NULL,
WS_VISIBLE | WS_BORDER | ES_AUTOHSCROLL,
0, 0, 400, 200,
...
I am writing a plain vanilla c++ console app using VS 2008. When I create the project, the IDE gives me a choice of .net versions. There is no option for 'none'. When I look at the project properties page, the Targeted Framework has whatever value I chose and is greyed out.
When I try and run the app on a windows machine without the clr...
I was wondering if I could do pre/post function call in C++ somehow. I have a wrapper class with lots of functions, and after every wrapper function call I should call another always the same function.
So I do not want to put that postFunction() call to every single one of the functions like this:
class Foo {
f1();
f2();
f3...
After three years working on a C++ project, the executable has grown to 4 MB. I'd like to see where all this space is going. Is there a tool that could report what the biggest space hogs are? It would be nice to see the size by class (all functions in a class), by template (all instantiations), and by library (how much belongs to the C s...
I've got a static method, MyClass::myMethod() on another DLL, MyDll.dll. In my code, I call this method, and it compiles and run fine.
But when I try MyClass::myMethod() in the immediate window (or the watch window), I always get:
MyClass::myMethod()
CXX0052: Error: member function not present
Why is that?
Update: I've found out tha...
How do I convert 6 bytes representing a MAC address into a string that displays the address as colon-separated hex values?
Thanks
...
How do I get the file size and date stamp of a file on Windows in C++, given its path?
...
I have template function "compare" defined as below.
#include<iostream>
using namespace std;
template<typename T>
void compare(const T&a, const T& b)
{
cout<<"Inside compare"<<endl;
}
main()
{
compare("aa","bb");
compare("aa","bbbb");
}
When i instantiate compare with string literals of same length, the compiler doesnot complain...
Does anyone know where I can find a memory memory leak detection tool for C++ which can be either run in a command line or as an Eclipse plug-in in Windows and Linux. I would like it to be easy to use. Preferably one that doesn't overwrite new(), delete(), malloc() or free(). Something like GDB if its gonna be in the command line, but...
I remember reading that static variables declared inside methods is not thread-safe.
Dog* MyClass::BadMethod()
{
static Dog dog("Lassie");
return &dog;
}
My library generates C++ code for end-users to compile as part of their application. The code it generates needs to initialize static variables in a thread-safe cross-platform ma...
Hi,
i am using Qprocess to execute ping to check for a host to be online or not...
The problem is that the exit code that i recieve from the Qprocess->finished signal is always 2 no matter if i ping a reachable host or an unreachable one..
I am continuously pinging in a QTimer to a host(whose one folder i have mounted at client where ...
I wrote an abstraction class for a math object, and defined all of the operators. While using it, I came across:
Fixed f1 = 5.0f - f3;
I have only two subtraction operators defined:
inline const Fixed operator - () const;
inline const Fixed operator - (float f) const;
I get what is wrong here - addition is swappable (1 + 2 == 2 + ...
I presumed that a pthread_t remains constant - for a given thread - for its entire life, but my experimentation seems to be proving this assumption false. If the id for a given thread does not remain constant across its life, how can I store a pthread_t so another thread can use pthread_join to block until the thread is finished?
For ot...
I have an inline member function defined under class MyClass
int MyClass::myInlineFunction();
This function is called from several places in my code.
There are two ways to call this function
Case 1: Using this every time the function is called.
mobj->myInlineFunction() ;
Case 2: Assign the result of this function to a variable a...
Hello,
Recently I discovered, that if I need to see if variable is even ( or odd ), I could just see if last bit of variable equals 0. This discovery, when implemented, replaced few modulo 2 calculations and thus, whole function ran faster.
Are there any other "tricks" like this one, where working with bits could replace other calculat...
I wanted to know How OS actually makes a program in to process. what are steps Os engages to make program a process.
I mean How a Program becomes a Process, what are the parameter OS adds to kernel datastructure before making a program a process
Thank you in advance.
...
In Linux after text selecting it copies to buffer, so than we could paste it by clicking middle button of the mouse. I think that there is a special buffer for this thing. I want to use it. How could i get data of selected text?
OS: Linux
Programming language: c++
Own libraries: Qt
Thanks.
...
Hello, i'm trying to set global shortcut for my applcation using QxtGlobalShortcut.
Here is my code:
QxtGlobalShortcut m_hotkeyHandle;
m_hotkeyHandle.setShortcut( QKeySequence("Ctrl+Shift+X") );
m_hotkeyHandle.setEnabled(true);
connect( &m_hotkeyHandle, SIGNAL(activated()),
this, SLOT(hotkeyPressed()) );
void MainWindow::hotk...
The following is a well known implementation of singleton pattern in C++.
However, I'm not entirely sure whether its thread-safe.
Based upon answers to similar question asked here previously, it seems it is thread safe.
Is that so?
//Curiously Recurring Template Pattern
//Separates a class from its Singleton-ness (almost).
#in...
I would like to know whether WinInet or WinHttp will get webpage contents quickly or is there any other quicker method for getting webpage content (less than 1 sec).
The programming environment which I am using is VC++
...