473,785 Members | 2,282 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Hooking up a GUI to a console application

Hi.

I'm trying to create a GUI for a console application I have (written by
someone else, but with permission to use it). The console application
gathers MIDI data from a port, and returns the data in the form of an
std::vector<uns igned char>.

What I need to do is get this console application to trigger different
buttons to light up on a GUI depending on the contents of the
std::vector<uns igned char(which is called "message"), but the console
application depends on being called forever, or until the user hits a
key to cancel.

My problem is, I'm not sure how to have the function loop forever
without crashing the application, or alternatively I need to know how I
can have a key press stop the function doing what its doing and go back
to being idle.

Can anyone point me in the right direction?

Jan 17 '07 #1
2 2022
"Bobrick" <pu******@gmail .comwrote in message
news:11******** *************@m 58g2000cwm.goog legroups.com
Hi.

I'm trying to create a GUI for a console application I have (written
by someone else, but with permission to use it). The console
application gathers MIDI data from a port, and returns the data in
the form of an std::vector<uns igned char>.

What I need to do is get this console application to trigger different
buttons to light up on a GUI depending on the contents of the
std::vector<uns igned char(which is called "message"), but the
console application depends on being called forever, or until the
user hits a key to cancel.

My problem is, I'm not sure how to have the function loop forever
without crashing the application, or alternatively I need to know how
I can have a key press stop the function doing what its doing and go
back to being idle.

Can anyone point me in the right direction?

This is not covered by standard C++ and you should ask in a newsgroup
concerned with the platform you are targeting.

The simplest approach is probably to create two threads; one would run the
console code largely unchanged and the other would run the GUI. Then you
just have to choose one of several approaches for communicating between the
two threads.

--
John Carson
Jan 17 '07 #2
Bobrick a écrit :
Hi.

I'm trying to create a GUI for a console application I have (written by
someone else, but with permission to use it). The console application
gathers MIDI data from a port, and returns the data in the form of an
std::vector<uns igned char>.

What I need to do is get this console application to trigger different
buttons to light up on a GUI depending on the contents of the
std::vector<uns igned char(which is called "message"), but the console
application depends on being called forever, or until the user hits a
key to cancel.

My problem is, I'm not sure how to have the function loop forever
without crashing the application, or alternatively I need to know how I
can have a key press stop the function doing what its doing and go back
to being idle.

Can anyone point me in the right direction?
Sure, the door is just here:
http://www.parashift.com/c++-faq-lit...t.html#faq-5.9

Now concerning your problem that depends on the design of the program,
on which OS it runs and how should the final product be working.

The usual solution when using such an external program is to start it in
a thread and parsing I/O for command if needed. If you have POSIX
implmentation of popen, the pstream library is a good stating point.
http://pstreams.sourceforge.net/
Michael
Jan 17 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1372
by: ari | last post by:
Hey all, Is there a way to access all the reports that have been created for an MS Access application and list them in a datagrid? thanks in advance, ari
1
5387
by: Oz | last post by:
This is long. Bear with me, as I will really go through all the convoluted stuff that shows there is a problem with streams (at least when used to redirect stdout). The basic idea is that my application (VB.NET) will start a process, redirect its stdout and capture that process' output, displaying it in a window. I've written a component for this, and a test application for the component. It allows me to specify a command to execute,...
1
5370
by: Matthew Kelly | last post by:
I have pulled together a VB.net project that hooks the keyboard (Ref. Paul Kimmel's hooking program) and allow the user to send "mouse right clicks" via the SendInpuut function (mouse emulation works fine). I am also trying to make this project capable of "Rearrange the keyboard" (example type "e" and "K" is sent to the application) by using SendInput function and I am not able to get it to work. I am finding the use of SendInput...
0
1116
by: webstuff | last post by:
Hi, I have a C# .NET application with lots of strings added through the visual designer (thus stored in the form's .resx file) specifying the application's company name and product name . What I want to do is change all of these instances to tags, for example <COMPANY_NAME> or <PRODUCT_NAME> and then dynamically replace these tags when the application runs with a company name/product name etc of my choosing.
5
2019
by: Ryan Ginstrom | last post by:
Apropos recent threads about GUI editors, coming from a Win32/WTL C++ background, I actually like the idea of being able to (easily) create GUIs programmatically. But I still see a lot of the same tedium: hooking up events to handlers, and getting data into and out of dialogs. In C++, this is generally handled through code generation and/or macros, but IMO these are brittle and ugly. So my question: Is there a Pythonic way to make...
8
1974
by: pigeonrandle | last post by:
Hi, Has anyone had any experience with hooking messages in other application windows (like SPY++). I want to listen for WM_MOVE messages, but can only seem to find examples of Keyboard and Mouse hooks. Please (and thankyou), James Randle.
6
1925
by: pigeonrandle | last post by:
Hi, I want to create a dll in Visual Studio 2003 that is suitable for hooking thread-specific messages. What sort of project do i need to create for this? Many thanks, James Randle.
12
6543
by: Dilip | last post by:
Hi All I have a server based C# console application. This application must hide its console window when its launched out on the field. So I dutifully P/Invoke'd FindWindow/ShowWindow combination to hide the console window at launch time. The application (for legacy reasons) hangs around by waiting on an old- fashioned Console.ReadLine() statement.
1
1401
by: Tom Rahav | last post by:
Hello, I try to develop application that runs in the background and suppose to display a small form with menu whenever the user clicks the middle mouse button (also when my application is not the active one). I have found a nice way to do it with hooking mouse events and reactring accordingly. but I'm affriad that this method is a performances killer for the OS. Is there a better way to do it? How "killer" is my way anyway? Thanks!
0
9646
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9484
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10350
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9957
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8983
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7505
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5386
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4055
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2887
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.