Re: [Harbour] Re: Trap / run routine when MS Windows red X box closed?

2010-03-02 Thread smu johnson
Hi,

Thanks for the tips.  I tried both these options, and they seem to start up
a new console window whenever I run stuff.  I imagine this is the price I
have to pay, in order to trap the red X button being pressed...

*worried face*

On Mon, Mar 1, 2010 at 7:23 PM, Pritpal Bedi bediprit...@hotmail.comwrote:



 Przemysław Czerpak wrote:
 
  It's redundant. -gtwvt makes the above.
  If you use -gt* switches in hbmk2 then it makes for the 1-st one:
 REQUEST HB_GT_*_DEFAULT
  and for the next ones:
 REQUEST HB_GT_*
 
  so you do not have to use any 'REQUEST HB_GT_*[_DEFAULT] in your
  PRG code.
 

 Long time elapsed I played with this stuff, so was out of memory.
 So only -gtwvt switch is required, more simplified.


 -
 enjoy hbIDEing...
Pritpal Bedi
 _a_student_of_software_analysis__design_
 --
 View this message in context:
 http://n2.nabble.com/Trap-run-routine-when-MS-Windows-red-X-box-closed-tp4651773p4658761.html
 Sent from the harbour-devel mailing list archive at Nabble.com.
 ___
 Harbour mailing list (attachment size limit: 40KB)
 Harbour@harbour-project.org
 http://lists.harbour-project.org/mailman/listinfo/harbour




-- 
smu johnson smujohn...@gmail.com
___
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour


Re: [Harbour] Re: Trap / run routine when MS Windows red X box closed?

2010-03-02 Thread Saulius Zrelskis
 Oh yes, so you are using GTWIN.
 No, for this GT Close - X button cannot be manipulated.

It can, through API SetConsoleCtrlHandler(). Handles events:
CTRL_C_EVENT
CTRL_BREAK_EVENT
CTRL_CLOSE_EVENT ===
CTRL_LOGOFF_EVENT
CTRL_SHUTDOWN_EVENT

Best regards,
Saulius
___
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour


Re: [Harbour] Re: Trap / run routine when MS Windows red X box closed?

2010-03-02 Thread smu johnson
May joy and happiness forever come your way!

On Tue, Mar 2, 2010 at 1:40 AM, Saulius Zrelskis labi...@gmail.com wrote:

  Oh yes, so you are using GTWIN.
  No, for this GT Close - X button cannot be manipulated.

 It can, through API SetConsoleCtrlHandler(). Handles events:
 CTRL_C_EVENT
 CTRL_BREAK_EVENT
 CTRL_CLOSE_EVENT ===
 CTRL_LOGOFF_EVENT
 CTRL_SHUTDOWN_EVENT

 Best regards,
 Saulius
 ___
 Harbour mailing list (attachment size limit: 40KB)
 Harbour@harbour-project.org
 http://lists.harbour-project.org/mailman/listinfo/harbour




-- 
smu johnson smujohn...@gmail.com
___
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour


Re: [Harbour] Re: Trap / run routine when MS Windows red X box closed?

2010-03-02 Thread Przemysław Czerpak
On Tue, 02 Mar 2010, smu johnson wrote:

Hi,

 Thanks for the tips.  I tried both these options, and they seem to start up
 a new console window whenever I run stuff.  I imagine this is the price I
 have to pay, in order to trap the red X button being pressed...

No it's not the price you have to pay.
Additional console window is created by some C RTLs for console
programs. You have to use -gui hbmk2 switch that you are creating
GUI program. GTWVT uses WIN API to create console window so technically
is not console program but GUI one.

best regards,
Przemek
___
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour


Re: [Harbour] Re: Trap / run routine when MS Windows red X box closed?

2010-03-02 Thread Viktor Szakáts
Hi,

 Thanks for the tips.  I tried both these options, and they seem to start up
 a new console window whenever I run stuff.  I imagine this is the price I
 have to pay, in order to trap the red X button being pressed...
 
 No it's not the price you have to pay.
 Additional console window is created by some C RTLs for console
 programs. You have to use -gui hbmk2 switch that you are creating
 GUI program. GTWVT uses WIN API to create console window so technically
 is not console program but GUI one.

