I tried to use the handle hPipe as following the example here:
hPipe = CreateNamedPipe(
lpszPipename, // pipe name
PIPE_ACCESS_DUPLEX, // read/write access
PIPE_TYPE_MESSAGE | // message type pipe
PIPE_READMODE_MESSAGE | // message-read mode
PIPE_WAIT, // bloc...
I have a Visual Studio 2008 WTL 8.1 project that uses an ActiveX HTML dialog control. Unfortunately, when the view is created, VS2008 freezes and the application dialog never appears.
The callstack just before the lockup looks like this:
ax_test.exe!WTL::CFrameWindowImplBase<ATL::CWindow,ATL::CWinTraits<114229248,262400> >::Create(HWND...
Hi,
I have a std::map, and I would like to add a valid key to iterate over it later, but without giving any value (it will be given later on in the course of the iterations).
This is how I do it for now :
std::vector<std::string> valid_keys;
//Fill... Then :
std::map<std::string, float> map;
for(size_t i = 0 ; i < valid_keys.size() ;...
Simple code:
ATOM atom = GlobalAddAtom(L"TestCpp1");
It returns 0 and GetLastError returns 0x5 (Access Denied). Nothing on MSDN about it.
This is on Win7. Admin rights make no difference.
Same code works on XP. AddAtom (local) works on Win7.
What's causing this?
...
I'm doing some time trials on my code, and logically it seems really easy to parallelize with OpenMP as each trial is independent of the others. As it stands, my code looks something like this:
for(int size = 30; size < 50; ++size) {
#pragma omp parallel for
for(int trial = 0; trial < 8; ++trial) {
time_t start, end;
...
I am currently in a situation like:
struct A
{
shared_ptr< B > b;
}
struct B
{
shared_ptr< A > a;
}
shared_ptr< A > a(new A()); shared_ptr< B > b(new B();
a->b(b); b->a(a);
I know this won't work, because the references would continue to point to each other. I've also been told that weak_ptr solves this issue.
However, weak ptr has no...
I'm trying to use something that could best be described as a binary output queue. In short, one thread will fill a queue with binary data and another will pop this data from the queue, sending it to a client socket.
What's the best way to do this with STL? I'm looking for something like std::queue but for many items at a time.
Thanks
...
Got a big MFC C++ project. Our VS version is 2008. It loads a regular dll (for some optional functionality) and calls exported functions from it. When debug through the MFC app and get to the point where we call the exported function you can't step into the dll function. Is there a way to get debugging inside the dll functions. Eve...
Possible Duplicate:
Do you use NULL or 0 (zero) for pointers in C++?
Is it a good idea to use NULL in C++ or just the value 0?
Is there a special circumstance using NULL in C code calling from C++? Like SDL?
...
I have encountered a function, such that it can differentiate between being called as
foo("bar");
vs
const char *bob = "bar";
foo(bob);
Possibilities I have thought of are:
Address of string: both arguments sat in .rdata section of the image. If I do both calls in the same program, both calls receive the same string address.
RTTI...
I got my code like the following:
class TimeManager
{
public:
virtual ~TimeManager();
};
class UserManager : virtual public TimeManager
{
public:
virtual ~UserManager();
};
class Server : virutal public UserManager
{
virtual ~Server();
};
CServer *pServer;
DWORD WINAPI ServerHelper(void*);
int main()
{
//Create server
CreateT...
Can somebody please let me know, what does contingency code mean...??\
I read it in c++ complete ref, and it related it with virtual functions,
that due to late binding, since calls to virtual functions are resolved at run-time, we dont have to write a lot of "contingency code".
But it did not explain what contingency code meant.
...
I know that STL has a HashMap API, but I cannot find any good and thorough documentation with good examples regarding this.
Any good examples will be appreciated.
...
I have a requirement to have a only a single instance of a class at any given point of time. Singleton is the obvious candidate.
But I have some other conditions that are not typical of a Singleton.
The lifetime of the singleton is not the lifetime of the program. This object has to be created every time I enter a particular state and ...
I am trying to build a template function. Inside templated classes are used and I would like to pass the template type of the function to those classes. So I have:
template <class T>
T find_bottleneck (ListGraph &g, CrossRefMap<ListGraph, Edge, T> &weight, Node &s, Node &t) {
// Check if theres a single edge left
if (countEdge...
Hi all,
I've been studying C++ for a test and I am currently stuck with pointer arithmetic.
The basic problem is the following:
int numColumns = 3;
int numRows = 4;
int a[numRows][numColumns];
a[0][0] = 1;
a[0][1] = 2;
a[0][2] = 3;
a[1][0] = 4;
a[1][1] = 5;
a[1][2] = 6;
a[2][0] = 7;
a[2][1] = 8;
a[2][2] = 9;
a[3][0] = 10;
a[3][1]...
I have a CMFCPropertyGridCtrl some of the CMFCPropertyGridProperty items have options. This allows the user to select a value from a drop down list. The problem is when the user click to select a value the wait cursor show up. I have not found a way to fix this. Does anyone have some insight for this problem?
...
I would like to avoid using CreateFileMapping/MapViewOfFile to rewrite part of a file. Does boost provide this functionality?
...
I want to expose our internal bussiness data through odbc driver. One of the propitary product that i found is DataDirect OpenAccess. I want to use SQL to query live data from our data source. Writing my own SQLEngine will take ages but i need something like following diagram. We intend to use it on live data so exporting it to database ...