visual-c++

How to call interface API from within COM server

I have one com server with some interfaces exposing some API's COM class looks like below class ATL_NO_VTABLE CTask : public CComObjectRootEx<CComSingleThreadModel>, public CComCoClass<CTask, &CLSID_Task>, public ITask { public: STDMETHOD (Task)(); STDMETHOD (ABC)(); ... } Now this com server also contains one more cla...

header confusion. Compiler not recognizing datatypes

I am getting confused on why the compiler is not recognizing my classes. So I am just going to show you my code and let you guys decide. My error is this error C2653: 'RenderEngine' : is not a class or namespace name and it's pointing to this line std::vector<RenderEngine::rDefaultVertex> m_verts; Here is the code for rModel, in i...

How to simulate a file read error in the CRT

Using VS2008, we would like to simulate a file that has a size of X, but that has a read failure at X-Y bytes, so that we get an error indication. Anyone have an idea of how to do this on windows? Looks like there is a solution for linux, but I can't really come up with a way to do this on windows. We have multiple developers, multiple...

How to link openssl crypto lib in C++?

I am trying to test the crypto library that comes with openssl, I downloaded openssl from http://www.openssl.org/source/ and it contains a /crypto folder with subfolders for each encryption type. I wanted to try BIO_f_base64 so I created an empty console app, and added the includes needed, also added the paths to the /bio and /evp folde...

Should I call class destructor in this code?

I am using this sample to decode/encode some data I am retrieving/sending from/to a web server, and I want to use it like this: BOOL HandleMessage(UINT uMsg,WPARAM wParam,LPARAM lParam,LRESULT* r) { if(uMsg == WM_DESTROY) { PostQuitMessage(0); return TRUE; } else if(uMsg == WM_CREATE) { // Start timer StartTime...

Is it possible to skip over an abitrary amount of a loop during debug?? Visual Studio

I am trying to find an error in my code. The problem is the error occurs in a loop. But the loop iterates about 500 times. Instead of clicking through the loop. Is it possible to skip over a certain amount of the loop ?? ...

Any drawbacks in using LoadLibraryEx() instead of CoCreateInstance() for reg-free COM component consumption?

Our program needs to consume the COM server which is also made by us. The scenario is the following: the installer will copy both the program files and the COM server files into the same folder on each install. Currently we use regsvr32 to register the COM server, but this is not very good - if we develop another unrelated program that ...

How to check whether a file exists in C:\ drive using VC++ ?

I want to check a file is present in C drive or not..? can any one tell me how ? Update: I got errors, I am using VC++ 2008 #include "stdafx.h" #include <stdio.h> int main(int argc, _TCHAR argv[]) { FILE * f = fopen("C:\\Program Files (x86)\\flower.jpeg"); if (f == NULL) { file_exists = FALSE: } else { ...

refactoring my code. My headers (Header Guard Issues)

I had a post similar to this awhile ago based on a error I was getting. I was able to fix it but since then I been having trouble doing things because headers keep blocking other headers from using code. Honestly, these headers are confusing me and if anyone has any resources that will address these types of issues, that will be helpful....

vc++ - static member is showing error

I am using vc++(2010). I am trying to create a class for server side socket. Here is the header file #include<winsock.h> #include<string> #include<iostream> using namespace std; class AcceptSocket { // static SOCKET s; protected: SOCKET acceptSocket; public: AcceptSocket(){}; void setSocket(SOCKET socket); static void EstablishC...

error C2143: syntax error : missing ')' before 'constant

I keep getting this error on my project and i cant figure it out! please help! error C2143: syntax error : missing ')' before 'constant' the line is: while (selection == ('a','b','c', 'd', 'e', 'f', 'g', 'h', 'i','A','B' 'C', 'D', 'E', 'F', 'G', 'H', 'I'); also i know there is an easier way to write that line out but im not sure ho...

When do I need to deallocate memory?

I am using this code inside a class to make a webbrowser control visit a website: void myClass::visitWeb(const char *url) { WCHAR buffer[MAX_LEN]; ZeroMemory(buffer, sizeof(buffer)); MultiByteToWideChar(CP_ACP, MB_ERR_INVALID_CHARS, url, strlen(url), buffer, sizeof(buffer)-1); VARIANT vURL; vURL.vt = VT_BSTR; vU...

Is there any way to use VC++ 2010 without including stdafx.h?

Hi all, I've successfully installed M$ VC2010 and start writing simple programs using it. I am very annoyed from the #include<stdafx.h>, So is there any way to compile and run programs without it??? ...

Why this base64 function stop working when increasing max length?

I am using this class to encode/decode text to base64. It works fine with MAX_LEN up to 512 but if I increase it to 1024 the decode function returns and empty var. This is the function: char* Base64::decode(char *src) { unsigned six, dix; unsigned int d_len = MAX_LEN; memset(dst,'\0', MAX_LEN); unsigned s_len = strle...

Write a dll that is accessable from VS 2003 VC++ code

I need to be able to write a DLL in either C# or VC++ that is accessible from code that is written in Visual Studio 2003 VC++. It looks like the code is unmanaged (uses * for pointers) VC++ and this DLL needs to be able to drop right in and be accessed by the current code. The DLL is an RS232 driver that needs to be able to return an i...

MFC : IHTMLElement how to remove an html element...

Hi all, I have a dialog which has a web control... and with it I add elements using the put_innerHTML method of the class IHTMLElement. How do I delete elements though? I can't seem to find the method for it. Thanks... ...

How do I correctly toggle the visibility of my toolbar button?

I try to modify code for IE toolbar button in visual c++. I manage to hide my toolbar button using, TB_HIDEBUTTON at run time. How to unhide it back in run time? Here is the code that Im currently modifying: void CRebarHandler::setButtonMenu2(){ TBBUTTONINFO inf; inf.cbSize=sizeof(inf); inf.dwMask=TBIF_STYLE; inf.fsStyle=BTNS_D...

How to load Firebird 2.1.X fbclient.dll on Windows XP wihout installing Microsoft C++ 2005 Redistributable (vcredist_x86.exe)?

Using fbclient.dll in Firebird 2.1.X in fresh install Windows XP that never install with Microsoft C++ 2005 Redistrubable will cause problem. I wish to deploy my application that contain fbclient.dll and all related Microsoft C++ 2005 redistributable libraries without installing the redistributable libraries. Can I do that? I am runni...

Win32 C++ Import path based on OS?

I'm working with some legacy code that has an import like so: #import "C:\Program Files\Common Files\System\ado\msado15.dll" rename("EOF", "EndOfFile") The problem is, on a x64 machine the path for this import is in the 'Program Files (x86)' directory. Is there a preprocessor macro I can wrap around this to make it work on either? Ed...

Seeking References To MSVC 9.0's C++ Standards Compliance

I "know" (hopefully) that MSVC 9.0 Implements C++ 2003 (ISO/IEC 14882:2003). I am looking for a reference to this fact, and I am also looking for any research that has been done in to how compliant MSVC 9.0 is with that version of the Standard. I have searched for and not been able to find a specific reference from MicroSoft that actua...