Please note that -gtwvt automatically enables -gui, too.

In case one needs multiple -gt* options, it's best to use 
it though (_after_ the -gt* options) to make sure GUI 
mode is forced.

Brgds,
Viktor

___
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour


Re: [Harbour] Re: Trap / run routine when MS Windows red X box closed?

2010-03-02 Thread Viktor Szakáts
Hi Saulius,

 Oh yes, so you are using GTWIN.
 No, for this GT Close - X button cannot be manipulated.
 
 It can, through API SetConsoleCtrlHandler(). Handles events:
 CTRL_C_EVENT
 CTRL_BREAK_EVENT
 CTRL_CLOSE_EVENT ===
 CTRL_LOGOFF_EVENT
 CTRL_SHUTDOWN_EVENT

Can you show an example for that using current gtwin.c code?

We're already handling these events, so if doable, it should 
be implemented here:
---
static BOOL WINAPI hb_gt_win_CtrlHandler( DWORD dwCtrlType )
{
   BOOL bHandled;

   HB_TRACE(HB_TR_DEBUG, (hb_gt_win_CtrlHandler(%lu), ( HB_ULONG ) 
dwCtrlType));

   switch( dwCtrlType )
   {
  case CTRL_C_EVENT:
 bHandled = FALSE;
 break;

  case CTRL_CLOSE_EVENT:
  case CTRL_BREAK_EVENT:
 s_bBreak = HB_TRUE;
 bHandled = TRUE;
 break;

  case CTRL_LOGOFF_EVENT:
  case CTRL_SHUTDOWN_EVENT:
  default:
 bHandled = FALSE;
   }

   return bHandled;
}
---

Brgds,
Viktor

___
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour


Re: [Harbour] Re: Trap / run routine when MS Windows red X box closed?

2010-03-02 Thread Przemysław Czerpak
On Tue, 02 Mar 2010, Szak�ts Viktor wrote:

Hi,

  Oh yes, so you are using GTWIN.
  No, for this GT Close - X button cannot be manipulated.
  It can, through API SetConsoleCtrlHandler(). Handles events:
  CTRL_C_EVENT
  CTRL_BREAK_EVENT
  CTRL_CLOSE_EVENT ===
  CTRL_LOGOFF_EVENT
  CTRL_SHUTDOWN_EVENT
 Can you show an example for that using current gtwin.c code?
 We're already handling these events, so if doable, it should 
 be implemented here:
[...]

For CTRL_LOGOFF_EVENT, CTRL_SHUTDOWN_EVENT we should enable CANCEL
or QUIT action. Please only remember that CtrlHandler is executed
using separate non HVM thread.

Current implementation ignores CTRL_CLOSE_EVENT (it returns TRUE what
disable default ExitProcess() action). It causes that after 5 seconds
systems shows message box asking about confirmation of process termination.

There is no way to disable [X] close button using SetConsoleCtrlHandler()
and CTRL_SHUTDOWN_EVENT (BTW maybe we should change default action for this
event to QUIT or CANCEL).

On newer systems having GetConsoleWindow() function it's possible to
use exactly the same solution as in GTWVT, i.e:

   HMENU hSysMenu = GetSystemMenu( GetConsoleWindow(), FALSE );
   if( hSysMenu )
  EnableMenuItem( hSysMenu, SC_CLOSE, MF_BYCOMMAND | MF_GRAYED );

best regards,
Przemek
___
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour


Re: [Harbour] Re: Trap / run routine when MS Windows red X box closed?

2010-03-01 Thread smu johnson
Hi,

On Sun, Feb 28, 2010 at 6:12 PM, Pritpal Bedi bediprit...@hotmail.comwrote:


 Show on this list how you build your appln ?


..\harbour-dev\bin\hbmk2 -strip -ustd.ch -kc -lhbct -lhbtpathy -lhbnf -inc
-o..\latest\bmd.exe bm.hbp

(bm.hbp simply contains a giant list of all the .PRG files)

