Dev-C++ Run Program in Background without GUI - c++

I recently began learning C++ in order to reach people w/o .net. I need to run my program in the background(without any visual indication to the user so no window or cmd). I know there a various methods to do this In C#, but I don't know how to do this in C++ (specifically Dev-C++). Any help is greatly appreciated.

First of all, you shouldn't be using Dev-C++. If you really don't want to use Visual Studio (why not? it's free!) then Code::Blocks or Eclipse or something is a better choice. Dev-C++ hasn't been updated in like 5 years...
The ways of creating background processes in C++ is basically the same as in C#, you just don't get the enormous class library that C# has which handles most of the work for you.
Your main choices are windows services, or creating a regular windows application and simply not displaying any windows... which one you choose depends on your specific requirements (do you want it run even when no one is logged in, or do you want it associated with a logged-in user, etc)

You need to be creating a Windows GUI application and not a console application (or else the console window will show). Then, just don't create any windows.

Related

Interaction with windows GUI

I want to create an application when user starts it, it records what user clicked on GUI in a file.
I don't know how and where to start. which language to use for this ?
Most GUI depends on which platform you use.(i.e. in windows, you can use
windows api.In linux, you can use QT. In java, use swing.)
But logic stuff depends on which language you use. Like manipulate numbers,
strings.
In sum, if you want to make it quickly, you can study using python.
In Windows Platform you can use MFC(Microsoft Foundation Class)
Here is a good tutorial for getting started with MFC
If you are expecting a free development environment, Qt would be a better choice.
Qt Windows Support

can we have commands and functions of console and win32 c++ interchanged?

I have developed communication program with c++ console programming, it is complete and works fine. Now I need to change my code for some real-time purpose, where I need to use the previous and add further and generate the .avi movie (most probably with BMP images).
The thing is the that as I have understood that the movie can only be generated with win32 c++ and not console programming?
hence
1. Can I use the same code (with necessary changes ofcourse) and the APIs that I was using in console programming with the win32 programming?
Can I go the other way around, i.e. make the movie generation code in win32 c++ and later include somehow in the console program. If yes, any idea?
any other idea is also appreciable
There's no difference to Win32 programming and "console" programming - you can use both at the same time. The only difference is the main entry function you're using (most often main vs. WinMain). So, don't bother setting up a new project if the console app could be adjusted more easily.
In fact, console apps can even make windows, and a window-based app can create it's own consoles as well. And there's no difference to Win32 C++ and console C++ (apart from the main entry function you're using I've mentioned and the idiomatic way to communicate input and output).

How to shell to another app and have it appear in a Borland VCL form (c++)

I'm actually in charge of a FIP networking c++ application, working for the first time with Embarcadero C++ Builder XE5.
The app is nearly finished, but I can't find how to implement the last feature...
I wanted to open an external Windows HyperTerminal in order to see what happen on a given COM port, for this purpose I'm using ShellExecute() to launch it from my application but it's a bit ugly since there is 2 different windows.
I was wondering if it was possible to integrate this newly opened HyperTerminal into an existing form (Panel for instance). I couldn't find nothing related excepted this =>
Delphi style, but i don't understand a byte of #mghie answer since it's delphi.
If anyone have a clue I'm really interested, even the most basic clue!
For almost all of my projects where COM port interaction is needed I use AsyncPro. The project is very well documented with a ~1000 page reference manual.
Reference Manual
Developer's Guide
For this case, the package provides a VCL terminal that simply drops onto a form. It's quite flexible with a lot of options to configure its behaviour.
I wanted something similar in past but with no success.
1.The only thing I was able to do is the exact opposite.
dock my VCL window inside another (not VCL app) but that solved my problems
If you terminal is console window then I doubt even this can be done.
anyway find handle of desired window
find handle to a dockable subcomponent
set the parent of your subwindow to it / or use manual dock
2.maybe you can do some funny stuff
like hide terminal somewhere
and continuoslly copy its graphics to your window
newer done that hide thing
but copy the contents is doable (although on windows a little unstable sometimes)
done it once to feed my App with IR-camera feed from different App
while 'focus' stays on hidden terminal it should work
also you can try to post messages to it somehow if you need the focus ...
Sorry for a vague answer but at least you see some approaches of mine
maybe someone has a better way to do this

Migrating from C# to native windows C++

I want to develop native c++ windows application using windows API.
but i find it being difficult because i am unable to render the window and drag and drop components, change the location etc..
How can i view, drag and drop components like i can do in C# ?
May be there is no way to do. if so, what is the fastest procedure to design the application ?
If you like so much the drag and drop of components (and of course for good reason) why would you need to develop it using C++? You can use PInvoke if you need to call some C++ functions from C# code that are not in the .net framework.
But if you really insist, maybe you could try QT.
Using a library framework such as Qt is really the way you want to go. It makes things very simple and still allows you to write code in std c++ to keep most things very fast.
If you EVER have intentions of porting the code to a different platform than windows (whether it be Mac, Linux or even Android ... yes its possible), qt is definately the way you're going to want to go.
I can get an app up and running... smoothly in a few minutes using Qt but much longer and with more confusion using MFC.
Dragging and dropping 'widgets' to form a gui is very easy and possible with Qt's built-in QtDesigner!!! Check it out!!!
http://qt.nokia.com/downloads
Assuming you are using Visual Studio, if your app can be implemented as a dialog box, then you can use the dialog editor to lay things out. Otherwise, you just have to write code to create the windows and place controls. Look at the MFC examples included with Visual Studio.
Jeff Prosise's PROGRAMMING WINDOWS WITH MFC was one of the better books for learning how to do this, but I think it is out of print, and so could be hard to find.
Charles Petzold's PROGRAMMING WINDOWS is the bible for the Win32 API. Again, may be hard to find these days.
If MFC isn't your cup of tea, you could also look at QT, GTK+, or wxWidgets. There are GUI builders for each of those, but they are all pretty primitive compared to what you can do with C#.
As far as I know there is no ide out there that will let you "drag and drop create" standard win api windows like you would with C#.
Personally for that kind of application I always recommend Borland C++ Builder (Which is now Codegear Rad studio)
Although it is not standard API, it allows you to drag an drop and static linking is very easy, so you dont have to worry about redistributables

Convert GUI C++ app to a console one

I have a GUI C++ application (Visual Studio 2008) that needs to be converted to a console one.
I don't have any experience in C programming. Mostly I use .NET. Where do I start?
Down-converting a GUI app is major surgery. The programming model is entirely different, a GUI app is event driven. Relying on a message loop to deliver events, processed in message handlers. And typically a bunch of controls that take care of the grunge work of taking input.
Given that you have to completely redesign the app to make it work as a console mode app and that you don't have experience with the language, writing this in a .NET language you have experience with is the best way to get it completed quickly.
Start with refactoring. Make sure that GUI is separated from business logic. Then add another interface to access this business logic: one that uses console, rather than GUI widgets.
Check out ncurses and readline to help you build a rich console application. You can't use them both at once, as I found out, so try ncurses if your application is more oriented toward output/display or will implement single-key interactions (hotkeys), and readline if it's more of a line-at-a-time user input situation.
Create a new project with a main
add your files
here you got a console application doing nothing. It may still create windows, or if you like, hidden windows.
Now it's up to your creativity to tie interface to existing code.
Don't forget to download and use boost::program_options to access command line parameters properly.