visual-c++

What is the difference between a Custom Build Step and a Post-Build Event?

Both project settings allow me to execute custom commands. What are the benefits or drawbacks of each? ...

Can IWebBrowser2 store cookies in a user specified folder?

I am working on a small web browser on c++ using IWebBrowser2, the problem is that when I delete cookies on my browser, they get deleted for IE, and I dont want to interfere with IE cookies. Is there a way to solve this? ...

How can I redirect Visual Studio’s “Output” window to DebugView?

I’m using Visual Studio 2010 to write unmanaged C++ code. When debugging, anything printed using OutputDebugString or MFC’s TRACE macro goes to Visual Studio’s “Output” window. I would prefer to see the output in DebugView instead, while still running under the MSVC debugger. Is this possible? ...

Deploying a VC++ Assembly to Azure

Hi, I have an Azure cloud solution with a single C# Web role. As part of this role I'd like to reference an assembly that was compiled in VC++ 2010. I've added a reference to the assembly and can run the project locally using the Development Fabric without any problem. When I tried to deploy this to Windows Azure, the role went into th...

Variant * to string throws unknown exception.

I am using this code to sink events in a IWebBrowser2 webbrowser on c++: STDMETHODIMP AdviseSink::Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pDispParams, ...

How to display selected file name in VisualC

Hi, I created a small MFC application which has a brose button and then a dialog box. on the button event, I am able to successfully open the select file option, but when I select the file, it doesn't get displayed in the Dialog box. How can I do that? Please help... ...

Copying a BSTR into a char[1024]?

I am working on a web browser with c++ using IWebBrowser2. Declared on the top, outside any scope, I have this: static char buf[1024]; In the documentcomplete event, I set the BSTR with: CComBSTR bstrHTMLText; X->get_outerHTML(&bstrHTMLText); What I want to do is to copy bstrHTMLText value into buf (if bstrHTMLText length is > 1024...

An SSE Stdlib-esque Library?

Generally everything I come across 'on-the-net' with relation to SSE/MMX comes out as maths stuff for vectors and matracies. However, I'm looking for libraries of SSE optimized 'standard functions', like those provided by Agner Fog, or some of the SSE based string scanning algorithms in GCC. As a quick general rundown: these would be th...

Cross-compiler library communication

I need to develop a C++ front-end GUI using MSVC that needs to communicate with the bank-end library that is compiled with C++ Builder. How can we define our interfaces so that we don't run into CRT library problems? For example, I believe we will be unable to safely pass STL containers back and forth. Is that true? I know I can pass ...

ZeroMemory on PROCESSENTRY32 local variable?

Hi, I needed to enumerate running processes and wondered for a while why my code wasn't working: PROCESSENTRY32 ProcEntry; ZeroMemory (&ProcEntry, sizeof (PROCESSENTRY32)); //problem ProcEntry.dwFlags = sizeof(PROCESSENTRY32); HANDLE Snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, NULL); if (Snapshot == INVALID_HANDLE_VALUE) ...

timers in win32, c++

Hi, I have a timer class which uses CreateTimerQueueTimer and DeleteTimerQueueTimer. I receive callbacks to the class objects as expected. How do i make sure the timer does not fire when the app is busy drawing the UI or doing some intensive renders etc ?? I am not concerned about high resolution, just that it has to fire when app is id...

What is the Visual studio equivalent to GNU ld option --whole-archive

When linking a static library against an executable, unreferenced symbols are normally discarded. In my case some otherwise unused objects are used to register their respective classes into a factory and if the object are discarded, this registration fails. Under Unix where we use gcc, I can pass the flag --whole-archive to the linker l...

How to combine BrowserNavConstants in c++?

I am trying to use BrowserNavConstants for .Navigate2 flags, but I dont know how to combine more than one in the same variant for c++. On VB i would use navNoHistory + navNoReadFromCache + navNoWriteToCache or Flags := NavNoHistory or NavNoReadFromCache or NavNoWriteToCache or NavAllowAutosearch; for delphi, but how should I do it...

string reverse in c++

Why does this piece of code throw an exception when I try to change a character in the string void reverseString(char *s) { int e = strlen(s) - 1; int b = 0; char t1,t2; while(b < e) { t1 = s[b]; t2 = s[e]; s[b] = t2; s[e] = t1; b++; e--; } } ...

Remove selection from initialized text (Deselect) in CEdit control

I have CEdit control and I don't want any text to be selected by default. I tried using m_txtURL.SetSel(-1, 0, TRUE); to remove the selection, but to no avail. can some one suggest a way to do achieve that? I tried to select some characters using the following coding. That too did not work. m_txtURL.SetSel(-1, 0, TRUE); Can s...

Migrating ActiveX Component from VC++6 to VC++2008 giving errors in cstdio and xiosbase

I am trying to port VC++6 code which builds an ActiveX component to VC++2008. Whenever I use "#include", it is giving me errors which point to cstdio and xiosbase. I dont understand the reason for it, Can someone let me know why this is happening? Error trace: c:\Program Files\Microsoft Visual Studio 9.0\VC\include\cstdio(34) : error C...

Setting up a 1-step build for a Visual C++ Application

Any suggestions? Code and artwork/assets are all in SVN, and we don't want to port it to GCC or another compiler before anyone suggests it! Simplicity and minimising 3rd-party tools is preferred, since we don't have a build-server it'll probably still be run on a developer's PC but we don't want them just doing a build manually and packa...

How can I force the compiler-generated copy constructor of a class to *not* be inlined by the compiler?

Alternate question title would be: How to explicitly have the compiler generate code for the compiler-generated constructors in a specific translation unit? The problem we face is that for one code path the resulting -- thoroughly measured -- performance is better (by about 5%) if the copy-ctor calls of one object are not inlined, that ...

Initialization of const variables

Hi all, I have code like this: bool doSomething() { std::cout << "I'm here!" return true; } const bool x = doSomething(); If placed in a cpp-file in my Visual C++ console application, the code is executed as expected before entering the main() method. However, if I place this code in a .cpp-file inside a static link library pro...

How to create file in Visual c++

I try create file in visual studio c++. But it now work, what is wrong? CreateFile("1", GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, ...