C++ :: How To Set Console Window Size
Oct 28, 2013
Can I make my c++ application to open in a specific sized console window. I want to open my project in n a bigger screen so that all my output is visible. is there any way to do this...
View 6 Replies
ADVERTISEMENT
Nov 27, 2012
Change the frame window size according to font size increases.
View 3 Replies
View Related
Apr 24, 2013
I am writing a program for my beginning c++ class. It is supposed to create an invoice in the console window. so far, everything is working perfectly, except for one thing. My invoice comes out looking like this:
696.60 - 27 Adult Meals at $25.80 each.
+ 46.44 - 3 Child Meals at $15.48 each.
--------
743.04 - Total Cost of All Meals (Add the above numbers together)
+ 52.01 - Weekend Surcharge (743.04 x .07)
+143.11 - Tax/Tip ((743.04 + 52.01) x .18)
--------
938.16 - Total Party Cost
- 57.50 - Deposit Received
--------
880.66 - Balance Due
- 32.84 - 3.5% Prompt Payment Discount (938.16 x .035)
--------
847.83 - Balance Due (If Paid Within Ten Days)
The problem is that if I add these numbers on a calculator, I get as result of $847.82, not $847.83. I checked them individually and they are all being rounded properly. If I add them up using the entire decimal value of the calculations, rather than the truncated value, I get $847.83.
So, the question is as follows: In C++, how do I do each calculation, round the answer to 2 decimal places, then use only the rounded number in the next calculation?
View 14 Replies
View Related
Dec 17, 2011
I used the Console's CursorLeft and CursorTop properties to specify the exact areas of the screen where I wanted to print information. I ended up with a 'table' full of data.
Then I used the System.Diagnostics.Trace class and added a TextWriterTraceListener and a ConsoleTraceListener object to its Listeners collection.
Then I replaced all the instances of Console.Write with Trace.Write.
The data displayed as expected on the console. But on the text file the info was printed in the same order the info was outputted to the Console. ie: all the characters used to separate rows lumped together, followed by all the characters used to separate columns lumped together, followed by the actual data that was printed between those characters, all lumped together.
I can see why I ended up with this mess. The TextWriter is oblivious of the fact that the Console's cursor position was arbitrarily modified by the application code before and after each character and piece of data was printed to the Console.
Is there a way I can just grab the text that was printed to the console, ignoring the actual order in which the individual characters were printed, and save it as a string or directly print it to a file exactly as-it-is?
View 2 Replies
View Related
Feb 6, 2014
I used to use OutputDebugString, and not using it now because it only allows to strings to be outputted, are there any methods that I can dump virtually anything to the console?
cout << thing << endl;
But what if I am not start running the program from the command prompt?
View 2 Replies
View Related
Jul 4, 2014
I would like to find out a way to set the text and window sixe for the window in c++. I am using code::blocks compiler
View 4 Replies
View Related
Oct 23, 2014
Is there any way to resize the cmd window?
Kinda like in properties, where you choose the height and width of the window, but in actual code. So everybody who open my program see the same window.
View 1 Replies
View Related
May 18, 2013
Somehow I have expanded the "quick find" window in visual c++ 2010 and how to restore it to the original size.
View 2 Replies
View Related
Jun 6, 2013
I have created an exam environment for our schools, it comprises of 3 files; a .kix file that says if they are in the examination group run a .vbs file. The .vbs file kills the explorer.exe task so they don't have any taskbar or desktop shortcuts and then opens a .hta file.
The .hta file is a user interface that has icons for apps like Win Word that executes the application when you click on it. There is also a log off button.
Looking for some code that stops the students from being able to close, minimise and resize the window. Looking for code that can lock this down so they literally can't do anything except click the icons inside the window.
View 3 Replies
View Related
Feb 1, 2013
I must take an old MFC project in VC++ 6.0 and make changes.
The problem is text size in screen is different from size in print preview.
for example with this font
Code:
CFont f50;
f50.CreateFont(100,0,0,0,FW_BOLD,0,0,0,DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,FF_DONTCARE,"Frutiger LT Std 45 Light");
And this text
Code:
s=_T("Let's try to calculate the size of this text");
and with MM_LOMETRIC map mode
GetTextExtent() returns me:
On screen: (1595,99)
Ink printer + print preview: (1589,100)
PDFCreator + print preview: (1580,100)
comparing with screen size the height is bigger but lenght is smaller. I don't understand.
I can understand that different printers process the fonts in different way and then to have different lenghts. That's not the problem. The problem is I need to simulate in screen the same behaviour i will have on printer because these texts are being aligned in the document, and I don't want to see that the text si aligned different in text than in paper.
What can I do to render the text on screen with the same size I will have on the printer? Print preview is doing it. Should I change the font parameters? is something related with pixels per inch?
View 4 Replies
View Related
Jul 11, 2013
I was wondering why, in C, the sizeof of a struct is larger than the the sum of all the sizeofs of it's members. It only seems to be by a few bytes, but as a bit of a perfectionist I fine this a bit annoying.
View 1 Replies
View Related
Jul 20, 2013
I am trying to do two things that i have an issue with finding on google. the first is im trying to center the main window, but i cant figure out how to do it. secondly i want to make it full screen but the flag for setvideomode doesnt work. is there another way?
View 1 Replies
View Related
May 11, 2013
I want to make a window tgat stays always on top like that of a cybercafe software. A window that cannot be closed, minimised, deactivated, etc... with wxWidgets.
So far I've tried making a frame window with the wxSTAY_ON_TOP flag. It works, but not to perfection because, when i press the windows button, the start menu interferes with the window(and taskbar too). Also, the task manager, how to deactivate it.
- a wjndow that strictly stays on top
- deactivate task manager
View 3 Replies
View Related
Oct 15, 2014
how to make a window in C++? I am trying to make a program that has a boot screen but I want it to be in its own window because it will have it's own pictures in it and text inside too. So not in a terminal but inside a external window.
View 1 Replies
View Related
Jul 11, 2014
when i run it , it skips scanf and not allowing user to enter input.tried adding getchar(), fflush but nothing worked for me.
//file name : sort_array_of_structure.c
Code:
/*Write a program to accept records of the different states using array of structures. The structure should contain char state, population, literacy rate, and income. Display the state whose literacy rate is highest and whose income is highest.*/
#include <stdio.h>
#define M 50
struct state
{
char name[50];
long int population;
float literacyRate;
float income;
}
[code]....
View 3 Replies
View Related
Apr 28, 2014
There is only one thing I need here. When the paint program is opened I need it to automatically open it maximized. Other than that my code works perfectly for what I'm trying to build.
It has to be maximized so when a friend opens it after I send it to him, it auto maximizes and doesn't start drawing on his desktop.
#include <iostream>
#include <Windows.h>
using namespace std;
int main() {
system("start C:/Windows/System32/mspaint.exe");
FreeConsole();
Sleep(1000);
[Code] .....
View 3 Replies
View Related
May 16, 2013
using SFML in visual studio 2012 ... this code gives blinking window.
#include<iostream>
#include<SFMLGraphics.hpp>
using namespace std;
sf::RenderWindow window (sf::VideoMode(800,600),"GAME");
[Code]....
View 8 Replies
View Related
Sep 5, 2013
I've encountered a problem, whenever I debug the project, the window shown flickers with the image I'm trying to render and it doesn't respond (shows the loading cursor symbol) also the console window doesn't even open at all, Here's the code:
#include <iostream>
#include <SDL.h>
#include <SDL_image.h>
#include <SDL_mixer.h>
using namespace std;
int main(int argc, char** argv){
cout<<"HI!!!!"<<endl;
system("pause");
[code]....
View 7 Replies
View Related
Aug 16, 2014
I don't know how to get window title text of same process without setting a foreground window.
My code:
Using it, I get window handle.
struct handle_data {
unsigned long process_id;
HWND best_handle;
};
BOOL is_main_window(HWND handle) {
return GetWindow(handle, GW_OWNER) == (HWND)0 && IsWindowVisible(handle);
[Code] ....
This part doesn't work unless I use it with GetForegroundWindow(). But before using it, I have to set it. Is there any way to get window name without setting a foreground window?
unsigned long id = GetCurrentProcessId();
//HANDLE h = GetCurrentProcess();
HWND wind = find_main_window(id);
char window_title[256];
GetWindowText(wind, window_title, 256);
std::string txtt(window_title);
View 4 Replies
View Related
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
Oct 17, 2012
I am writing code to open every page in internet explorer and every page will be in new tab but my code open every page in separate window
I am using c#
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
[code].....
View 1 Replies
View Related
May 5, 2014
I want program to make bitmap from my Window. I also want to do add some additional steps which I will try to add later. But now I want to ask you how to fix the code. For some reason when I debug the code (break on line 73 of capture.cpp) there the pointer pBitmap is 0x00000000 . So how to correct the code to successfully capture Window? Here I give the complete codes:
stdafx.h
Code:
#pragma once
#include "targetver.h"
#include <stdio.h>
[Code].....
Feel free to set correct name of Window on line 17 for FindWindow() function.
PS: The code is remake of script to capture screen, which saved the bitmap to file. This is not what I want because I would be content if I could send (or maybe share!) the bitmap to ahk script which will ask my C++ program for the bitmap.
View 14 Replies
View Related
Mar 27, 2014
Im new to c#. In c++ I have made a window and painted it with dots and concentric circles, like a radar PPI screen. Trying to do this in c#, I can't find how to draw a single pixel on the window.
Also, what should I be drawing on: the form, panel, picturebox...?
View 2 Replies
View Related
Dec 19, 2014
I have created an scientific calculator application and I have a VBS script that runs some of the files. I want to create a C program that runs that VBS script. however, a command window flashes before the application opens. So basically I need a short C (or C++) program that runs a VBS script without a command window popping up. I am on Windows 8 and my compiler is GCC/G++ under cygwin. Here is what I have now that DOES NOT work.
Code:
#include <windows.h>
int main()
{
ShellExecute( NULL, NULL, "StartUp.vbs", NULL, NULL, SW_HIDE);
return 0;
}
View 2 Replies
View Related
Jun 24, 2014
My program accepts strings, places them in a vector and then "bleeps!" out words of my choosing, in this case, "broccoli". But I'm having trouble keeping the output window open even with my Keep_window_open() implementation.
#include "iostream"
#include "string"
#include "vector"
#include "algorithm"
#include "cmath"
using namespace std;
[code]....
View 2 Replies
View Related
Jul 10, 2014
I am having some issue with clearing cin buffer. The following code does not wait for me to see the output window and till I hit return character.
#include "iostream"
#include "stdio.h"
#include "math.h"
#include "string"
#include "sstream"
using namespace std;
[Code] ....
I tried
cin.flush, cin.ignore(numeric_limits<streamsize>::max(), '
'); cin.clear(); fflush(stdin);.
None of them worked
I am working on Microsoft visual studio express 2013 for windows desktop.
View 3 Replies
View Related