Visual C++ :: MFC DLL To Interact With API - Program Crashes After Displaying 100 Bars?
Apr 27, 2013
I have written a MFC dll to interact with an API and it is run by the target program. the first 100 bars are drawn properly but then the program ceases to operate. I am guessing I have a memory leak but I probably just dont understand what I am doing as I am quite new to programming MFC GDI. Here is my code that causes the trouble...
The variables coming in are commented out to facilitate testing and so it would be displaying the same bars over and over because of this. it worrks for 100 bars, then crashes.
void MainDlg::SS_UpdateChart() {
// the chart plot is completely recalculated each time a new bar is shown
// 300 is plottable height
// 400 is plottable width, 39 bars
int displayChartHeight = 300;
[Code] .....
View 11 Replies
ADVERTISEMENT
Nov 13, 2013
I have an SDI app created with VC2012. Main view is a CFormView and it's the parent to four embedded dialogs. All four dialogs have title bars. On three of them, the title bars looks as I'd expect. Normal size, text left justified. On the fourth, the title bar is noticeably thicker and the text is centered. All styles are the same as far as I can tell. The main difference is the one that's acting up has a browser control on it, the others just standard controls. It looks normal on Windows 7.
View 8 Replies
View Related
May 13, 2014
cause I cant find why it crashes. It compiles without any error,but crushes when i run it and I can't find where is wrong the code.
Code:
#include <stdio.h>
#include <time.h>
#include <math.h>
[Code].....
View 7 Replies
View Related
Sep 28, 2014
In my program, I am trying to implement a set in which I can add/remove and print, it doesn't have to be a specific value removed just that it removes an item from the list. When I call the removeItem function it crashes, saying my iterator is out of range. I don't understand what is wrong. Here is my code:
#include "stdafx.h"
#include <iostream>
#include <set>
[Code].....
View 4 Replies
View Related
Feb 17, 2015
I've implemented a records system for a college assignment and everything works as intended. However upon increasing the amount of records to store in my array above 10, the program crashes upon adding a new employee and I can't work out why...
#include <stdio.h>
#include <errno.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#define esize 10 /* Change max-records */
[Code] .....
View 3 Replies
View Related
Oct 24, 2014
Problem: When I add a new variable to complete my program, it crashes. I have tried tracing where the problem is but it leads to adding new variables
Purpose of program: Every 2 lines of the input file belong to 1 participant. The line with decimals include times a person has run miles. While the second line of each participant are integers that indicate the best sets from workouts the participant had done.
so an example of the output
Participant #1
Cardio Workouts:
Best Time:
Worst Time:
Average Time:
Weight Workouts:
Most Sets:
Least Sets:
Average Sets:
Participant #2
...
Why my program is crashing
#include <stdio.h>
int main () {
// Stats Col0=BestTime Col1=WorstTime col2=mostSets col3=leastSets Col4=Average_time Col5=Average_sets
float chart[20][12], stats[10][6], best_time=100, worst_time=0, most_sets=0, least_sets=100, avg_time, avg_sets, sum;
int i, j;
int p=0;
[Code] .....
Attached File(s)
input1.txt (817bytes)
View 1 Replies
View Related
Nov 23, 2013
I have a local student and international student class inherit from student class. read and print are virtual functions. After i have set all the member variables when i wan to print out all the student information, my program crashes.
Code: int main()
{
clsUniversityProgram objProgram[3];
for (int x = 0; x < 3; x++)
[Code] ....
View 4 Replies
View Related
Oct 28, 2013
My programs complies and runs. However, whenever i try to enter something when prompt to enter the number of accounts i wanted to create my program crashes.
By the way, im using codeblocks.
it says
terminated called after throwing an instance of 'std:: out of range'. what(): basic_string::substr"
Code:
#include <iostream>
#include "clsInterest.h"
#include "clsDate.h"
using namespace std;
[Code] .....
View 8 Replies
View Related
Jul 23, 2013
I have the text parser done, but when I use it, the program crashes. Just because of how I test my code, I know the section where it occurs, but I'm not sure what the exact problem is ( no errors or warning, so it's just something I don't see ). Here is the full code
Code: #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
[Code].....
I probably made a mistake in the way I allocated memory or tested values, but I'm not sure where it is in my code. Currently it just prints out "Failed to parse data on line 1" then crashes. Here is the text file I give to this program.
Code:
A#3 500 A#3 500 A#3 500
rest 1000
B#4 500 C3 500
View 7 Replies
View Related
Mar 25, 2014
I'm trying to code a Singly-Linked List(Double Pointers) selection sort program and I can't tell what the problem is. My compiler says no errors but when I run the program, it crashes right after I enter the values.
Code:
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
typedef struct node{
int elem;
struct node* link;
[Code] ....
The compiler that I'm using is Dev-C++.
View 2 Replies
View Related
Feb 9, 2015
i wrote a little program with fseek. It works good till it reaches the first fseek(). Then it crashes and stops responding.My code:
ifstream inp("myfile.txt");
if(!inp.is_open()) return false;
inp.close();
FILE *f;
fopen("myfile.txt","rb");
[code].....
View 2 Replies
View Related
Jan 12, 2013
int main() {
int vnum = 0;
VEHICLE *vehiptr;
VEHICLE *dptr;
cout<<"Please enter the number of vehicle: ";
cin>>vnum;
vehiptr = new VEHICLE[vnum];
[Code] .....
View 9 Replies
View Related
May 6, 2014
#include <iostream>
#include <string>
#include <limits> //for std: numeric limits
#include <algorithm>
//Function to get an integer from the user that is greater than or equal to zero.
int getPositiveIntFromUser(const std::string& prompt) {
int retVal = -1;
[Code] ....
The first part works, but it doesn't calculate the GCD or LCM at all, it just crashes!
View 2 Replies
View Related
May 28, 2013
My app crashes when I attempt to create a CWnd as shown below. I am attempting to create the CWnd with a a parent of type CFormView. Why this might be crashing?
Code:
CWnd::Create(AfxRegisterWndClass(CS_DBLCLKS), CString(windowName.c_str()), WS_VISIBLE | WS_BORDER, dimensions, parent, NULL, NULL);
The call stack looks like this:
Code:
mfc100ud.dll!AfxGetInstanceHandle() Line 21 + 0x20 bytesC++
mfc100ud.dll!AfxRegisterWndClass(unsigned int nClassStyle, HICON__ * hCursor, HBRUSH__ * hbrBackground, HICON__ * hIcon) Line 1462 + 0x5 bytesC++
And the line that crashes here us the AfxGetInstanceHandle() call:
Code:
LPCTSTR AFXAPI AfxRegisterWndClass(UINT nClassStyle,
HCURSOR hCursor, HBRUSH hbrBackground, HICON hIcon) {
// Returns a temporary string name for the class
// Save in a CString if you want to use it for a long time
LPTSTR lpszName = AfxGetThreadState()->m_szTempClassName;
// generate a synthetic name for this class
HINSTANCE hInst = AfxGetInstanceHandle();
View 11 Replies
View Related
Mar 1, 2014
I having some issues with two different programs here... One of them crashes and returns random negative numbers whenever it reaches a "fscanf" function and the other displays a "Polink fatal error: access denied" error.
Code:
/* Evan Wentz */
/* Pike - ET2560 */
#include <stdio.h>
#define MAX_ACCTS 100
int accounts [];
double balances [];
[Code] ....
I thought the reason this kept crashing before was because I didn't type the data into the text file it was writing too correctly, but I made another program to do that, and it crashed whenever it got to fprintf. Program works perfect besides the file stuff...
View 6 Replies
View Related
May 5, 2013
Why program crashes when reading linked List from file?
#include <iostream>
#include <fstream>
using namespace std;
struct link{
int data;
link* next;
[Code] .....
View 4 Replies
View Related
Mar 11, 2013
The code below is for reversing every k nodes of the linked list. While running the Program it crashes.
Code:
#include<stdio.h>
#include<stdlib.h>
struct node {
int info;
struct node *next;
[Code] ....
View 1 Replies
View Related
Aug 26, 2013
I want to know that how objects of two different classes interact with each other???
View 1 Replies
View Related
Dec 4, 2014
We are tasked to create a program that will take racing times from the user from two different teams. Then determine who is the winner of the specific race. The race times are placed into an array, and I have the information being placed in the array correct but I am unsure on how to access it with an equation to determine the winner
static void Main(string[] args)
{
//Declare Variables
[Code]...
This is the code so far, and I really don't want writing ALL of the code just this hurtle I am coming to at the moment
View 11 Replies
View Related
Feb 26, 2015
Any way to interact with websites such as Freelancer or fiverr. I mean when someone posts new topic i'll search in the topic if the name contains keywords like 'programming' then i'll notify the client that there is a new subject he can works on . Is there a way to do this in c#?
View 12 Replies
View Related
May 6, 2013
What I'm doing is giving the user the choice to show 2 different dates. 1 in yyyy-mm-dd notation and the other in dd-mm-yyyy notation.
I'm using a second form to do this.
So from Form1 I have my data in the datagrid and in Form2 I have 2 radio buttons giving the user the choice between Date1 and Date2. So how would I be able to interact with the first form with the radio buttons?
View 10 Replies
View Related
Mar 20, 2014
Which command should i use for displaying a jpeg image in Visual Studio 2008 (VC++)?In the past i used LoadImage function for displaying Bitmaps.
View 14 Replies
View Related
Apr 13, 2013
I'm making a very first program. It's very little more then a simplistic calculator, but i'm having a problem with the cout function. It won't display any text what could the reasons be?
#include <iostream>
#include <string>
#include <sstream>
using namespacestd;
int main () {
do {
int(a);
[Code]...
Oh and i'm aware it's still riddled with numerous problems, I just have been working on the cout thing first.
View 3 Replies
View Related
Oct 21, 2013
I am new to coding and have a question with my if else statement. This is a VERY simple program that I have made something like in Javascript before, but when I do it in C++ it does not work correctly. It displays both the options. Here is my code.
// Practice.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
using namespace std;
int main()
// Asking for a number {
int x;
[Code] ....
View 14 Replies
View Related
Mar 11, 2014
My requirement is,
Read *.bmp image and displaying bitmap image with scrollbar in a MFC dialog application.
I was done using this
I was read the *.bmp image as a pixel data and stored by 2D Array,
Now i want to Display this 2D array as bitmap image with scrollbar separately in the same dialog. How can i display bitmap with scrollbar using 2D array?
View 10 Replies
View Related
Feb 27, 2013
I made a dialog to have a customizable msgbox. (custom icon, custom caption on buttons). This is how I try to display an icon on the dialog but it is not working.
HICON hIcon = LoadIcon(NULL, IDI_QUESTION);
HWND hImageCtl = GetDlgItem(hDlg, IDC_STATIC);
::SendMessage(hImageCtl, STM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
//SendDlgItemMessage(hDlg, IDC_STATIC, STM_SETICON, (WPARAM) hIcon, 0);
View 5 Replies
View Related