I'm working on a MFC C++ dialog where I need to respond to right mouse click events for a dialog even if the mouse is hovering over a control.
I could write event handler code for each control to delegate the work to the parent dialog, but I'm hoping there is a more elegant solution?
I'm hoping there is some way to intercept the window...
I wanna to declare an array:
int a[256][256][256]
And the program hang. (I already comment out all other codes...)
When I try int a[256][256], it runs okay.
I am using MingW C++ compiler, Eclipse CDT.
My code is:
int main(){
int a[256][256][256];
return 0;
}
Any comment is welcomed.
...
As said in the title, the goal is to copy a c-style string into memory without using any standard library functions or subscripting.
Here is what I have so far [SOLVED]
#include "std_lib_facilities.h"
char* strdup(const char* p)
{
int count = 0;
while(p[count]) ++count;
char* q = new char[count+1];
for(int i = 0; i < c...
Can anyone help me understand #pragma?
ifndef TARGET_OS_LINUX
#pragma once
endif
What,when, where, why, an example?
The above is in some code that I am refactoring....
...
Hi all, I'm trying to work with GDI+ and I'm running into a weird memory leak. I have a vector of GdiplusBase pointers, all of them dynamically created. The odd thing is, though, is that if I try to delete the objects as GdiplusBase pointers, e.g.
vector<GdiplusBase*> gdiplus;
gdiplus.push_back(new Image(L"filename.jpg"));
delete gdiplu...
Can anyone please explain how this works
#define maxMacro(a,b) ( (a) > (b) ) ? (a) : (b)
inline int maxInline(int a, int b)
{
return a > b ? a : b;
}
int main()
{
int i = 1; j = 2, k = 0;
k = maxMacro(i,j++); // now i = 1, j = 4 and k = 3, Why ?? Where is it incremented ?
//reset values
i = 1; j = 2, k = 0;
k = maxInlin...
I had the following code, which was basically,
class foo {
public:
void method();
};
void foo::foo::method() { }
I had accidentally added an extra foo:: in front of the definition of foo::method. This code compiled without warning using g++(ver 4.2.3), but errored out using Visual Studio 2005. I didn't have a namespace named ...
Where do you guys generally look for developments in C++, most importantly, developments in new standard and its approx/scheduled release data? also boost (well, boost.com)
Is there a centralized place?
thx
...
With RoR, Java, C#, PHP etc.. what do people use C++ for these days?
...
If I create a full screen window where m_winw and m_winh is the full screen size, it seems to create a window for me where the outside dimension is the full screen and the inside is smaller based on the "decoration" (window border) size. Is there a way to query the window to get it's inside width and height?
m_win=XCreateWindow(m_displa...
string s;
getline(cin,s);
while (HOW TO WRITE IT HERE?)
{
inputs.push_back(s);
getline(cin,s);
}
...
I'm converting some 32-bit compatible code into 64-bit - and I've hit a snag. I'm compiling a VS2008 x64 project, and I receive this warning:
warning C4334: '<<' : result of 32-bit shift implicitly converted to 64 bits
(was 64-bit shift intended?)
Here's the original line of code:
if ((j & (1 << k)) != 0) {
And here's what it look...
I have a task to interface with a dll from a third party company using C++.
The dll package comes with:
the dll itself
a sample Java implementation - consists of a java wrapper(library) generated using the SWIG tool and the the java source file
documentation that states all the public datatypes, enumeration and member functions.
My ...
I was going through the diamond problem and thought will work on various scenarios. And this is one among them which I was working on.
#include <iostream>
using namespace std;
class MainBase{
public:
int mainbase;
MainBase(int i):mainbase(i){}
void geta()
{
cout<<"mainbase"<<mainbase<<endl;
}
};
class D...
Hi,
We are using a macro wrapper to Bind Where Parameter function.
#define bindWhereClause(fieldName, fieldDataType, fieldData) _bindWhereClause(fieldName, fieldDataType, sizeof(fieldData), &fieldData)
void _bindWhereClause(const char *name, int dataType, int dataSize, void *data)
{
// Implementation
}
Database.bindWhereClause( "FI...
Hello, I want to decode a WMA stream to 16 Bit PCM. Now i have a Question concerning FFMpeg- what is the output format of ..
len = avcodec_decode_audio2(c, (int16_t *)outbuf, &outbuf_used, inbuf_ptr, size);
is this the right function for this task?
Thank you
...
how to add a menu command handler in vc 2008?
...
There seem to be different views on using 'using' with respect to the std namespace.
Some say use ' using namespace std', other say don't but rather prefix std functions that are to be used with ' std::' whilst others say use something like this:
using std::string;
using std::cout;
using std::cin;
using std::endl;
using std::vector;
...
I want to check if a particular file can be successfully "OPEN"ed via ShellExecute, so I'm attempting to use AssocQueryString to discover this.
Example:
DWORD size = 1024;
TCHAR buff[1024]; // fixed size as dirty hack for testing
int err = AssocQueryString(0, ASSOCSTR_EXECUTABLE, ".mxf", NULL ,buff , &size);
openAction->Enabled = ((...
Hi all,
I noticed a very interesting finding. I was testing my application involving a custom made GUI element which was being updated by data coming from an external source. The update of GUI was done using a slot(Qt specific detail) function whenever data arrived on serial port. Now the data was coming a rate of 10 packets a second i....