visual-c++

Problem linking to a DLL from C++ console application

I have a console application in C++. I need to access a functionality from a C++ DLL. How do I link the DLL from my console application? Please help me in this regard. Thanks, Rakesh. ...

Get path to My Documents

From Visual C++, how do I get the path to the current user's My Documents folder? Edit: I have this: TCHAR my_documents[MAX_PATH]; HRESULT result = SHGetFolderPath(NULL, CSIDL_MYDOCUMENTS, NULL, SHGFP_TYPE_CURRENT, my_documents); However, result is coming back with a value of E_INVALIDARG. Any thoughts as to why this might be? ...

can not write data into file using c++

ofstream osCtrs("cts.txt",ios::out); if (osCtrs.is_open()){ for(unsigned ci = 0; ci < k; ci++){ KMpoint& x = ctrs[ci]; for (unsigned di = 0; di < dim; di++) { //osCtrs << x[di]; osCtrs << "what is happening?"; } } osCtrs.close(); } anything wrong? file is created, but...

MFC: How do I construct a good regular expression that validates URLs?

Hi All, Here's the regular expression I use, and I parse it using CAtlRegExp of MFC : (((h|H?)(t|T?)(t|T?)(p|P?)(s|S?))\://)?([a-zA-Z0-9]+[\.]+[a-zA-Z0-9]+[\.]+[a-zA-Z0-9]) It works fine except with one flaw. When URL is preceded by characters, it still accepts it as a URL. ex inputs: this is a link www.google.com (where I can j...

ITERATOR LIST CORRUPTED in std::string constructor

The code below compiled in Debug configuration in VS2005 SP1 shows two messages with “ITERATOR LIST CORRUPTED” notice. Code Snippet #define _SECURE_SCL 0 #define _HAS_ITERATOR_DEBUGGING 0 #include <sstream> #include <string> int main() { std::stringstream stream; stream << "123" << std::endl; std::string str = stream.str(); s...

Is it possible to compact the VC++ runtime heap?

Can I have the same effect as with HeapCompact() for the Visual C++ runtime heap? How can I achieve that? ...

problem on resize and move modless dialog window

When i resize the dialog, the dialog content are redrawed. However, when i click on tiltle bar and drag the dialog the window is not redrawed .... how can i redraw after moving/draging a dialog from one place to another.?? can i handle Mouse WM_LBUTTONUP. how can i do please help. I am using VC++.2005 with MFC dialogs. ...

Is it possible to separately plug in OpenMP libraries to Visual C++ 2008?

In Visual Studio 2005. OpenMP didn't come with the Express Edition, but it was possible to download it separately and get it set up, since the compiler itself was OMP-enabled. Is the same true with Visual Studio 2008? We are all using Standard Edition which similarly supports OpenMP but doesn't come with the libs/headers. Some code we h...

Using libs/DLLs built in a different version of Visual C++

If a 3rd-party developer gives us .libs and/or .dlls generated with VC++ 2005, can they be used in VC++ 2008? What about if he compiles with 2008 Pro, and we run 2008 Standard/Express? I know C++ is not as portable as it used to be, what with VC++ runtimes and so on, but I'd like to think at least we can use pre-existing libraries/dlls ...

context sensitive help icon (? icon) is not triggering the onhelpinfo function for one of the controls in my Propert page.

I have a WS_EX_CONTEXTHELP extended style property set on my property sheet. It basically sets the question mark button along with the close button (? X) at the right end of the dialog’s title bar in order to enable the context sensitive help feature for that property page. The property page consists of many different controls like butto...

Drop target - where do I register the COleDropTarget variable if the view class doesn't have OnCreate?

The MSDN site says: From your view class's function that handles the WM_CREATE message (typically OnCreate), call the new member variable's Register member function. Revoke will be called automatically for you when your view is destroyed. But I don't have an OnCreate function in the ChildView class. I do have OnCreate in the CMain...

can't get my code to run from a programming book(c++)

i got a new programing book (multicore programming by cameron hughes, tracey hughes). so far i have not got one of their programs to work their book says that it should work on 99% of computers so im a little confused but at the end of each program in their book they have "compile and link instructions"... do i need to enter that? it loo...

Why is OnDragEnter not called?

I have added the COleDropTarget variable to my view class and registered it in the OnCreate(), which is being called at startup. I added the OnDragEnter and OnDrop virtual functions (not the others yet, as OnDragLeave). But they are not called when I drag (or drop) a piece of text over them. I just happened to think about the fact that ...

How do you correctly use boost::make_shared_ptr?

This simple example fails to compile in VS2K8: io_service io2; shared_ptr<asio::deadline_timer> dt(make_shared<asio::deadline_timer>(io2, posix_time::seconds(20))); As does this one: shared_ptr<asio::deadline_timer> dt = make_shared<asio::deadline_timer>(io2); The error is: error C2664: 'boost::asio::basic_deadline_time...

Is it possible in C++ to inherit operator() ?

I'm writing some examples of hash functions for hash_map. If I use a hash_map defined by my compiler, I need to define Comparer in Hasher. I know that it's better to use tr1::unordered_map but in my application it's important to set minimum number of buckets rather big and define mean bucket_size - a condition to grow. So I would like t...

Equivalent of Bstr Wrapper of c# in vc++

what is the equivalent of BstrWrapper of c# in vc++ ...

Why are not all texts of my MFC applicatiopn displayed using ClearType?

I've got an MFC application that is built with VC6. When ClearType is enabled (Windows XP) some texts are rendered smoothly, i.e. with ClearType, and others are not. Dialog texts don't seem to ever get rendered with ClearType. Some list controls, however, have it enabled completely, others only in their headers. What could be the reaso...

How to know if a C++/CLI reflected parameter is long or int?

I'm reflecting a C++/CLI method that has the following signature: void foo(long n); This translates into C# as: void foo(int modopt(IsLong) n); How can I find if an int parameter is actually a C++/CLI long by reflection? ...

Best way to create an application-icon in visual studio c++

In Visual studio I can draw 13 different application-icons in different resolutions and color depths. But do I have to do this, or is there a way to automatically produce all low-res icons from one single hi-res icon? ...

Is using macros to abbreviate long winded boost template names a bad practice?

I am tired of writing shared_ptr<>, it's lengthening the code lines tremendously. Any reason not to do this? ...