Is this enough info for you?  Thanks for taking an interest.
___
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour


[Harbour] Re: Trap / run routine when MS Windows red X box closed?

2010-03-01 Thread Pritpal Bedi


smu johnson wrote:
 
 ..\harbour-dev\bin\hbmk2 -strip -ustd.ch -kc -lhbct -lhbtpathy -lhbnf -inc
 -o..\latest\bmd.exe bm.hbp
 
 (bm.hbp simply contains a giant list of all the .PRG files)
 
 Is this enough info for you?  Thanks for taking an interest.
 

Oh yes, so you are using GTWIN.
No, for this GT Close - X button cannot be manipulated.



-
 enjoy hbIDEing...
Pritpal Bedi 
_a_student_of_software_analysis__design_
-- 
View this message in context: 
http://n2.nabble.com/Trap-run-routine-when-MS-Windows-red-X-box-closed-tp4651773p4658528.html
Sent from the harbour-devel mailing list archive at Nabble.com.
___
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour


Re: [Harbour] Re: Trap / run routine when MS Windows red X box closed?

2010-03-01 Thread smu johnson
Well... what can I do to make it supported?

Will I have to change my entire code if I switch away from GTWIN?  I am not
quite sure how to use those other features you mentioned earlier :(

Please give me a hint. :)   Thank you!


On Mon, Mar 1, 2010 at 6:17 PM, Pritpal Bedi bediprit...@hotmail.comwrote:



 smu johnson wrote:
 
  ..\harbour-dev\bin\hbmk2 -strip -ustd.ch -kc -lhbct -lhbtpathy -lhbnf
 -inc
  -o..\latest\bmd.exe bm.hbp
 
  (bm.hbp simply contains a giant list of all the .PRG files)
 
  Is this enough info for you?  Thanks for taking an interest.
 

 Oh yes, so you are using GTWIN.
 No, for this GT Close - X button cannot be manipulated.



 -
 enjoy hbIDEing...
Pritpal Bedi
 _a_student_of_software_analysis__design_
 --
 View this message in context:
 http://n2.nabble.com/Trap-run-routine-when-MS-Windows-red-X-box-closed-tp4651773p4658528.html
 Sent from the harbour-devel mailing list archive at Nabble.com.
 ___
 Harbour mailing list (attachment size limit: 40KB)
 Harbour@harbour-project.org
 http://lists.harbour-project.org/mailman/listinfo/harbour




-- 
smu johnson smujohn...@gmail.com
___
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour


[Harbour] Re: Trap / run routine when MS Windows red X box closed?

2010-03-01 Thread Pritpal Bedi


smu johnson wrote:
 
 Well... what can I do to make it supported?
 
 Will I have to change my entire code if I switch away from GTWIN?  I am
 not
 quite sure how to use those other features you mentioned earlier :(
 
 Please give me a hint. :)   Thank you!
 

..\harbour-dev\bin\hbmk2 -gtwvt -strip -ustd.ch -kc -lhbct -lhbtpathy -lhbnf
-inc  -o..\latest\bmd.exe bm.hbp

And include somewhere in sources 

REQUEST HB_GT_WVT_DEFAULT

Let us know did you succeed. Next step after that.



-
 enjoy hbIDEing...
Pritpal Bedi 
_a_student_of_software_analysis__design_
-- 
View this message in context: 
http://n2.nabble.com/Trap-run-routine-when-MS-Windows-red-X-box-closed-tp4651773p4658667.html
Sent from the harbour-devel mailing list archive at Nabble.com.
___
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour


Re: [Harbour] Re: Trap / run routine when MS Windows red X box closed?

2010-03-01 Thread Przemysław Czerpak
On Mon, 01 Mar 2010, Pritpal Bedi wrote:

Hi,

 ..\harbour-dev\bin\hbmk2 -gtwvt -strip -ustd.ch -kc -lhbct -lhbtpathy -lhbnf
 -inc  -o..\latest\bmd.exe bm.hbp
 And include somewhere in sources 
 REQUEST HB_GT_WVT_DEFAULT

