visual-c++

C++: Check if bmp file is legit

Hi guys and gals! I'm using C++ (Visual Studio) and I want to check if a .bmp file is legit (not some renamed virus.exe) before the user can share it over the internet with other users using my application. I'm using DirectX 2d rendering and boost framework. Is there an (easy?) way to validate bitmaps? Thanks. ...

MSVC 2010 templates compiler problem

1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\list(1194): error C2451: conditional expression of type 'void' is illegal 1> Expressions of type void cannot be converted to other types 1> C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\list(1188) : while compiling class template member fu...

iImage does not point to my imagelist

How to point the iImage index of a TBBUTTONINFO to my own imagelist index? ...

How to load a string from the resource of a different process?

I need to load a string which is placed in the resource dll of a different process, provided that the process will be running at the time of call. I tried following code - HMODULE hRes = ::LoadLibrary(_T("SomeResource.dll")); TCHAR buffer[50]; ::LoadString(hRes, IDS_SOME_ID, buffer, 50); This code is working fine while r...

Run a process as a synchronous operation from a Win32 application

I have an existing utility application, let's call it util.exe. It's a command-line tool which takes inputs from the command line, and creates a file on disk, let's say an image file I want to use this within another application, by running util.exe. However it needs to be synchronous so the file is known to exist when processing contin...

Convert TCHAR * -> std::wstring in both unicode and non-unicode environments

I have some code in a library which has to internally work with wstring, that's all nice and fine. But it's called with a TCHAR string parameter, from both unicode and non-unicode projects, and I'm having trouble finding a neat conversion for both cases. I see some ATL conversions and so on but can't see the right way, without defining ...

visual studio 2003 custom build of c++ header and subsequent build dependencies

I have a visual studio 2003 project that uses a custom build step to create a pair of .h and .cpp files. The .h and .cpp files are in the project as is a .proto file that has the custom build step. The problem is that although the .h and cpp files are generated whenever the .proto file is changed other cpp files that depend on the .h fil...

Giving focus to view part of a window (Visual C++)

I need simple solution, without using MFC,ATL,AFX etc. Just like you would include only windows.h . I'm now talking about Windows solution. My problem is that I want to be able set focus back on the view part of a window. My window for example consist of view part, title bar and menu bar. After you press alt, focus jumps to the menu bar...

Error 10061 while trying to connect to my own computer

I'm just testing out some basic networking code written in Visual C++. I have a client app and a server app that don't do anything fancy, since I'm just testing - basically, the client sends ASCII-encoded strings to the server and the server sends it back all in caps. Everything works fine when I run both programs on my computer, IF I s...

C# IPC Recommendations and comparisons

I've been working in .net for a few years, and this is my first foray into IPC. I know of the various possibilities for doing IPC (Named Pipes, Remoting, Clipboard Managment, Win32API messaging), but I don't know whats "right for me". I plan on using the following setup: Site Object: This is the reason the ipc is needed. It will be ...

Any solutions to multi-environment source control?

Is there an efficient way that doesn't require too much fiddling (I can cope with a bit) to get version control working across > 1 environments? By that, I mean multiple IDEs; I am developing on VS2010 at home, but I'd like to work on the project at university with my laptop. My laptop is running Debian and I'm open to suggestion for wha...

C++: Unhandled exception at 0x0b9ec715 (XX.dll) in XY.exe: 0xC0000005: Access violation reading location 0x00000004.

How do I debug the above error? I'm using C++ with Microsoft Visual Studio. Below is part of the code: HDC dc =*mMemDC; X->SelectPalette(dc); When I debug the code, it crashes on the line X->selectPallete(dc); ...

Strange linkage problem with Visual C++ 2005

Hello, please help me, I have a strange problem which i can't sort out in any way. Premise: I'm using visual c++ 2005 on windows 7 x64, and I'm sure that my code isn't fatally flawed because with g++ under Linux it runs nicely. I am developing an application which uses a static library also developed by me. In the link phase of the a...

Visual C++: Difference between Start with/without debugging in Release mode

What is the difference between Start Debugging (F5) and Start without Debugging (Ctrl-F5) when the code is compiled in Release mode? I am seeing that Ctrl-F5 is 10x faster than F5 for some C++ code. If I am not wrong, the debugger is attached to the executing process for F5 and it is not for Ctrl-F5. Since this is Release mode, the comp...

making a web services query using gSoap with query arguments

I'm attempting to convert a soap query written for C# into a gSoap query in Visual C++. The C# query adds an XML node's to the query call, in order to pass parameters to the query: XmlNode queryOpts = xmlDoc.CreateNode(XmlNodeType.Element, "QueryOptions", ""); queryOpts.InnerXml = "<DateInUtc>TRUE</DateInUtc>"; Here's the C# query, p...

win ver not define

I am using vc++ in windows 7. I want to change default version from #define 0x00600 to #define 0x00601. But again give message winver not define and cant open. ...

How do I keep a constant definition in a header file and not have it linked into every library?

Here's the scenario. We use Visual C++ 9. There's a C++ library intended to be used by many other libraries. Its interface is in a header: #pragma once //CommonLibraryHeader.h CSomeClass GetSomeClassFunction(); //is defined in some .cpp file const CSomeClass MagicValue( 100, 200 ); //some predefined value that the previous function ret...

How can I optimize a calculation-intensive C++ program with a known bottleneck?

I am developing some scientific software for my university. It is being written in C++ on Windows (VS2008). The algorithm must calculate some values for a large number of matrix pairs, that is, at the core resides a loop iterating over the matrices, collecting some data, e.g.: sumA = sumAsq = sumB = sumBsq = diffsum = diffsumsq = return...

two network interface at client side does not connect socket

i have two network interface installed on client system interface one has ip 192.168.3.1 and interface 2 has ip 192.168.5.1 ,i want to connect to remote system which has ip 192.168.5.7 but connection not establish.when i disable network interface 192.168.3.1 it will work fine. i am using the following code #include "windows.h" #include...

Explain the strange assembly of empty C `main` function by Visual C++ compiler.

Hello, I just noticed some strange assembly language code of empty main method. //filename: main.c void main() { } disassembly: push ebp mov ebp,esp sub esp,0C0h; why on the earth is it reserving 192 bytes? push ebx push esi push edi ; good compiler. Its saving ebx, esi & edi v...