Home Forums C Programming Errors in my program Reply To: Errors in my program


I have made few changes to your program and its working fine and shows all the details about the bitmap image. What I think is that you have copied and pasted the code from some other source, and there were some errors (might be pasting errors), that was the reason your program was not working.
OK! I have tested your program on MS visual C++ 6 compiler and working fine. Below you can find the working code for your program. As it was an MFc application so “stdafx.h” header file has been added. Also if you goto the line (54-56) you will find that some code is commented, I think that was not a necessary code and was also creating some errors of type casting. If you really need that code to use then you will have to get around with it through some other ways.

you can not declare an array variable with dynamic size which can change at run time. You can use some other techniques like type casting. Rest of the code is working fine.
Oh one more thing, by default MS visual Studio environment creates a single threaded application where as the libraries used in this program are multithreaded so you might get some errors at run time. To run the program smoothly you will need to make few changes in project settings. You will need to perform the following tasks before running the project.
Change the application to multithreaded. To do this:
1. Go to Project Settings and select the ‘C/C++’ tab.
2. Select ‘Code Generation’ in Category.
3. Set Use run-time library to either Debug Multithreaded (for debug builds) or Multithreaded (for release builds).
Best of luck with your project.