visual-c++

Alternative to fgets()?

Description: Obtain output from an executable Note: Will not compile, due to fgets() declaration Question: What is the best alternative to fgets, as fgets requires char *? Is there a better alternative? Illustration: void Q_analysis (const char *data) { string buffer; size_t found; found = buffer.find_first_of (*data); FILE...

Where do I translate MFC message boxes

I'm localizing an MFC app into Japanese, and have the resources working right. My current problem is that, when I use AfxMessageBox, or MessageBox, the dialog title and button messages come up in English, and I haven't found anywhere to change that. I haven't found anything useful searching MSDN or Google. So, Does this work? Does W...

Linker errors between multiple projects in Visual C++

...

How do I override the SQL for a CRecordSet and then requery?

I have a CRecordSet (Visual C++ 6.0) and I'm using ODBC to connect to postgresql 8.0.8. __ The problem: I insert a row into a table with a serial id (autoincrement), and I would like to retrieve the id after my insert. I can't use the RETURNING keyword, not supported on this version of PGsql, but I can use currval('sequence'). Howeve...

Returning the addresses of objects created outside the main() function.

I am trying to create a link list, but I am having trouble creating objects inside a function and assigning pointers to their addresses, since I believe they go out of scope when the function exits. Is this true? And, if so, how can I create an object outside the main and still use it? ...

why would freeing calloc'ed memory crash my VC6 project?

Compare these two largely identical functions. In the first, the memory for buff is allocated using _alloca. This works fine. In the second, calloc and free are used instead of _alloca. This crashes. The weird thing is that I use the calloc/free technique in almost every other GMP wrapping function I have and they all work. Here they d...

Erratic behaviour in Visual C++ 2008?

At first I thought I was going mad, but now I know I'm not. I've only been using Visual C++ 2008 Express Edition for a couple of weeks, but I've found that I have had a problem that I just can't get around, but returning to the program the next day I find that the problem has disappeared. For example, the last time I was using VC++ I co...

"Unable to start program" (Debug build)

Microsoft Visual Studio Unable to start program 'theprogram.exe'. This application has failed to start because the application configuration is incorrect. Review the manifest file for possible errors. Reinstalling the application may fix this problem. For more details, please see the application event log. O...

Advice on C Programming with MSVC++ 9

Hey guys. I'm not new to programming but I am a beginner at C and C++ coding. I only know the basics of the C language and how to write small and simple programs so far. I'm not interested in learning C++ for the long haul but I am interested in becoming a fluent C programmer. My predicament is adjusting to the MS Visual Studio 2008 envi...

how to convert byte* into jpeg file in VC++

how to convert byte* into jpeg file in VC++ i am capturing Video samples and writing it as bmp files, but i want to write that video samples into jpeg file using MFC support in ATL COM. ...

Gdiplus 64bit colors

I am creating a 64bit bitmap and wrapping it using Graphics object to draw over it. Problem is Gdiplus Color class is only 32bit(each component is byte only i.e.max 255) so how can I draw over a 64bit image using gdiplus? e.g. Bitmap bmp(100, 100, PixelFormat64bppARGB); Graphics g(&bmp); //how do I draw a red line now, if i use Color(2...

C++: Searching in Process Memory

By already given specific process' handle, how can I move further to search for a specific keywords(bytes, ints(2 bytes), text(an array)) in its memory in code, using VC++ ? ...

Catching exit(1);

I have a MFC SDI application which during startup loads a DLL. I am only able to view the source code and use the DLL but not changing & recompiling it. The situation now is that, whenever the DLL encouner an error it will call exit() such as below. bool Func() { // .. do something here if (error) { exit(999); } } In my MFC appl...

Catching exception in code

I was trying this piece of code to check whether the divide by zero exception is being caught: int main(int argc, char* argv[]) { try { //Divide by zero int k = 0; int j = 8/k; } catch (...) { std::cout<<"Caught exception\n"; } return 0; } When I complied this using VC6, the catch handl...

Wait for a specified amount of objects?

Using WaitForMultipleObjects: Makes it possible, to wait for one or all of specified objects to change to a singled state Question: How can one wait for a specified amount - such as 5, for example Usage dwEvent = WaitForMultipleObjects( maxExpectedConnections, ghEventsA, TRUE,//but wait for a specified number instea...

How to read an XML file in a Visual C++ application?

How to read an XML file in a Visual C++ application? I need to read an XML file in a Visual Studio 2003 C++ COM ATL application - unmanaged code. What library should I use: msxml, xmllite, other? I need to check that the xml satisfies its xsd I've defined and then read it. Sample code welcomed ;) Thanks in advance. ...

_bstr_t to UTF-8 possible?

I have a _bstr_t string which contains Japanese text. I want to convert this string to a UTF-8 string which is defined as a char *. Can I convert the _bstr_t string to char * (UTF-8) string without loosing the Japanese characters? ...

Visual C++ API for Network Monitoring

I have to make a network monitoring application, under Visual C++ (Windows) What libraries or APIs do you recommend me to use? ...

How to use threads and queue in VC++

I want to use two queues where the 1st queue will push the data to the queue and the 2nd thread will remove the data from the queue. Can somebody help me plz on implementing this in VC++? I am new to the threads and queue. ...

Function-LeveL Linking (/Gy switch in VC++) - What is it good for?

What is there to gain from the use of this switch in a large VS solution (200 VC projects)? From what I understand this mainly effects the size of the resulting binaries; but aside from smaller binaries, could FLL also help in reducing dependencies between projects? How does FLL usually effect build times? I'd also appreciate an educa...