473,396 Members | 2,003 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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<unsigned 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<unsigned 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 2005
"Bobrick" <pu******@gmail.comwrote in message
news:11*********************@m58g2000cwm.googlegro ups.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<unsigned 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<unsigned 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<unsigned 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<unsigned 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
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
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...
1
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...
0
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 . ...
5
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...
8
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...
6
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
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...
1
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
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,...

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.