My target module is an executable to be built from X.cpp and Y.cpp, both these two files need a common .h file:
extern HANDLE hPipe;
extern IMediaSample *pSave = NULL;
But when I build the module, I got an error saying :
Y.obj : error LNK2005: "struct IMediaSample * pSave" (?pSave@@3PAUIMediaSample@@A) already defined in X.obj
How ...
I've setup _NT_SYMBOL_PATH and have pointed it to
srv*c:\symbols*http://msdl.microsoft.com/download/symbols
When starting the debugger, I notice that the Windows related dlls load quickly. However, our company's dlls are taking a god awful long time to load. When I get rid of _NT_SYMBOL_PATH, restart visual studio, then everything lo...
It looks like this question has been asked multiple times each in a different context and I have made some strides in making an overlay for a game (This is for informational data, etc..). I Would also like to make it inter-actable like Steam and XFire.
I have managed to get an overlay for a directx game while its in window mode... ki...
I have a CLI/C++ based install application which needs to close another app I've written, replace the application's .exe and dlls and the re-run the executable.
First of all I need to close that window along the following lines:
HWND hwnd = FindWindow(NULL, windowTitle);
if( hwnd != NULL )
{
::SendMessage(hwnd, (int)0x????, 0, NULL...
fSuccess = ReadFile(
hPipe, // pipe handle
chBuf, // buffer to receive reply
BUFSIZE*sizeof(TCHAR), // size of buffer
&cbRead, // number of bytes read
NULL); // not overlapped
If not safe, how can I ensure the other side is not writing when reading a pipe in windows?
...
Hey guys I learned about endianness and am still having difficulty understanding where things could go wrong. I was wondering what sort of things I should look for and how I should go about fixing it. I know I dont need to change anything for loading from text files and things like that but for example here is a snippet of my code for lo...
If I construct, my own binary tree, then I can find the depth of each node.
The sample code is as follows
template<class datatype>
void binary_node<datatype>::printNodeWithDepth(int currentNodeDepth)
{
if ( left )
left->printNodeWithDepth(currentNodeDepth+1);
std::cout << value << " and the depth is " << currentNodeDept...
I'm about to write a program in C++, but I'm unsure as to how to go about it. I want to create a program that can be used with a command line frontend but also a GUI frontend as I don't want to bind a user to a specific interface such as a widget toolkit for dependencies' sake.
How would be the best way to do this? I know some programs ...
I'm trying to understand how the Google Test Fixtures work.
Say I have the following code:
class PhraseTest : public ::testing::Test
{
protected:
virtual void SetUp()
{
phraseClass * myPhrase1 = new createPhrase("1234567890");
phraseClass * myPhrase2 = new createPhrase("1234567890");
}
...
I have a UI and a QGraphicsScene subclass GraphicsScene that implements mousePressEvent(), however mouse clicks are being ignored.
ui->setupUi(this);
scene = new GraphicsScene(this);
scene->addPixmap(QPixmap::fromImage(someImage));
ui->graphicsView->setScene(scene);
connect(scene, SIGNAL(clicked(QPoint)), this, SLOT(someSlot(QPoint)));
...
Hey, for this piece of code, the person who wrote the system communicates data between processes using textfiles. I have a loops that looks (for all intents and purposes) like this:
while (true)
{
//get the most up-to-date info from the other processes
pFile = fopen(paramsFileName, "r");
// Do a bunch of stuff with pFile
Sleep(100...
Hello, I can check predefined value like:
#ifdef SOME_VAR
// Do something
#elif
// Do something 2
#endif
If I have to check 2 values instead of 1. Are there any operator:
#ifdef SOME_VAR and SOME_VAR2
// ...
#endif
Or I have to write:
#ifdef SOME_VAR
#ifdef SOME_VAR2
// At least! Do something
#endif
#endif
...
When I compile and run my C++ program that deletes a file called example.txt (below)
#include <stdio.h>
int main ()
{
if( remove( "example.txt" ) != 0 )
perror( "Error deleting file" );
else
puts( "File successfully deleted" );
return 0;
}
It comes out like this...
cd c:\Users\Mark\Desktop
C:\Users\Mark\Desktop>app.e...
I am importing an C++ DLL in an innosetup install script. The DLL code is as follows:
void __stdcall SetFbParam(char *dbFileName,char *dbTableName,char *dbParamName,char *dbParamValue){
//of no use here and doesn't change anything}
In the Innosetup, I import it using
procedure FBset(dbFileName,dbTableName,dbParamName,dbParamValue: St...
I've been using OpenProcess with PROCESS_ALL_ACCESS rights for the following functions:
-EnumProcessModules
-GetModuleFileNameEx
-ReadProcessMemory
-WriteProcessMemory
which works fine on Windows Vista/7. However, in Windows XP/2000, it won't open the process with PROCESS_ALL_ACCESS because according to the MSDN library:
The size of t...
I'm looking for a data structure that would allow me to store an M-by-N 2D matrix of values contiguously in memory, such that the distance in memory between any two points approximates the Euclidean distance between those points in the matrix. That is, in a typical row-major representation as a one-dimensional array of M * N elements, th...
I am implementing a FIR filter on an ARM9 processor and am trying to use the SMLAL instruction.
Initially I had the following filter implemented and it worked perfectly, except this method uses too much processing power to be used in our application.
uint32_t DDPDataAcq::filterSample_8k(uint32_t sample)
{
// This routine is base...
I have a long list of constants that I need access to in several projects which are in different languages(Verilog, C, C++ and C#). Rather than repeating them in each language, is there a good way to share these?
The only thing I could think of would be a text file and a preprocessing script?
Is this the best solution or is there somet...
I want to suspend a void() function that sets a stack variable to true. How can I do this?
bool flag = false;
boost::function<void()> f = ...;
f();
assert(flag);
This is, obviously, toy code that demonstrates the problem. My attempt at this, using bind, was bind<void>(_1 = constant(true), flag);, but this yields a compilation error.
...
Hi, I am converting some environment variables to property sheets for some C++ projects. This way when the projects are used from the branch or the trunk in SVN we don't have to use a junction to switch between the branch and trunk.
My property sheet, paths.vsprops, is in this format:
<?xml version="1.0" encoding="Windows-1252"?>
<Visu...