Popup while the main program goes on

General FreeBASIC programming questions.
Post Reply
Jawade
Posts: 228
Joined: Apr 25, 2008 19:13

Popup while the main program goes on

Post by Jawade »

I want to make a popup and the main program have to go on. Is this possible?
jj2007
Posts: 2326
Joined: Oct 23, 2016 15:28
Location: Roma, Italia
Contact:

Re: Popup while the main program goes on

Post by jj2007 »

Yes.
grindstone
Posts: 862
Joined: May 05, 2015 5:35
Location: Germany

Re: Popup while the main program goes on

Post by grindstone »

@jj2007: I'm sure Jawade is dancing with glee now. <grin>

@Jawade: There are several ways to do that. The easiest is to start the popup via the SHELL command:

popupmain.bas:

Code: Select all

ScreenRes 300,200,32
Shell "start " + ExePath + "\popupchild.exe"
Do
	Locate 1,1
	Print Timer;"   "
Loop Until Len(InKey)
popupchild.bas:

Code: Select all

ScreenRes 200,150,32
Do
	Locate 1,1
	Print Time
Loop Until Len(InKey)
Put both compiled programs into the same directoy and then start popupmain.exe. This simple example is quite useless, but it works. Most of all there is no communication between the two windows.

If you could be a little more specific what you intend to do, I probably could help.
srvaldez
Posts: 3379
Joined: Sep 25, 2005 21:54

Re: Popup while the main program goes on

Post by srvaldez »

hello Jawade
have a look in the FreeBASIC/examples/GUI/win32 folder and try fileopen.bas
see if that's the kind of thing you are after
jj2007
Posts: 2326
Joined: Oct 23, 2016 15:28
Location: Roma, Italia
Contact:

Re: Popup while the main program goes on

Post by jj2007 »

grindstone wrote:@jj2007: I'm sure Jawade is dancing with glee now. <grin>
I know. And I will try to help him as soon as he posts a working program with a slot saying <insert popup code here>.
Jawade
Posts: 228
Joined: Apr 25, 2008 19:13

Re: Popup while the main program goes on

Post by Jawade »

Everyone thanks. I coose the example with Shell, it's very simple and the console who in a moment comes up, is not disturbing.
grindstone
Posts: 862
Joined: May 05, 2015 5:35
Location: Germany

Re: Popup while the main program goes on

Post by grindstone »

Compile with "-s gui" to prevent the console window.
Jawade
Posts: 228
Joined: Apr 25, 2008 19:13

Re: Popup while the main program goes on

Post by Jawade »

I compile already with

fbc -b Calendar.bas -s gui versinfo.rc

But the flash stays…..
srvaldez
Posts: 3379
Joined: Sep 25, 2005 21:54

Re: Popup while the main program goes on

Post by srvaldez »

@Jawade
are you running the compiled Calendar from the IDE ?
if so, try launching the program by double-clicking on the Calendar.exe and see if there's a console opening or not.
jj2007
Posts: 2326
Joined: Oct 23, 2016 15:28
Location: Roma, Italia
Contact:

Re: Popup while the main program goes on

Post by jj2007 »

Jawade wrote:But the flash stays…..

Code: Select all

#define I_hate_consoles 0
#if I_hate_consoles
	#include "Windows.bi"
	WinExec("MsgBox.exe", SW_RESTORE)
#else
	Shell "MsgBox.exe"
#endif
There is a more complicated solution using CreateProcess but WinExec works just fine - on Windows, of course.
grindstone
Posts: 862
Joined: May 05, 2015 5:35
Location: Germany

Re: Popup while the main program goes on

Post by grindstone »

If you're interested, this bipipe.bi contains all functions you need to open a child window as an own process and communicate via a bi-directional pipe (alas, Windows only)
Jawade
Posts: 228
Joined: Apr 25, 2008 19:13

Re: Popup while the main program goes on

Post by Jawade »

I have this part used, the only thing is a console at starting the main
program.

'hide console window. Windows-only, Win2k or newer.
' DO NOT compile -s gui, compile as console prog.
'
'need this
#include once "windows.bi"
'and this BEFORE you call Screen or ScreenRes
'long method, but you can reveal the console window later if needed
Dim As HWND chwnd=GetConsoleWindow
ShowWindow(chwnd,SW_HIDE)
Post Reply