Visual C++ :: Define A Range Of Exit Codes In Application?

Feb 10, 2015

I want to define a range of exit codes in my application. These codes will be used as a return value of ExitInstance function. I want to know the exit codes availables (values not used for example by windows to inform about an other error). When I force to crash my application, I get some different error codes: 8148, 10176.

What is the no available range exit codes?

Is this the ranges code unavailable?

[URL]

View 1 Replies


ADVERTISEMENT

Visual C++ :: Exit Application Using Thread In MFC SDI

Feb 4, 2014

I have a SDI application. I created a method OnClose to handle ON_WM_CLOSE of CMainFrm. This onclose() function calls a method in cmyview.cpp. Here, I created a thread that calls global function and from this function it calls another function in cmyview.cpp. At certain condition my application should close at here, I used postmessgae(WM_CLOSE (or) WM_DESTROY). I am having an error as object reference not set on postmessage(WM_CLOSE) it is going to afxwin2.inl page where exception occurs.

Below is code snippetHere, either j or k will only be true depneds on user input)

MainFrm.cpp:
void CMainFrame::OnClose()
{
CMyView* pview = (CMyView*)((CFrameWnd*)AfxGetMainWnd())->GetActiveView();
pview->method1();
}

[Code]...

View 3 Replies View Related

Visual C++ :: How To Define Name Range With Excel Automation

Mar 4, 2015

Using Excel Automation in Visual Studio 2010 C++, how do I define a name? As a user of Excel, you can enter a name that then can be used in formulas to refer to a range of cells. The range changes as the user inserts columns or rows. My program has worked with various versions of Excel dating back to the early 2000's.

I have a bunch of classes derived from COleDispatchDriver: CXLApplication, CXLRange, CXLWorkbook, CXLWorkbooks, and CXLWorksheet that have many functions, but I have no documentation... How to define a named range using functions of these classes (probably CXLRange)?

View 6 Replies View Related

C++ :: Detecting Application Startup And Exit Events?

Apr 20, 2012

I have written ( using VS2008 c++ ) a windows service which sends information about PC usage to a central database, as part of a PC availability setup. I have been asked to add the following functionality to it:

1) What applications are most used, when and how long for, and

2) What web sites are being accessed, again to find the most popular etc.

My main question is, what functionality is there to trap application start / close events from within my service ( just need the application name ), and secondly I am already using sockets to send information to a PHP script on a server, the best way to see what web pages are being accessed is to build in a packet sniffer, and extract the information from that.

View 6 Replies View Related

C++ :: Define Entry Point For Console Application - Printing Info Value Of Body

Aug 8, 2013

// First_VB_Prog.cpp : Defines the entry point for the console application.//

