Popup while the main program goes on

General FreeBASIC programming questions.
Jawade
Posts: 198
Joined: Apr 25, 2008 19:13

Popup while the main program goes on

Postby Jawade » Aug 11, 2018 23:22

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

Re: Popup while the main program goes on

Postby jj2007 » Aug 12, 2018 1:51

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

Re: Popup while the main program goes on

Postby grindstone » Aug 12, 2018 13:17

@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: 1599
Joined: Sep 25, 2005 21:54

Re: Popup while the main program goes on

Postby srvaldez » Aug 12, 2018 13:36

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: 653
Joined: Oct 23, 2016 15:28
Location: Roma, Italia
Contact:

Re: Popup while the main program goes on

Postby jj2007 » Aug 12, 2018 14:01

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: 198
Joined: Apr 25, 2008 19:13

Re: Popup while the main program goes on

Postby Jawade » Aug 13, 2018 8:35

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: 496
Joined: May 05, 2015 5:35
Location: Germany

Re: Popup while the main program goes on

Postby grindstone » Aug 13, 2018 23:12

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

Re: Popup while the main program goes on

Postby Jawade » Aug 14, 2018 15:32

I compile already with

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

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

Re: Popup while the main program goes on

Postby srvaldez » Aug 14, 2018 15:46

@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: 653
Joined: Oct 23, 2016 15:28
Location: Roma, Italia
Contact:

Re: Popup while the main program goes on

Postby jj2007 » Aug 14, 2018 15:55

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: 496
Joined: May 05, 2015 5:35
Location: Germany

Re: Popup while the main program goes on

Postby grindstone » Aug 14, 2018 16:51

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: 198
Joined: Apr 25, 2008 19:13

Re: Popup while the main program goes on

Postby Jawade » Aug 15, 2018 14:49

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)

Return to “General”

Who is online

Users browsing this forum: No registered users and 4 guests