Since I need to do some checks depending on which control is on focus in my app, I am getting the focused control ID like this:
HWND controlOnFocus = ::GetFocus();
int controlID = ::GetDlgCtrlID(controlOnFocus);
I am getting consistent IDs, but I can't find them in the resource file!
Can I rely on the IDs I am getting or what?
Any he...
I want to find in a vector of Object pointers for a matching object. Here's a sample code to illustrate my problem:
class A {
public:
A(string a):_a(a) {}
bool operator==(const A& p) {
return p._a == _a;
}
private:
string _a;
};
vector<A*> va;
va.push_back(new A("one"));
va.push_back(new A("two"));
va.push_b...
Just wondering what the difference between MFC control messages prefixed with the following is:
LVN (e.g. LVN_ITEMCHANGED)
HDN (e.g. HDN_TRACK)
NM (e.g. NM_HOVER)
Also, I am using a ListControl and trapping when the user clicks on an item using the NM_CLICK message. I also want to trap when a user selects a new item view a key e.g. up...
I'm looking for a good open source Windows FTP client library with a public domain or BSD-type license. Something that I have access to the source code and I can use it from C++ for Windows applications in a commercial app.
We have used Wininet for years and it's buggy and horrible. The last straw is the IE8 beta 2 contains a new bug ...
I'm just getting back into C++ after a couple of years of doing a lot of C#, and recently Objective C.
One thing I've done before is to roll my own iterator adapter for std::map that will deref to just the value part, rather than the key-value pair. This is quite a common and natural thing to do. C# provides this facility with its Keys ...
I would like to include a different file depending on the version of GCC. More precisely I want to write:
#if GCC_VERSION >= 4.2
# include <unordered_map>
# define EXT std
#elif GCC_VERSION >= 4
# include <tr1/unordered_map>
# define EXT std
#else
# include <ext/hash_map>
# define unordered_map __gnu_cxx::hash_map
# define EXT __...
I have a loop that reads each line in a file using getline().
istream is;
string line;
while (!getline(is, line).eof())
{
}
I noticed that calling getline() like this also seems to work:
while (getline(is, line))
What's going on here? getline() returns a stream reference. Is it being converted to a pointer somehow? Is this actually...
I have an array of values that is passed to my function from a different part of the program that I need to store for later processing. Since I don't know how many times my function will be called before it is time to process the data, I need a dynamic storage structure, so I chose a std::vector. I don't want to have to do the standard...
Hi
I'm an old hand at embedded programming but new to CE and having a lot of trouble doing reasonably simple things, because I am not familiar with the API and struggling to understand the obscure MSDN docs.
All I want to do is minimize and maximise two separate applications that are running from one of the applications.
E.g. Applica...
As Scott Myers wrote, you can take advantage of a relaxation in C++'s type-system to declare clone() to return a pointer to the actual type being declared:
class Base
{
virtual Base* clone() const = 0;
};
class Derived
{
virtual Derived* clone() const
};
The compiler detects that clone() returns an pointer to the type of the ...
How do you draw the following dynamic 3D array with OpenGL glDrawPixels()?
You can find the documentation here: http://opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/drawpixels.html
float ***array3d;
void InitScreenArray()
{
int i, j;
int screenX = scene.camera.vres;
int screenY = scene.camera.hres;
arra...
I want to make a transparent dialog. I capture the OnCtlColor message in a CDialog derived class...this is the code:
HBRUSH CMyDialog::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
if(bSetBkTransparent_)
{
pDC->SetBkMode(TRANSPARENT);
hbr = (HBRUSH)GetSto...
Hi,
I'll preface this by saying I'm a C# programmer who inherited horrible code with no documentation. I have an unmanaged C++ library wrapped with managed code that worked fine in VS2003 with .Net 1.1 Framework. I'm trying to get it upgraded to at least .Net 2.0.
I have the unmanaged C++ library that was compiled with "MSVC 8.x" (thu...
You'll have to forgive my ignorance, but I'm not used to using wide character sets in c++, but is there a way that I can use wide string literals in c++ without putting an L in front of each literal?
If so, how?
...
I have a short preliminary interview with Microsoft in less than 2 hours.
I've been told that they might ask questions in Java and/or C++.
Where can I find a quick overview of both languages?
I don't need to full tutorial, just something that goes over the language-specific features and a refresher of the semantics.
I also only have 1.5 ...
I'm writing a simple C++ class in which I would like cache picture thumbnails versions of images downloaded from the web. As such, I would like to use a hash function which takes in URL strings and outputs a unique string suitable as a filename.
Is there a simple way to do this without re-writing the function myself? I searched around...
I have a base class with an optional virtual function
class Base {
virtual void OnlyImplementThisSometimes(int x) {}
};
When I compile this I get a warning about the unused param x. Is there some other way I should have implemented the virtual function? I have re-written it like this:
class Base {
virtual void OnlyImplement...
I'm running my C++ program in gdb. I'm not real experienced with gdb, but I'm getting messages like:
warning: HEAP[test.exe]:
warning: Heap block at 064EA560 modified at 064EA569 past requested size of 1
How can I track down where this is happening at? Viewing the memory doesn't give me any clues.
Thanks!
...
Does anyone know of a script to colorize C++ code the same as the default MSVC IDE does?
...
I need to write the content of a map (key is ID of int, value is of self-defined struct) into a file, and load it from the file later on. Can I do it in MFC with CArchive?
Thank you!
...