C++ :: GUI That Will Allow User To Conveniently Invoke Executable
Feb 12, 2013
I use g++ compiler and need some tips on how to get started with making a c++ GUI. The project I have will need a gui that will allow the user to conveniently invoke executable (the command-line args they take are long and inconvenient to enter manually) and basically print their output streams into a control (e.g. read only textbox). There will be a few graphics involved too (the input for those graphics will be from a file), so I'll need a library that will allow drawLine methods (nothing too fancy, I don't need a gaming library).
Making a GUI in c++. In Java the ability to make a GUI is a part of the native library, so the c++ way seems foreign to me.
View 2 Replies
ADVERTISEMENT
Sep 24, 2014
I wrote out this coding to deal with template functions, but how would I invoke the function and to display the statements which im trying to invoke?
#include <cstdlib>
#include <iostream>
using namespace std;
#include <string>
[Code].....
View 2 Replies
View Related
Jun 12, 2012
I'm using MS' optimizing compiler CL 13.10 (one from VCToolkit 2003) along with WinAPI threading functions and is being compiled as a C console program.
I was wondering how to implement threading in a production setting? I've seen and tried various examples, but they all show basically the same thing - startup in main, run their function, clean up, and then the program exits.
I don't know the proper terminology, but I was looking for two maybe three functions to run simultaneously with a loop in main. I tried a small test program and was wondering if it's setup correctly.
A structure is used as the argument for each function.
int running = 1; // global variable
DWORD WINAPI function_1(LPVOID);
DWORD WINAPI function_2(LPVOID);
main() {
HANDLE hndThreads[2];
DWORD threadIDs[2];
[code].....
Right now, function_2 is just a copy of function_1's definition. Everything *appears* to do what I want, but is it setup correctly?
View 2 Replies
View Related
Nov 26, 2012
I am trying to build a web application that uses p/invoke to access a method. Similiar to the one used here - [URL] However I keep getting the following error message - Unable to load DLL 'MyDll.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E) I read say to change the output directory to match that of the Mydll directory I have tried that and it still does not work.
View 6 Replies
View Related
Jun 25, 2014
I am having problems invoking methods in a nested class using reflection. I have the following:
A parent class, Group, that holds instances of a simple class called Signal. I want to modify the number of instances inside the group class often. So, all my code has to be dynamic and use reflection to know how many instances of signal there are inside the Group class.
class Group{
public static Signal name1 { get; set; }
public static Signal name2 { get; set; }
public static Signal name3 { get; set; }
[Code]....
I had no luck invoking the method of the instances of signal class that are inside the Group class. I tried getting the methods name using getMethods() but could not navigate through the syntax.
How could I invoke and pass parameters to the method of the instances of signal using reflection? Is there a better way of accessing the properties and methods of nested classes?
View 4 Replies
View Related
Jul 25, 2014
I want to override the operator new in a class, as follows:
class CMyclass
{
public:
void* operator new(size_t);
void operator delete(void*);
[Code]....
However, in debug version, whenever MemoryManager.Alloc(size) returns NULL, which means alloation fails, the AfxThrowMemoryException will cause the following exception:
Access violation reading location 0x#######
View 2 Replies
View Related
May 6, 2013
I have main thread that creates an WebBrowser2 COM object. and i want to invoke JScript functions on it from another thread. i try to use GIT but still doesn't work for me.. there is a problem with marshal WebBrowser2 for JScript?
View 4 Replies
View Related
Sep 8, 2014
i have seen a lot of programs that have images inside their exe, dont use external ones. I tried to add image in my codeblocks project, but trying to use it failed. It seems that to use a resource i have to add some kind of header file, but how to do this???
View 2 Replies
View Related
Aug 16, 2014
I have started to move over to using Unicode, wide character null-terminated strings in my Windows programmes. Accordingly I set the Use Unicode Character Set Visual C++ compiler option. It is my understanding that once you do that the many macros which determine whether you transparently call ...A() or ...W() API functions automatically shift over to calling the wide character variants. As this is a compiler directive, all the choices are made and hardcoded in to the resultant executable at compile/link-time BEFORE it is ever run. Therefore using for example the macro OpenFileName() in the source code instead of specifically calling OpenFileNameW() has no impact on run-time performance.
The next logical step, instead of explicitly using wchar_t is to declare null-terminated string character arrays as TCHAR*. Then, so long as I also employ the tcn... variants of CRT string functions and call TEXT() or _T() macros to create string literals the preprocessor will chose, again transparently whether to create an executable using standard multibyte or unicode wide characters - and their associated functions - all determined by the Use Unicode Character Set switch. That way I can cover both eventualities with the same source code.
So, with all that - I THINK!!! - properly under by belt, I am fairly sure that using TCHAR and its friends will not effect run-time performance at all. However, in his otherwise excellent article the author makes it sound as if using Unicode EXPLICITLY through wchar_t, ...W() API functions and tcn... CRT calls is faster than the TCHAR alternative.
At the end of the day my question is - have I got the right end of the stick; TCHAR makes no difference to executable performance?
View 4 Replies
View Related
Mar 20, 2015
I'm trying to step through the machine instructions of a c program. This program needs to be run with a -t flag.
This is what I tried
gdbtui
file prog
layout asm
start
stepi
When I try 'file prog -t' it doesn't work.
View 4 Replies
View Related
Aug 30, 2013
I would like to programmatically monitor a directory for new files, and if the file happens to be an executable, I want to prevent it from running. Something like a AV program.
However, I don't know where to start. Simple is best.
View 9 Replies
View Related
May 22, 2013
I am just wondering if it is possible to send a project to someone via email - In a simple way, almost like you would install software from the internet, maybe a setup file, or something. The compiler I use "Dev C++" creates a .cpp file and an executable. Unfortunately, I cannot send that .exe file. How would you recommend sharing a program?
View 5 Replies
View Related
Feb 3, 2014
I have the following code
#include "../header/FileIO.hpp"
#include <fstream>
#include <stdexcept>
#include <iostream>
std::string FileIO::ReadTXT(std::string filePath){
std::ifstream input(filePath.c_str());
[Code] ....
When I run it in Eclipse, it does not open an SDL window, and simply says <Terminated> Test.exe [C/C++ Application]. I can build the project successfully, but it simply won't run. There are no errors displayed.
HOWEVER, if I replace the above code with the code below, it runs fine, and creates an SDL window.
#include "../header/FileIO.hpp"
#include <fstream>
#include <stdexcept>
#include <iostream>
std::string FileIO::ReadTXT(std::string filePath) {
std::string output;
return output;
}
To make things weirder, if I run it in debug mode, even with the first piece of code, it will run and open an SDL window.
On an unrelated note, what does " Can't find a source file at "e:pgiawsrcpkgmingwrt-4.0.3-1-mingw32-srcld/../mingwrt-4.0.3-1-mingw32-src/src/libcrt/crt/main.c"
Locate the file or edit the source lookup path to include its location." mean? I am using Windows 8, MinGW, GDB 7.6.1-1, G++ 4.8.1-4, and MSYS 1.0.1 with Eclipse CDT.
View 3 Replies
View Related
Feb 16, 2013
I develop a software using QT 5 open source IDE. Now my question is two-fold:
1. How can I create the final executable file that I can upload for my users? I understand that runtime DLLs shall be required and I have tried Enigma Virtual Box software for bundling runtime files. It does create the file that I can execute from any folder in my PC. However, surprisingly when I transfer that "boxed" file to another PC, it does not run. Both the PCs have Windows 7 installed on them.
2. Secondly, I see possible future issues with Antivirus Softwares. Apparently when I try to run the boxed exe file, it gets rejected by the Antivirus Software on my PC. Is there a way in which I can get my exe file verified/checked/registered by the Antivirus Softwares so that my users don't face any problems in executing the program.
I cannot afford the QT commercial licence, but I am prepared to buy any economical "setup file generating" software (if it exists).
View 1 Replies
View Related
Jul 30, 2014
I'm writing a program that needs to parse executable files. I've got an "executable" base-class, and currently an "elf" class which inherits from it for parsing ELF files, and I will add more parsers (COM, MZ, PE, a.out, MACH-O, whatever) later on.
I want the program to automatically detect which kind of executable it's loading at runtime. It should be easy because every executable format I'm aware of/plan to support starts with a magic number. But because I can't have the parsers not check the file type (what if I re-use the code?), and I don't want to check each file twice (not just for performance, but also because only the ELF parser should know that ELF files start with "x7fELF", etc.) so I've come up with a pretty lazy solution: just try to parse the file with each known parser and have them throw an exception ("exe_type_error") if they can't parse it. If that exception gets thrown, try the next parser; if not, stop.
The remaining problem is how, at runtime, my program will know what parsers are available. I don't want to hard-code it in the main function; instead, I'd like the parsers to "register" themselves as available. That way, if I decide to go down the route of adding new parsers via dynamic linking, I will only have to add an API for dynamic libraries to register their parser, without recompiling any of the main program's code. I also want to do the same thing for another key part of the program (it's a static executable optimizer; it will run a series of "tests" (e.g. "is xor eax, eax faster than mov eax, 0 on this machine?") and optimizations ("if yes, change all mov eax, 0 to xor eax, eax") and I want to load those at runtime too).
View 11 Replies
View Related
Mar 30, 2014
I am writing a program which compresses files into .zip files.
Here's my problem: Whenever I want to compress an executable file, my readFile function does not read the entire file. When I extract the .exe I get a very tiny and incomplete file.
Here's the function I use to read files:
std::string miniz_wrapper::readFile(FILE* f, int MAX_FILEBUFFER)
//MAX_FILEBUFFER has a default value of 65536 {
char* tmp;
std::string tmp_s;
int count = 0;
[Code] .....
Prior to reading, every file is opened using fopen with the mode "rb".
View 6 Replies
View Related
Jun 19, 2014
I am looking at reducing the size of a compiled executable for easier distribution.
What factors affect the size of an output executable?
Would literally having defined and implemented less functions, would make the exec. smaller? Meaning that instead of have a DLL ( yes im on windows ), I would download the source code of a library and comment out the functions ( and code ) that I am not using -- Would this process decrease the size of my exec.?
View 2 Replies
View Related
Oct 6, 2014
Im writing a scientific software where I like to sent a 2D array (5x4) over a named pipe from a server to a client. When im sending a static array (i.e., double res[5][4];), all goes fine and it works perfect, but when I allocate a dynamic array, it provides some nonsense numbers at the client side. I feel it might be caused because I point to a memory that cannot be shared through a pipe. Am I right and how can I pass the dynamic allocated array itself over the pipe.
//Server program
// Create a pipe to send/receive data
HANDLE pipe = CreateNamedPipe(
"\.pipemy_pipe", // name of the pipe
PIPE_ACCESS_DUPLEX, // 2-way pipe -- send and read
PIPE_TYPE_BYTE, // send data as a byte stream
1, // only allow 1 instance of this pipe
0, // no outbound buffer
[Code] .....
View 2 Replies
View Related
Jul 10, 2013
So I wrote a program to turn a binary file's data into an unsigned character array for inclusion in an executable. It works just super.
I'm wondering how I can write a program that will perform this operation on every file in a directory and all it's sub-directories so that I can I can include everything I need all at ounce.
View 9 Replies
View Related
May 21, 2014
I have been working a project in C++. I have TTTMain.cpp file that has all the function calls, TTTFuntions.cpp that has all the functions, I have TTT.h file that has all the prototypes and variables and additionally I have Winner.h that has enum class Winner declaration in it. Here is my block of codes:
Winner.h file:
#ifndef winner
#define winner
enum class Winner {
[Code]....
My question is when I compile this gives me error on
Winner gameSquares[] = { Empty, Empty,Empty, Empty, Empty, Empty, Empty, Empty, Empty };
with saying "invalid use of non-static data data member" and It says "Empty was not declared in this scope."
I know calling enum is very very trick.
View 3 Replies
View Related
Nov 1, 2014
I am making program that allows the user to determine how big the array size will be and then asks the user to make up numbers to fill the array. Every time run the program on Dev C++ it says "program has stopped working"
Heres My Code:
//Assignment 19 Program 2
#include <iostream>
using namespace std;
int main()
[Code].....
View 3 Replies
View Related
May 3, 2013
I am working on a program where a user first enters a key of 26 characters, they then choose the number of lines they'd like to use with a max length of 40. Once they have entered the key and chosen the number of lines, they then enter text into the chosen number of lines, before that text is ultimately encrypted. I have it working as far as accepting the user's 26-character key, accepting their choice for number of lines, but when the user is typing in their lines of text, it only allows 6 lines before it moves to where the text would be encrypted.
View 3 Replies
View Related
Nov 3, 2013
i want to get the user to name the file but i dont know how to do that i know how i can name it but i want the user to name it. heres the source
#include <iostream>
#include <fstream>
#include <string>
#include <cstdlib>
[Code].....
View 3 Replies
View Related
Jun 25, 2014
I'm using a Global Hot Key. I have the code working for this but currently it is hard codedset to this:
RegisterHotKey(_hWnd, 1, (uint)fsModifiers.Control, (uint)Keys.Insert);
All of the examples and tutorials I have seen tell you how to code for a Global Hot Key but I have not seen eany examples of how to make it changeable.
I have 2 comboBoxes: one for Shift, Control and Alt or blank. The other is a list of keys such as F1..F12, etc.
I'm not sure how to set a new hotkey based on the comboBoxes selected.
Do I have to create a monster switch statement to catch every possible combination or is there some kind of short cut coding to still use the one RegisterHotKey statement?
View 9 Replies
View Related
Jan 1, 2014
In this simple end-of-chapter problem, the ages of two people are to be compared and determine who's older. The problem I'm experiencing is that the second user name input is being skipped and going straight to the second users age.
So while running the program it looks something like:
What is user ones name?
<input name>
How old are they?
<input age>
What is user twos name?
How old are they?
<input age>
<if statement result>
Here's my code:
Code: #include <iostream>
#include <string>
using namespace std;
int user_one_age;
int user_two_age;
string user_one_name;
string user_two_name;
[code].....
View 9 Replies
View Related
Oct 12, 2014
I am not sure why I am receiving the error message:
Error C2466: cannot allocate an array of constant size 0
When I run the code:
Code:
int s;
cout<<"Enter the size:
";
cin>>s;
int array[s];
C++ masters,
View 7 Replies
View Related