I write a simple program,[ you can download at 149.154.154.92/focus.zip ] with qt5.1 and qtcreator.
It is very simple, mainwindow and 1 qdialog.
I exec the dialog with a button and I close it with an other button.
If I run the program on x86 platform all is ok.
If I run the program on arm embedded system with the eglfs platform option I can exec the dialog but when I try to close it, the application is locked, and the dialog it is not hided.
If I run the program on arm embedded system with the linuxfb platform option I can exec the dialog but when I close it, the mainwindow is not repainted but it can capture the input and I can exec the dialog again.
What I wrong?
Thank you
Related
I need my C program to run in the background, so without any open window or without blocking the terminal if run from there.
I can't find much info on how to do it online.
edit: To do what i needed, i just added -mwindows to the gcc command.
Windows supports two program types; GUI and console.
Console applications automatically get a console window if the parent process does not already have one.
GUI applications do not get a console and they can have 0, 1 or multiple windows. If you don't create a window your application is basically only visible in Task manager. GUI applications typically use WinMain as the startup function instead of main. Notepad.exe is a GUI application that creates a window.
You need to tell the compiler/linker that you are creating a GUI program. If you are using Visual Studio, it probably has a project template you can use.
On Pepper, 2.5.7.1, I'm using a .top dialog script as the main Interactive application to call other apps on the robot.
These work fine
[...] ^run(User/epicsax-6f83fc/behavior_1)
[...] ^run(User/taichidemo-c66a80/behavior_1)
[...] ^pCall(ALVolumeSlider.increaseVolume())
However if the application has to run something that is Interactive, the meditation application runs simultaneously:
u:(meditation) okay ^switchFocus(meditation-8806ca/behavior_1)
when this executes, the robot is still in dialog mode, eyes flashing blue and other still responding in accordance with the .top script.
I would expect that the first application would stop.
If I run this SSH command while the main dialog is running, I get the expected behavior where the dialog stops:
qicli call ALAutonomousLife.switchFocus meditation-8806ca/behavior_1
How is the .top file with these dialogue loaded? In collaborative dialogue, as a box in a behavior, dynamically loaded from script? If it's from a behavior, is that behavior also an Autonomous Life behavior? (i.e. with interactive tag, started with switch focus, etc.) If you started it with ALBehaviorManager.startBehavior then it won't automatically be stopped when you switch focus).
Some approaches:
Try ^pCall(ALAutonomousLife.switchFocus("meditation-8806ca/behavior_1")) - should be equivalent, but you never know
call qicli call ALDialog.getActivatedTopics so you can know if your topic is still running (it shouldn't be!)
I'm trying to make a C program that modifies my host file, but I can't just straight up open the file with the program, because Windows blocks it. Is there any way that I can make the program request administrative privileges within the code, or any script I can use to start the program in admin mode?
Right clicking is a solution that allows you to run any program with Administrator privileges. That includes ticking the box in "Properties".
On Windows 7 and later, you can also rename your program so that its name contains setup (like hosts_setup.exe), and it'll automatically be run in Administrator mode (brings up the UAC prompt) if double-clicked in Explorer. Note this only works from double-clicking in Explorer.
You can also take a look at How can I run a child process that requires elevation and wait? . It calls WinAPI and is a fairly native approach. The best solution is to add it in menifest so your program requests Admin at startup.
Shoot, okay, seconds after posting this question, I found a solution. It turns out that you can right click the executable, click properties, and on the compatibility tab, select "Run this program as administrator". Just in case anyone else needed this information.
When compiling this program in GCC-mingw32 and trying to run it, it always pops up a Console Window in a very short time and closes immediately.
int main (void)
{
system("shutdown -s -t 60"); // Shutdown the computer in 1 minute
return 0;
}
How could I modify this code in order to run it without any window pops up?
Is it feasible?
Thanks.
Your executable is being marked as using the console subsystem, which makes Windows show a console window automatically. If you change it to use the GUI subsystem, Windows won't show a console window. To tell MinGW to use the GUI subsystem, pass the -mwindows flag.
i want to be able to call a exe from mssql
my program is call scramble.exe held in c:\test
i have used the following command in sql for testing purposes
*master.dbo.xp_cmdshell 'C:\WINDOWS\system32\notepad.exe'*
when you execute this it just keeps executing no notepad opens
but if you open task manager you can see the notepad running
if you kill this process the query stops
can any one help em with this
ta
Gerard
It is not working right because you are not supposed to call interactive programs via xp_cmdshell. The programs called through xp_cmdshell run in background. Try with a program with no GUI.
Edit: this goes for all applications that implement dialogues. This mskb explains it pretty well.
If you run a program through the xp_cmdshell extended stored procedure, the program only runs in the background. The xp_cmdshell extended stored procedure does not display the user interface of the programs that run in its context. If an application that is run through xp_cmdshell does needs user interaction from a user interface (for example, the application tries to create a dialog box or a message box that needs user input) it will stop responding because it is waiting for input. However, xp_cmdshell will never display the user interface; therefore, the user cannot provide any input.