c++

Skype Raw API (NOT COM API) send message problem

In converting this CONSOLE example to a full windows dialog implementation I have run into a very "simple problem". SendMessage() (line 283) is returning zero, GetLastError reveals 0x578 - Invalid window handle. http://read.pudn.com/downloads51/sourcecode/windows/multimedia/175678/msgapitest.cpp__.htm (https://developer.skype.com/Downl...

Calling Methods C++, newbie...compile errors PLEASE HELP

with the following program I am getting a ton of compile errors when i try and compile it. I think they have something to to with method calling. I am not familiar with c++ and don't know what is causing them. Can anyone help? Here is the source code: #include <iostream> using namespace std; //getting the greatest common divisor to help...

How can I get rid of the warning with rand()? (C++)

Whenever I use the rand function in C++: #include<iostream> #include<time.h> #include<stdlib.h> using namespace std; int main(){ srand(time(0)); int n=(rand()%6)+1; cout<<"The dice roll is "<<n<<"."<<endl; } I get a warning about conversion from time_t to int at line 5: srand(time(0)); Is there any way to get rid of this warning? ...

SQLite C++ Access Columns by Name

Is there a way to access SQLite results by column name (like a C++ Map) instead of index number in C/C++? For example, Python's SQLite access allows dictionary access Results = Query("SELECT * FROM table"); print Results['colname'] print Results['anothercol'] Any similar methods available in C++ for the SQLite's interface? ...

SQLite Alternatives for C++

I am developing a application that needs to store data with many writes and reads as requiring fast searching of data (the need for indexes of some sort), and also be able to serialize and save the data. Currently I am thinking about using SQLite, which gets the job done, but I am open for alternatives. The SQLite's syntax really doesn...

Trouble with seekp() to replace portion of file in binary mode

Hi, I'm having some trouble with replacing a portion of a file in binary mode. For some reason my seekp() line is not placing the file pointer at the desired position. Right now its appending the new contents to the end of the file instead of replacing the desired portion. long int pos; bool found = false; fstream file(fileName, ios::b...

C++ how to call a parent class method from contained class?

I am trying to make a call to a Parent class method from a contained object, but have no luck with the following code. What is the standard way to do it? I have searched around and this seems to work for inherited objects, but not for contained objects. Is it right to call it a Parent class even? Or is it called an Owner class? class P...

CLR interfering with C++ STD?

I have some code compiling under the clr and other code that is unmanaged in a single project. My common.h file includes all the std library headers that I need. It is included by manager.h (forward declaration for manager.cpp (no CLR)), which is included by main_window.h (WinForm) which is included by document_manager.cpp (CLR). At r...

How do I set the color of a single pixel in a Direct3D texture?

I'm attempting to draw a 2D image to the screen in Direct3D, which I'm assuming must be done by mapping a texture to a rectangular billboard polygon projected to fill the screen. (I'm not interested or cannot use Direct2D.) All the texture information I've found in the SDK describes loading a bitmap from a file and assigning a texture ...

Where can I find good C++ source code?

Duplicate of: What C++ open-source projects have good and clean code to learn from? excellent examples of real c/c++ code? Suggestions needed What are some examples of exceptional C++ open-source code? I am learning C++ as a first language. I feel like I am about to hit a ceiling on my learning (I am not learning through a class) ...

How to check if socket is closed in Boost.Asio?

What is the easiest way to check if a socket was closed on the remote side of the connection? socket::is_open() returns true even if it is closed on the remote side (I'm using boost::asio::ip::tcp::socket). I could try to read from the stream and see if it succeeds, but I'd have to change the logic of my program to make it work this way...

memory profiler for c++

Im trying to find a tool that can help me find out where my memory is allocated in a certain stage of my program. Most memory profilers cant do this and just tell you if memory is leaked or not. Does any one know of a tool that can do this? Edit: OS: Win32 Visual studio 2005 ...

Best practices for creating an application which will be upgraded frequently - C++

I am developing a portable C++ application and looking for some best practices in doing that. This application will have frequent updates and I need to build it in such a way that parts of program can be updated easily. For a frequently updating program, creating the program parts into libraries is the best practice? If program parts a...

Unflip wxImage loading

I have the code here working fine except that all the non-power of 2 images are flipped in the y direction. In the wxImageLoader file there is this loop which I believe is the culprit: for(int y=0; y<newHeight; y++) { for(int x=0; x<newWidth; x++) { if( x<(*imageWidth) && y<(*imageHeight) ){ imageData[(x+y*newWidth)*bytes...

chaining c++ streams

I was thinking of "chaining" a couple of c++ iostreams toghether to filter input twice. I'm using gzstreams to read zlib compressed files and I was thinking of coding a stream that reads from a stream and performs encoding conversions. Perhaps by passing an opened stream as constructor parameter... How do you think this could be best acc...

In qt, how do I implement a widget that stays consistent with variables in the code.

Here's a sample of a SpinBox that writes its changes to underlying variables. The main problem that I'm having is valueChanged is called when the widget is constructed. Is there a more elegant way to do this? I think it's weird that I connected a widget to itself, but valueChanged isn't virtual. class ValueWriterInt: public QSpinBox ...

Is C++ .NET dying?

I heard somewhere that Microsoft will be focusing their efforts on C# rather than C++ for the .NET platform. I can see signs of this being true because of the GUI designer that was available for C# but not C++. So I would like to know if C++ in .NET is dying and if it will continue to be second to C# in the future. ...

How to get the underlying stdio FILE* of a managed System.IO.FileStream?

I'm writing a .NET adaptor for a C/C++ library where a method "bar" takes a regular stdio FILE*. Is it possible to build an interface so that managed code user can pass a managed (File)Stream? That is without creating an intermediary buffer and code to pipe the data between. Also does the assumption that bar() reads only make things any ...

Why does C++ need language modifications to be "managed"?

Why can't a compiler be written that manages what needs to be managed in C++ code (i.e. to make it "CLR compatible")? Maybe with some compromise, like prohibiting void pointers in some situations etc. But all these extra keywords etc. What's the problem that has to be solved by these additions? I have my thoughts about some aspects and...

Better alternative for c++ old feature?

c++ has come a long way, it has lot of feature that lead to do same task in n number of ways. What feature do you think should be avoided and list better alternative for the same. Like use SmartPointers in places of pointers ...