` Printed Icetips Article

Icetips Article



Windows API: Set application to be the only desktop application
2005-04-01 -- Kc Chin
 
Newsgroups: softvelocity.public.clarion6

From my old junk.  The Main Menu's "Embed at AfterWindowOpening", some of
the remarked line worked.  I forgotten why I remarked it.
Ah!. Now I remember.  The Ctrl+Alt+Del will be disable if you unremark the
it line.

Cheers and good day to you.

KC Chin

Embed at Global Map
 MODULE('Windows API')
   SystemParametersInfo(Long,Long,Long,Long),|
                        Long,Pascal,Raw,Name('SystemParametersInfoA'),proc
   RegisterHotKey(LONG,SIGNED,UNSIGNED,UNSIGNED),BOOL,PASCAL,proc
   GlobalAddAtom(*CSTRING),LONG,PASCAL,RAW,NAME('GlobalAddAtomA')
 END

Embed at After Global Includes
SPI_SCREENSAVERRUNNING  EQUATE(97)
MOD_ALT                 EQUATE(0001h)
MOD_CONTROL             EQUATE(0002h)
MOD_SHIFT               EQUATE(0004h)


Embed at ProgramSetup
  ! Control USER exit
   alias(CtrlMouseCenter, CtrlPause)          ! CtrlMouse/CtrlPause
   alias(CtrlAltMouseCenter, CtrlPause)       ! CtrlAltMouse/CtrlAltPause
   alias(CtrlShiftMouseCenter, CtrlPause)     ! CtrlShiftMouse/CtrlShiftPause
   alias(1795, CtrlPause)                     ! CtrlShiftAltMouse
                                              ! (**no equate in keycodes.clw **)
                                              ! /CtrlShiftAltPause

   alias(AltF4,CtrlPause)
   alias(CtrlF4,CtrlPause)
   alias(CtrlShiftF4,CtrlPause)

  ! alias(AltEsc,CtrlPause)
  ! alias(CtrlEsc,CtrlPause)
   alias(ShiftEsc,CtrlPause)
  ! alias(CtrlShiftEsc,CtrlPause)
   alias(CtrlAltEsc,CtrlPause)
   alias(1819, CtrlPause)                     ! (**no equate in keycodes.clw
**)/CtrlShiftAltEsc

  ! alias(AltTab,CtrlPause)
   alias(CtrlAltF1,CtrlPause)
-------------------------
Main Menu
Embed at DataSectionBefore Window
VK_ESC          BYTE(1BH)
VK_TAB          BYTE(09H) !TAB key
!VK_F1           BYTE(70H)
!VK_F4           BYTE(73H)
!VK_PAUSE        BYTE(13H)
!VK_DELETE       BYTE(2Eh)!EQUATE(46) !2eh

AltEscAtom          CSTRING('AltEscAtom ')
CtrlEscAtom          CSTRING('CtrlEscAtom  ')
CtrlShiftEscAtom    CSTRING('CtrlShiftEscAtom ')
AltTabAtom          CSTRING('AltTabAtom  ')

!AltF4Atom           CSTRING('AltF4Atom   ')
!ShiftEscAtom        CSTRING('ShiftEscAtom')
!CtrlF4Atom          CSTRING('CtrlF4Atom  ')
!CtrlShiftF4Atom     CSTRING('CtrlShiftF4Atom  ')

Embed at Event:OpenWindow
    WinOnTop() ! from Capesoft WinEvent

Embed at AfterWindowOpening
  AppFrame{Prop:Max} = 0
  myID# = GlobalAddAtom(AltEscAtom)       
  A# = RegisterHotKey(0{PROP:Handle},myID#,MOD_ALT,VK_ESC)   ! alt esc
  !message('AltEsc: ' & myID# &'/A#= ' & A#)

  myID# = GlobalAddAtom(CtrlEscAtom)       
  A# = RegisterHotKey(0{PROP:Handle},myID#,MOD_CONTROL,VK_ESC)! ctrl Esc
  !message('CtrlEscAtom: ' & myID# &'/A#= ' & A#)

  myID# = GlobalAddAtom(CtrlShiftEscAtom)  
  A# = RegisterHotKey(0{PROP:Handle},myID#,MOD_CONTROL+MOD_SHIFT,VK_ESC)! ctrl shift esc
  !message('CtrlShiftEscAtom: ' & myID# &'/A#= ' & A#)

  myID# = GlobalAddAtom(AltTabAtom)       
  A# = RegisterHotKey(0{PROP:Handle},myID#,MOD_ALT,VK_TAB)   ! alt tab
  !message('AltTabAtom: ' & myID# &'/A#= ' & A#)

  !myID# = GlobalAddAtom(AltF4Atom)        
  A# = RegisterHotKey(0{PROP:Handle},myID#,MOD_ALT,VK_F4)    ! alt f4
  !message('AltF4Atom: ' & myID# &'/A#= ' & A#)

  !myID# = GlobalAddAtom(ShiftEscAtom)     
  A# = RegisterHotKey(0{PROP:Handle},myID#,MOD_SHIFT,VK_ESC) ! shift esc
  !message('ShiftEscAtom: ' & myID# &'/A#= ' & A#)

  !myID# = GlobalAddAtom(CtrlF4Atom)       
  A# = RegisterHotKey(0{PROP:Handle},myID#,MOD_CONTROL,VK_F4)! ctrl f4
  !message('CtrlF4Atom: ' & myID# &'/A#= ' & A#)

  !myID# = GlobalAddAtom(CtrlShiftF4Atom)  
  A# = RegisterHotKey(0{PROP:Handle},myID#,MOD_CONTROL+MOD_SHIFT,VK_F4)! ctrl shift f4
  !message('CtrlShiftF4Atom: ' & myID# &'/A#= ' & A#)

  !- my test -
  !CtrlAltDelID# = GlobalAddAtom(CtrlAltDelAtom)
  !B# = RegisterHotKey(0{PROP:Handle},CtrlAltDelID#,1h+2h,VK_DELETE)
  !VK_DELETE (2E)DEL key !MOD_CONTROL+MOD_ALT
  !message('CtrlAltDelID#: ' & CtrlAltDelID# &'/B#= ' & B#)

  ! only win 9x
  X# = SystemParametersInfo(SPI_SCREENSAVERRUNNING,True,0,0)         
  !X# 0 = FAIL NONZERO=OK   True=Disable CtrlAltDel False=Enable
  !MESSAGE(X#)
  !SystemParametersInfo(SPI_SCREENSAVERRUNNING,FALSE,0,0)



Printed November 23, 2024, 6:55 am
This article has been viewed/printed 35217 times.
Google search has resulted in 101 hits on this article since January 25, 2004.