#include <iostream>
using namespace std;
//Simple Linked List composing of a "Body" , "Head" and a "Tail"
struct nodeType {

[Code] .....

View 3 Replies View Related

Visual C++ :: Modeless CMFCPropertySheet Not Being Cleaned On App Exit

Oct 20, 2013

I have a Modeless CMFCPropertySheet created and opened from the main frame. if I open the Modeless CMFCPropertySheet and close it then it's fine all the cleanup is performed through the destructor and the this pointer gets deleted. If I exit the app while the Modeless CMFCPropertySheet is open then the Modeless CMFCPropertySheet gets destroyed but the cleanup is not performed resulting in memory leaks for the pages. How can I make sure the cleanup is performed in that given scenario?

View 2 Replies View Related

Visual C++ :: Exit From DLL Function When Error Is Encountered?

Oct 23, 2012

Say I have a dll that performs some mathematical parsing and calculations. The calling function is only a single C -linkage wrapper function in the dll. I can anticipate likely errors and program the dll methods to do several things when an anticipated error is encountered. (For now, let's not worry about unanticipated errors).

1 - send an error message to the user application using WM_COPYDATA
2 - throw an exception (assuming the calling app has used the try catch scenario)
3 - try to gracefully recover from the error within the dll and keep on going (jump to some safe place - but how ??)
4 - don't throw an exception from within the dll but halt the program (not very nice - the user won't know what happened)

Previous discussions on the matter have predominantly expressed the opinion that it is bad to throw exceptions from within a dll.

Long ago there was in use setjmp.h and something like

Code: if(setjmp(e_buf)) return -1;

But I believe this was only for old C applications - I'm not really sure. But at least someone back then recognized the need for getting back to a safe place in a process.

View 8 Replies View Related

Visual C++ :: Error / M4 Failed With Exit Code 255

Dec 8, 2013

Basically, I'm moving a VC project from my Windows 7 build machine to a new build machine that's running Windows 8.1. One of the pre-build steps (for a particular project) runs a script which needs to call the M4 macro processor (which is installed on my C: drive). I've been pretty careful to set everything up the same on both machines (including my PATH) but when I try to build the project on my Windows 8 box, MSVC's IDE shows me this error output when running the script:-

m4 failed with exit code 255

View 5 Replies View Related

Visual C++ :: How To Define A Hash Map

May 15, 2014

I want a speed of O(1) in search, insertion and deletion.

is std::map<> the way to go?

View 4 Replies View Related

Visual C++ :: Range And Incrementation

Feb 6, 2015

So there is suppose to be a constant that shows the total number of values to be shown in this range. The user enters two values, lets say userMin is -2 and userMax is 2, it's suppose to add 0.2 to -2 and so on until it reaches 2. It starts doing that up until it reaches -1.0, then it goes to -0.9, -0.7.... etc, It also goes beyond 2.

Code:
#include <iostream>
#include <iomanip>
using namespace std;
int main() {
cout << fixed << setprecision(1);
float userMin;
float userMax;

[Code] .....

View 1 Replies View Related

Visual C++ :: Using Progress Bar With Large Set Range In MFC

Oct 5, 2014

I'm having problems with progress bar when using a big number in set range. For numbers below 50000 it works very well but for big numbers like 100.000 it doesn't work, it makes 2-3 rounds of animation

Code:
int number= 50000; // 50k works well but if i put 100k it won't work (it will animate 2-3 rounds instead of complete one)
progressbar1.SetRange(0, number);
progressbar1.SetStep(1);
for (int i = 0; i < number; ++i) {
listcontrol1.InsertItem(i, _T("whatever"));
progressbar1.StepIt();
}

What's wrong with the code ?

View 5 Replies View Related

Visual C++ :: Error / String Subscript Out Of Range

Nov 3, 2014

I have an assignment where i have to prompt the user to enter the name of a file then open that file and read names of students and what level they are at university

eg : John Wilkins, sophomore
Dan Robertson, junior
etc..

i did the code and it compiles perfectly, but when i input the name of the file it gives me error: string subscript out of range.

here's the code:

Code:
#include <iostream>
#include <cstring>
#include <string>
#include<ctime>
#include <fstream>
using namespace std;
int * read_file(string filename)

[code]...

View 2 Replies View Related

Visual C++ :: PrintDlg With Special Page Range

Mar 24, 2014

In my app the user can select the pages to print by typing in a start and an end page. I think this is the standard dialog.

How can I give the user the possibility to select e.g. page "1,2,6-9" like in Word?

View 4 Replies View Related

Visual C++ :: Generating Lottery Numbers In Specified Range

Dec 4, 2012

Write a function named generateLotteryNumbers. The function is passed an int array of size 5. The function should generate 5 different lottery numbers in the range 1 to 50 inclusive and place the numbers in the array. The declaration is as follows:

void generateLotteryNumbers (int lotteryNumbers []);

Note that no data is passed in to the function. The array is used to return the function results. Thus the parameter is an OUT parameter. Do not display the result. Return the result.

Do not seed the random number generator inside the function. If you seed the random number generator inside the function and the function is called many times in the same second, your function will return the same results each time it is called.

I know how to generate the numbers in the specified range but I do not know how to test for duplicates. Here is the code I have so far:

Code:
//This program will test the "generateLotteryNumbers" function
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
void generateLotteryNumbers (int lotteryNumbers[]);

[Code] ....

When I try to compile this, my compiler tells me that lines 41 and 46 require an array or pointer type.

View 8 Replies View Related

Visual C++ :: Process Wider Date Range Than COleDateTime

Apr 24, 2013

I have a ULONGLONG variable uDate which express the number of dates starting from 0001-01-01, up to 9999-12-31. Now I want to convert it into a string like this

"yyyy-mm-dd"

However, the COleDateTime can only express the date from 100 to 9999, smaller than what I need. So are there any third-party classes or libraries that can express this. Or make the conversion from uDate to CString?

View 1 Replies View Related

C :: Vector Usage In Codes

Sep 19, 2014

Now i am utilizing vectors in my codes.If i want to make a vector and i use #define to put a limit on the amount of variables it can contain. Until now i can do that. But let's suppose that i put 40 variables as its max capacity, but an user just needs to use only 12 or 14 variables. Put a rule that if someone has finished inserting his data and he is yet to fill the whole capacity of the vector the code.As to say : "If case you want to end press 0" .Edited : My computer has windows 7 and i took Codeblocks as my editor.

View 2 Replies View Related

C++ :: Stopping Codes With A Key Press

Feb 25, 2013

I have a program that I made, which does a list of stuff, then checks if a key is pressed, and if it's pressed, stop the looping.

The problem is, it checks if the key is pressed once a loop, which means that if the list has delays, you have to hold the button down for a while (depending on the list).

Here's an example:
Move mouse;
Pause program for 2 seconds;
Move mouse;
Pause program for 2 seconds;
Check if key is pressed;

What ways can I fix this problem?

View 1 Replies View Related

C :: Creating Table With ASCII Codes?

Apr 6, 2014

I have a C program where I rapprendentare a table using a 10x10 matrix and create the chart with the game piece and the matrix in a spiral. I do not know how to start or even how to create the table with the ascii codes. is a task for school and I need to do it soon.

View 1 Replies View Related

C++ ::  displaying ASCII Codes In 2D Array?

Apr 20, 2014

this is my original code:

#include <iostream>
#include<fstream>
#include <string>
using namespace std;
string display(string);
main() {

[code]....

here is what it does;it reads from a text file and converts the characters to ascii numbers and stores them in 1D array.what I am trying to is storing these ascii codes in 2D array.

View 5 Replies View Related

C/C++ :: Sorting Characters In Their ASCII Codes

Mar 25, 2015

I'm trying to write a lot of sample code to practice but I can not figure out how to take a string and sort each character in order of their increasing ASCII codes. I'm getting stuck trying to separate each letter to determine it's ASCII code. I know I have to use an array somehow, So far, this is my code:

#include <stdio.h>
#include <stdlib.h>
#define _CRT_SECURE_NO_WARNINGS

[Code].....

View 4 Replies View Related

C++ :: Store HTML Codes For Different Characters In Array

Jul 17, 2013

I am trying to store the HTML codes for different characters in an array, but I am not sure how to do this, so that when using the keybd_event it can be plugged in.

If you try to do it with a string for storing the HTML code, you get this error.

string HTML[1];
HTML[0] = "A"; //A
keybd_event(HTML[0], 0, 0, 0);

I could do it in a very long if/else statement, but this would be much easier to call and get data from, and take up less space.

View 1 Replies View Related

C/C++ :: How To Access Files Of A Computer Through Batch Operating Codes

Oct 21, 2013

How to use c programming codes or batch operating codes to access files from our computer.

View 1 Replies View Related

Visual C++ :: Run MFC Application From Console?

Feb 7, 2013

I have a question about to run an MFC dialog based C++ application from console: if I run my application from console, I see the application start and the console immediately back to prompt. I need that console wait the application exit before show me the prompt again. I tried on Visual Studio 6, 2005 and 2010 but the behavior is the same.

View 3 Replies View Related

Visual C++ :: Two ChlidFrames In One MDI Application?

Jun 23, 2014

I want to achieve such an efect like - one view which takes all MDI area and some views which arelike non modal dialogs

Two Child frames will be correct? one for "big" view which will be always visible and second for a "smal" views

View 2 Replies View Related

Visual C++ :: How To Fit MDI Application On Smaller Laptop

Mar 23, 2013

We have developed MDI application on 17 inch monitor in VC++ 2010 MFC. But now management wants application to run on 10 inch laptop.

Application does not fit,it goes out of screen. How to fit application on smaller screen

View 1 Replies View Related

Visual C++ :: How To Pass CStringArray From Application To DLL

Feb 11, 2013

I passed the CStringArray to dll & wrote the String in a file.

The error File: array_s.cpp, Line No: 420 was occured when i close the .exe file.

For your reference:

Code:
Function Declaration in DLL :
DECLDIR void SetParName(CStringArray& ParName);
Function Definition in DLL :
DECLDIR void SetParName(CStringArray& ParName){

ParName.Add("X1");
ParName.Add("X2");

[Vode] .....

My doubt is, CStringArray items are allocated in the DLL. So, when i release the CStringArray object in the application. Is it can release memory that are allocated in the DLL ?

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved