visual-c++

sorting stl list of pointers

how do i sort a std::list? the workaround posted here: http://support.microsoft.com/kb/265109 doesnt seem to work. error: 'greater' has already been instantiated from the primary template ...

Controlling a parallel port via USB adaptor on modern hardware and OS

I have a USB to parallel port device that i want to interface with through c++ on a modern windows OS (xp and newer). I've done a little research but the information is a bit patchy when it comes to programming to one of these USB to parallel port devices (most of the information is dated and assumes that you have a parallel port built ...

Is using implicit conversion for an upcast instead of QueryInterface() legal with multiple inheritance?

Assume I have a class implementing two or more COM interfaces (exactly as here): class CMyClass : public IInterface1, public IInterface2 { }; QueryInterface() must return the same pointer for each request of the same interface (it needs an explicit upcast for proper pointer adjustment): if( iid == __uuidof( IUnknown ) ) { *ppv ...

varargs(va_list va_start) doesn't work with pass-by-reference parameter.

Possible Duplicate: Are there gotchas using varargs with reference parameters Hi, I have a problem with varargs. Look at my code(Microsoft Visual Studio 2005 or 2008). #include <stdarg.h> struct Test { int a; }; void T1(int n, ...) { va_list args; va_start(args, n); char* p = va_arg(args, char*); va_end(args); } void T...

Shared global variable in C++ static library

I have a MS C++ project (let's call it project A) that I am currently compiling as a static library (.lib). It defines a global variable foo. I have two other projects which compile separately (call them B and C, respectively) and each links the shared static library A in. Both B and C are dll's that end up loaded in the same process. I ...

char * in managed code?

I have a c++ plus method that generates a value. i am calling this method from a c# application. The C++ method is like this: extern "C" REGISTRATION_API char * generate(char dIn[],char dOut[]) The generate method returns an array of chars (sOut[]=returnvalue; return sOut;) Now I'm calling this method from my c# app: [DllImport("myd...

VS2010 modify intellisense popup order via an addin?

Is it possible to modify the order of the intellisense options shown when I hit ctrl-space? Specifically, I'd like to order them in scope, so that if I have a variable in my function that matches what I've typed so far then it goes to the top of the list. If there's a member in the class, that's next, etc. I'm just kind of sick of h...

please detect the Visual c++ error

case WM_LBUTTONDOWN: x1=LOWORD(z); y1=HIWORD(z); d=GetDC (w); TextOut(d,x1,y1,"AMITA",6); ReleaseDC (w,&d); break; Error:: error C2664: 'ReleaseDC' : cannot convert parameter 2 from 'struct HDC__ ** ' to 'struct HDC__ * ...

How to refer to the start-of a user-defined segment in a Visual Studio-project?

Hi, I'm struggling to convert a C-program linked with ld, of the gnu tool-chain to make it compile as a visual-studio (2005) project. The program puts .data-symbols in different segments and during an initialization phase it copies data between segments. Pointers to the start and end of the segments are defined in the ld linker scri...

Setup Project Custom Action in C++ "[TARGETDIR]"

I am trying to copy file into the setup target directory. I am using this: TCHAR destPath[ MAX_PATH ] = &L"[TARGETDIR]"; wcscat_s(destPath, L"[email protected]\\Capture.png"); CopyFile(L"C:\\Users\\waldek\\Desktop\\Capture.png", destPath, 0); if I use this: CopyFile(L"C:\\Users\\waldek\\Desktop\\Capture.png", L"C:\\Program Files (...

Visual Studio Setup and Deployment - Changing installation for Single User and All Users

Hi, I have a Visual C++ Setup which I created using Visual Studio Setup Wizard. I'm trying to give the user option of selecting to install for himself only or everyone. How do I do this?? Even though I can select a radio button saying Install for All Users at install time, it did not work. I need this to work in Windows 7. I have some f...

register application with AV/AS

Hi All, I have an application which runs on windows. I am facing following issues. AV/AS blocks my application after install and when invoked first time. AV/AS blocks does not allow my application to communicate with the server, it blocks my UDP/TCP connection. AV/AS blocks my application access to windows registry operation. AV/AS bl...

VS 2008 : See the elements referred to pointer

Hi, This seems to be a rather stupid question, but I create a pointer to an array of doubles : double* tab = new double[10]; Then I fill the double array, but when I expand the tab pointer in Debug Mode, I only *tab which gives me the value of first element, which is normal. But how do I see the other elements? thanks ...

Any C++ libraries to run a single program on multiple PC's (i.e. "use grid computing to run my app")

I'm after a method of converting a single program to run on multiple computers on a network (think "grid computing"). I'm using MSVC 2007 and C++ (non-.NET). The program I've written is ideally suited for parallel programming (its doing analysis of scientific data), so the more computers the better. ...

Heap Corruption Error when deleting a pointer

I get a heap corruption error when deleting a pointer. For this project, the linking parameter for Randomized Base Address is set to Disable Image Randomization. Not sure why that is set that way. Anyway, I only get that error when a specific header file of a library is included. The strange thing is that even with that header file inclu...

lstrcpy() causing exceptions in visual C++ code

Hi, I used a MFC virtual list control to enhance the performance and I handle GetDispInfo(NMHDR* pNMHDR, LRESULT* pResult) to populate the ListCtrl. The relevant code in that method is as follows: if (pItem->mask && LVIF_TEXT) { switch(pItem->iSubItem) { case 0: lstrcpy(pItem->pszText, rLabel.m_strText); ...

Should I use secure versions of POSIX functions on MSVC - C

I am writing some C code which is expected to compile on multiple compilers (at least on MSVC and GCC). Since I am beginner in C, I have all warnings turned on and warnings are treated as errors (-Werror in GCC & /WX in MSVC) to prevent me from making silly mistakes. When I compiled some code that uses strcpy on MSVC, I get warning lik...

VC++ /DEFAULTLIB issue

When linking my dll in release build I get - 1>LINK : warning LNK4098: defaultlib 'mfc80d.lib' conflicts with use of other libs; use /NODEFAULTLIB:library 1>LINK : warning LNK4098: defaultlib 'mfcs80d.lib' conflicts with use of other libs; use /NODEFAULTLIB:library 1>LINK : warning LNK4098: defaultlib 'msvcrtd.lib...

How to change the foreground colour (ie text or caption) of a push button in MFC/VC++ dialog application

Hi..... everybody, Am doing a calculator programme in vc++/MFC dialog application. Thier, i want to change the foreground and background colour of a push button in dialog. I have no idea, how to change. Please suggests me with relevent code or example if any body have idea. basu_sagar ...

Problem Deploying Web Service in C# that uses VC++ dll

I created a web service using VS 2008 C# that uses VC++ dll, In my development enviroment it works, but when I deploy it to the IIS I get this error: This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem. (Exception from HRESULT: 0x800736B1) [COMExcept...