It's redundant. -gtwvt makes the above.
If you use -gt* switches in hbmk2 then it makes for the 1-st one:
   REQUEST HB_GT_*_DEFAULT
and for the next ones:
   REQUEST HB_GT_*

so you do not have to use any 'REQUEST HB_GT_*[_DEFAULT] in your
PRG code.

best regards,
Przemek
___
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour


[Harbour] Re: Trap / run routine when MS Windows red X box closed?

2010-03-01 Thread Pritpal Bedi


Przemysław Czerpak wrote:
 
 It's redundant. -gtwvt makes the above.
 If you use -gt* switches in hbmk2 then it makes for the 1-st one:
REQUEST HB_GT_*_DEFAULT
 and for the next ones:
REQUEST HB_GT_*
 
 so you do not have to use any 'REQUEST HB_GT_*[_DEFAULT] in your
 PRG code.
 

Long time elapsed I played with this stuff, so was out of memory.
So only -gtwvt switch is required, more simplified.


-
 enjoy hbIDEing...
Pritpal Bedi 
_a_student_of_software_analysis__design_
-- 
View this message in context: 
http://n2.nabble.com/Trap-run-routine-when-MS-Windows-red-X-box-closed-tp4651773p4658761.html
Sent from the harbour-devel mailing list archive at Nabble.com.
___
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour


[Harbour] Re: Trap / run routine when MS Windows red X box closed?

2010-02-28 Thread Pritpal Bedi


smu johnson wrote:
 
 I was wondering that since it's impossible for everyone to not keep
 clicking
 it, that some sort of Harbour function or flag or whatever could somehow
 control what happens if it's clicked via some sort of API call that
 Windows
 might provide to Harbour.  Like, if someone clicked the X box it might
 call
 a func that exits cleanly instead of instantly.
 

It is there.

First which GT are you using ?
GTWVT and GTWVG provide this functionality.


-
 enjoy hbIDEing...
Pritpal Bedi 
_a_student_of_software_analysis__design_
-- 
View this message in context: 
http://n2.nabble.com/Trap-run-routine-when-MS-Windows-red-X-box-closed-tp4651773p4651882.html
Sent from the harbour-devel mailing list archive at Nabble.com.
___
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour


Re: [Harbour] Re: Trap / run routine when MS Windows red X box closed?

2010-02-28 Thread smu johnson
What is a GT?  Forgive the stupid question... :(

On Sun, Feb 28, 2010 at 5:27 PM, Pritpal Bedi bediprit...@hotmail.comwrote:



 smu johnson wrote:
 
  I was wondering that since it's impossible for everyone to not keep
  clicking
  it, that some sort of Harbour function or flag or whatever could somehow
  control what happens if it's clicked via some sort of API call that
  Windows
  might provide to Harbour.  Like, if someone clicked the X box it might
  call
  a func that exits cleanly instead of instantly.
 

 It is there.

 First which GT are you using ?
 GTWVT and GTWVG provide this functionality.


 -
 enjoy hbIDEing...
Pritpal Bedi
 _a_student_of_software_analysis__design_
 --
 View this message in context:
 http://n2.nabble.com/Trap-run-routine-when-MS-Windows-red-X-box-closed-tp4651773p4651882.html
 Sent from the harbour-devel mailing list archive at Nabble.com.
 ___
 Harbour mailing list (attachment size limit: 40KB)
 Harbour@harbour-project.org
 http://lists.harbour-project.org/mailman/listinfo/harbour




-- 
smu johnson smujohn...@gmail.com
___
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour


[Harbour] Re: Trap / run routine when MS Windows red X box closed?

2010-02-28 Thread Pritpal Bedi


smu johnson wrote:
 
 What is a GT?  Forgive the stupid question... :(
 

Show on this list how you build your appln ?


-
 enjoy hbIDEing...
Pritpal Bedi 
_a_student_of_software_analysis__design_
-- 
View this message in context: 
http://n2.nabble.com/Trap-run-routine-when-MS-Windows-red-X-box-closed-tp4651773p4652008.html
Sent from the harbour-devel mailing list archive at Nabble.com.
___
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour