C# :: Console App Won't Close

Dec 22, 2014

Im having a problem with the below code within a console app, I am copying and pasting data across server locations, the copy works fine but it looks like the app wont close and I am left with the screen (Shown in attachment). I want to run this in part of a batch process but because the app stay open it wont move onto the next task.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
namespace SQL_Backup_Move_Files {

[Code] ....

View 3 Replies


ADVERTISEMENT

C# :: How To Close Overlapped I/O Handle

Nov 6, 2012

Consider the following code which closes an overlapped I/O serial handle during application shutdown.

Code:

Win32Com.CancelIo(hPort);
Win32Com.CloseHandle(hPort);

It works fine under .NET 2.0 but after switching to .NET 4.0 it crashes on the CloseHandle. Removing CancelIO doesn't work.

What the correct way is to close an overlapped I/O handle? And why is there the difference between NET2.0 and 4.0?

View 5 Replies View Related

C++ :: RGB To HSL Saturation Close But Incorrect

Feb 9, 2014

Currently I am trying to convert RGB to HSL. Everything is working but the saturation value. It is always close to the correct value (usually less than 10 off). For example:

RGB:(196,72,84)
HSL:(354,-46,52)
Correct HSL(354,51,53)

CODE:

double s=0;
double l=0;
chroma=max-min; //works correctly

//LIGHTNESS
l=(max+min)/2;

//SATURATION
if(chroma==0) {s=0;}
else {s=chroma/(1-fabs(2*l-1));}

s=s*100.000000;
l=(l/255.000000)*100.000000;

View 5 Replies View Related

C# :: WPF Window Close Button

Dec 10, 2014

I've been doing some looking and this example seems like the common way to remove the close button on a wpf window. Other than catching the on_click event or using that example, is there no better way to disable/remove that button?

View 2 Replies View Related

C/C++ :: How To Get CTRL Z To Close A Pipe

Nov 9, 2012

My 'c' program reads each line of a .txt file, makes a few changes and then outputs the line of text (which are names). I want the contents to be sorted and did not want to bother writing my own sort. The program runs in a command prompt from inside a batch file for example:

sort | makelist.exe BluRay1.txt > sorted.txt
sort | makelist.exe Dvd1.txt >> sorted.txt
..etc..

I have to supply a ctrl-z manually to close the piping. I tried the following which did not work.

buffer[0] = 26;

printf("%c",buffer[0]);
//printf("^(z)");
fclose(stdout);
fclose(stdin);

I never got the above to work so I am avoiding piping and just do a redirect instead.

makelist.exe dvd1.txt > unsorted.txt
makelist.exe dvd2.txt >> unsorted.txt
sort < unsorted.txt > sorted.txt

..etc.

Just wondering if I could have gotten the ctrl-z thru the pipe using "C".

View 2 Replies View Related

C :: Code To Close And Reopen Explorer

Jun 11, 2013

I wanted to stop the user from having access to USB flash drive while my program is reading data from it.I thought i could do so by closing the explorer at the start of my program and reopening it at the end of it.C Code to close and reopen the explorer?Or how to ban access to the USB flash drive?

View 2 Replies View Related

C Sharp :: Cannot Close File With FileStream

Feb 11, 2015

FileStream obj = new FileStream(System.Convert.ToString(row.Cells["Lec_media"].Value), 
FileMode.Open, FileAccess.Read, FileShare.Read);      
 if (Startdate2 == JCM_NOW2) {
                    if (checkBox1.Checked == true)

[Code] ....

View 1 Replies View Related

Visual C++ :: Auto-close MSG Box - Without Button And Title

Apr 1, 2015

I referred Auto-close message box.

But i like to view the message box with out title bar and buttons. Is it possible?

View 4 Replies View Related

C# :: WPF Create Customize Close / Minimize / Maximize Button?

Jan 11, 2015

i want to create customize close/maximize/minimize button wpf. How can i do that?

View 3 Replies View Related

Visual C++ :: MFC CRecordset Heap Corruption Detected At Close

Oct 28, 2013

I recently upgraded my operating system from Windows XP to Windows 7 SP1 64 bit. We are using Visual Studio 2008 Professional Edition and Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production.

When I try to execute this code I am getting the below exceptions

HTML Code:
try {
CDatabase *pDatabase = CDatabaseConnection::getDatabaseConnectionProcessLog();
ORSProcessLog rsProcessLog(pDatabase);

[Code] .....

Where rsProcessLog is the CRecordset object using a successfully connected database pointer pDatabase

In 32- bit Debug version I get a message box at rsProcessLog.Close(); with the below text Debug Error

Program: ......Test.exe

HEAP CORRUPTION DETECTED: after Normal block (#506) at 0x0087F628. CRT detected that the application wrote to memory after end of heap buffer.

Memory allocated at f:ddvctoolsvc7libsshipatlmfcsrcmfcdbcore.cpp(2626)

(Please Retry to debug the application)

In 32- bit Release version I get a message box at rsProcessLog.Close(); with the below text Windows has triggered a breakpoint in Test.exe

This may be due to a corruption of the heap, which indicates a bug in Test.exe or any of the DLLS it has loaded.

This may also be due to the user pressing F12 while Test.exe has focus.

The output window may have more diagnostic information.

The above code was a working code in Windows XP with the rest of the env remaining the same and it continues to run in Windows XP but not in Windows 7.

View 9 Replies View Related

C# :: Login Then Close Form And Open Main Form

Aug 25, 2014

This is more of a Application Design question, Let's say I have Form1(Login), this is opened from Program.cs, when the user enters details, the Event Handler makes a instance of a class, adds the data and stores the instance within Program.cs class.

So the best thing to do here, is to close the Form1(Login) and open Form2(Main) via Program.cs so that I can send the List<Login> object with my Login instance objects to said form. This form will remain open throughout the applications use as it's like the main GUI for all the programs functions.

When I close this form, I may want to save some information before the application is terminated, so I may as well store the Login instances in Program.cs anyway.

Main stepping stone: Multiple (usually around 3 max) users can login this system if need be, which will mean closing Form2(Main) and then opening Form1(Login) so that once Form1 is closed it can recreate the From2(Main) form and pass the new List<Login> to that form.

What's the best way to do this, at the moment i'm creating the Form2 instance like so:

//....
//Detect the Login form being closed
loginForm.Closed += new EventHandler(OnLoginClosed);
//...
//Open the main form when the login is closed
private void OnLoginClosed(object sender, EventArgs e)

[Code] .....

This seems like it will work and do the job, but is there a better and cleaner way? The List<Login> will be passed to Forms which are created via Form2(Main) as this information will be needed. It's just that ive been told not to use Forms for too much data containment.

View 2 Replies View Related

Visual C++ :: Close CPropertySheet From Another CPropertySheet Property Page

Nov 4, 2014

I was opened CPropertySheet from main dialog at very first time, again i was opened the CPropertySheet from current PropertySheet's Page 1 using button click event.

How can i close these two sheets and go to main dialog.

I was used EndDialog(0);

Which goes to previous sheet only.

View 4 Replies View Related

C++ :: What Are File-open And File-close For

Aug 12, 2014

I wonder, why before accessing a file we need to have it opened, and after finishing with it, we need to close it?

If FileA is already open by PtrA, PtrB won't be able to open it as well until FileA is closed by PtrA?

When PtrA opens a file, are any extra resources allocated by that action?

View 4 Replies View Related

C++ :: Open Other EXE New Console?

Oct 11, 2014

Main console: qwer.exe
Secondary console: asdf.exe

System(c:asdf.exe);

I wanna open this asdf.exe new console. Not in the qwer.exe.

View 1 Replies View Related

C/C++ :: Console RPG SHA-256 Checksum

Jun 29, 2014

So I'm making a console rpg and after the task of making my save/load functions I began making a sha-256 checksum so the save file can't be edited. I've pretty much all of the code but when I save the game and the checksum of that save file with my save function, I go back to load it and it always goes to the statement that says the checksums do not match and when I check the chksum.dat the hash is the same every time, here is my code:

#include <iostream>
#include <conio.h>
#include <windows.h>
#include <string>
#include <stdlib.h>
#include <stdio.h>
#include <cstdlib>
#include <windows.h>
#include <fstream>
#include "sha256.h"
using namespace std;
void MaximizeWindow() {

[Code] .....

View 3 Replies View Related

C++ :: How To Use Mouse In Win32 Console

Jan 28, 2014

I want to show and control mouse in Win32 Console. What should I do? And I want to learn MFC programing.

View 3 Replies View Related

C++ :: Adding UI To Console Application

Apr 6, 2013

Any tutorials on adding a UI to a console application? All I really need is a button that will run one function every time I click it.

View 1 Replies View Related

C++ :: Output To Console And Log File

Apr 4, 2013

I have 18,000 lines of code that i would like to upgrade to include a log file. I want to replace the cout with a stream or something similar so that i can easily output to the console and to a log file at the same time with minimal change to 18,000 lines of code. I'm nearly there.

I used this post heavily as a reference; [URL] .... however it is highly incomplete and this is above my knowledge so I'm struggling somewhat.

I was able to get the bulk of it working with some guess work and modification to the code from that link.

For some reason i had to comment out "mstream(void);" and "~mstream(void);"

Also how to get :

mstream& operator<< (ostream& (*pfun)(ostream&)) {
pfun(coss);
pfun(cout);
return *this;
}

to work for endl as per the previous link. Not sure if i'm even putting it in the right place. Otherwise the code works fine for streaming to both locations and such. See the code below;

#include <iostream>
#include <fstream>
#include <string>
using namespace std;
class mstream {

[Code] ....

View 9 Replies View Related

C++ :: Console App - Outfile Results

Aug 5, 2013

I have created a game that functions correctly, however, for balancing and future changes, I would like to record results .txt document (its 1v1 btw). I already have code to determine who won and what I am looking for is some way to keep track of different match-ups for the different characters. Im looking for something like this:

loser
Winner char1 char2 char3
char1 3 2 5
char2 2 5 4
char3 8 1 2

the numbers are the amounts of wins a given character has over another character. I'm looking for code to open the .txt file and add 1 to the respective win total so I can do balance changes and such.

View 1 Replies View Related

C++ :: Console Applications Keep Crashing

Jan 11, 2013

Any time I run my program after I make a selection from the menu the output is printed on the console screen then immediately a windows screen comes up saying project.exe has stopped working.

Below is my code, and I suspect the error has something to either

A) due with how I'm calling the method or
B) how I have the method coded.

Main
#include <iostream>
#include <fstream>
#include <string>
#include "telephone.h"
#include "tbook.h"

[Code] .....

View 4 Replies View Related

C++ :: How To Stop Console From Pausing

Mar 6, 2014

Just a quick newbie question: I'm doing a console application and whenever I open a .exe using system(), the console pauses and does not run the next instruction until I close this exe. For example when I do this:

...
system("mspaint.exe");
printf("Hello");

It opens ms paint and does not print the next message until Paint is closed. How do I work around this?

View 1 Replies View Related

C++ :: How To Hide Console Or Terminal

Jul 2, 2013

I want to hide a terminal appliction or console application without using WinAPI programming or <windows.h> or something like "ShowWindow(hwnd_win,SW_HIDE);

View 19 Replies View Related

C++ :: How To Stop Displaying The Console

Mar 6, 2013

I am trying to display a messagebox, but instead of just displaying the message box, there is also a console the pops up. How do I prevent the console from popping up? I'm using Visual Studio 2012. I'm creating an empty project, but I still get the console.

View 1 Replies View Related

C++ :: Open More Than One Console In One Program

Oct 22, 2014

I am creating a console based application which needs to be dual tasking, which prompts me to share a single console for the GUI console based and inputs from the user.

I want to know if there is a mechanism through I can open more than one command prompt so that I would use efficiently both of them.

Furthermore, I would need also to know how to control on which to print and on which not to be printed.

Is there such a thing?

I am using Visual Studio 2012 Ultimate on a Windows 8.1 Professional PC.

View 1 Replies View Related

C++ :: How To Have Console Recognize Every Word

Apr 6, 2013

#include "stdafx.h"
#include <iostream>
#include <string>
using namespace std;

int x;
string favword;

[Code] ....

I want this program to be able to recognize if a user types in any word ex. (apple, tree, house etc..) and print "system error" if a word is recognized not to be a number. The bold section of code is my failed attempt to try this. Basically I need to know what to make

(x = ?(every word)) in order to finish my console program.

View 1 Replies View Related

C++ :: Hold Screen Via GUI To Console

May 15, 2013

I had a program (on console) that uses a third-part software to draw some graphs. In order to hold the graphs on the screen, I used cin.get(); and that worked.

Now I created a GUI with Qt. The code remains generally the same. The code continues to call the software to draw graphs (during drawing graphs, there is a console opened automatically). Butcin.get(); in the code cannot hold the graphs on screen anymore. The graphs appear and disappear immediately.

View 4 Replies View Related







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