LB Booster
« Closing MainWin conditionally? »

Welcome Guest. Please Login or Register.
Apr 1st, 2018, 04:43am



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
We apologize Conforums does not have any export functions to migrate data.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

Thank you Conforums members.
Speed up Liberty BASIC programs by up to ten times!
Compile Liberty BASIC programs to compact, standalone executables!
Overcome many of Liberty BASIC's bugs and limitations!
LB Booster Resources
LB Booster documentation
LB Booster Home Page
LB Booster technical Wiki
Just BASIC forum
BBC BASIC Home Page
Liberty BASIC forum (the original)

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Closing MainWin conditionally?  (Read 621 times)
Monkfish
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 104
xx Closing MainWin conditionally?
« Thread started on: Aug 30th, 2015, 6:24pm »

I know, I shouldn't be using MainWin rolleyes

But is there a way to close MainWin without using the compiler instruction nomainwin?

I would like to close MainWin conditionally...

...or hide it or open it minimised.

Thank you smiley
« Last Edit: Aug 30th, 2015, 7:14pm by Monkfish » User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: Closing MainWin conditionally?
« Reply #1 on: Aug 30th, 2015, 9:25pm »

on Aug 30th, 2015, 6:24pm, Monkfish wrote:
But is there a way to close MainWin without using the compiler instruction nomainwin?
...or hide it or open it minimised.

Reading between the lines, are you trying to discover the mainwin's window handle? With that you can easily close it, hide it, minimize it, move it etc. using regular Windows API calls.

You can get the mainwin's handle using an embedded BBC BASIC statement:

Code:
    !hmainwin = @hwnd% 

Richard.
User IP Logged

Monkfish
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 104
xx Re: Closing MainWin conditionally?
« Reply #2 on: Aug 30th, 2015, 9:47pm »

Thanks Richard. I knew there must be a way to do it.
User IP Logged

Monkfish
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 104
xx Re: Closing MainWin conditionally?
« Reply #3 on: Aug 31st, 2015, 09:54am »

In the end I used the CloseWindow function to minimise the window instead of the DestroyWindow function that kills the program. This is because I wanted to get rid of mainwin but still wanted to display a notice (using the LB "Notice" command). It still shows the window being minimized, but that's okay.
« Last Edit: Aug 31st, 2015, 09:55am by Monkfish » User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: Closing MainWin conditionally?
« Reply #4 on: Aug 31st, 2015, 10:57am »

on Aug 31st, 2015, 09:54am, Monkfish wrote:
In the end I used the CloseWindow function to minimise the window instead of the DestroyWindow function that kills the program.

There's no point in calling DestroyWindow, since END has the same effect (in a compiled EXE).

Personally I don't like calling CloseWindow simply because it is misleadingly named (it doesn't close the window). My preference is to call ShowWindow with the SW_MINIMIZE parameter because then it's obvious what you are doing.

Quote:
It still shows the window being minimized, but that's okay.

Wouldn't hiding the window be better?

Richard.
User IP Logged

Monkfish
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 104
xx Re: Closing MainWin conditionally?
« Reply #5 on: Aug 31st, 2015, 3:01pm »

Used the following. Thank you :)

Code:
calldll #user32, "ShowWindow", hmainwin as long, 0 as long, r as boolean 


I think I need a reference book for all these API calls ;)
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls