forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


NUM,Scroll,Cap lock status; Shift,ctrl,Alt clickCombinations

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Advanced VDS 5 Source Code
View previous topic :: View next topic  
Author Message
CodeScript
Moderator Team


Joined: 08 Jun 2003
Posts: 1054
Location: India

PostPosted: Thu Jul 10, 2003 8:25 am    Post subject: NUM,Scroll,Cap lock status; Shift,ctrl,Alt clickCombinations Reply with quote

NUM,Scroll,Cap lock status AND Shift,ctrl,Alt click combinations !
An example showing status of Numlock,Scroll lock and CAPS lock keys:
And also using Shift click; Ctrl click; Ctrl+Alt click; in various combinations.

Uses I imagine:
1.Display the Num lock,caps lock status in a application like text/rich text editor.
2.Warn the user that CAPS lock is ON.
3. You can ask the user shift click a dialog elmnt for a diffrent result - Settings/edit and the like.

Please note that in this example Non vds dll and API calls are used.
Errors may crash VDS or even the system.
Save your data before running / debugging this script.
Try at your own Risk.
Code:

#----------------------------------------------------------------------------#
#Calling a Non-VDs dll; Get key state of any key including shift numlock etc-#
#Display status of Num,Scroll,Caps, lock and Insert/OVR status---------------#
#Use Shift click Alt and Ctrl click in various Combinations------------------#
#Author:  CodeScript---------------------------------------------------------#
#----------------------------------------------------------------------------#
#Copyright:You can remove this info while(if) Using this code in your app.---#
#----------but please be kind to add a word to your documentation------------#
REM USE AT YOUR OWN RISK !!
REM MISTAKES MADE WHILE USING A NON VDS DLL MAY INVITE A VDS/SYSTEM CRASH.
REM SAVE YOUR WORK BEFORE RUNNING/DEBUGGING THIS SCRIPT.
  Title Get any key state by CodeScript
  DIALOG CREATE,Get any key state by CodeScript,-1,0,496,125,CLASS MYWIN
  DIALOG ADD,STYLE,STYLE1,Arial,,B,,BLUE
  DIALOG ADD, STATUS,STATUS1, [358]|[29]|[33]|[44]|[29]
  DIALOG ADD,TEXT,TEXT1,66,88,,,Click me holding Ctrl Alt Shift individual and

combinations !,,CLICK,TRANSPARENT,STYLE1
  DIALOG ADD,TEXT,TEXT2,28,176,,,Test INS/OVR using Wordpad
  DIALOG SHOW
  LOADLIB USER32
REM SET THESE VARIABLES TO ZERO TO PREVENT THEM FIRING NONSENSE ON LAUNCHING
  %M = @lib(user32,GetAsyncKeyState,int:,$11)
  %N = @lib(user32,GetAsyncKeyState,int:,$12)
  %O = @lib(user32,GetAsyncKeyState,int:,$10)
  %M = 0
  %N = 0
  %O = 0
 
:Evloop
  wait event,0.08
  goto @event()
 

:TIMER
  %M = @lib(user32,GetAsyncKeyState,int:,$11)
  %N = @lib(user32,GetAsyncKeyState,int:,$12)
  %O = @lib(user32,GetAsyncKeyState,int:,$10)
  %I = @lib(user32,GetKeyState,int:,$90)
  %J = @lib(user32,GetKeyState,int:,$14)
  %K = @lib(user32,GetKeyState,int:,$91)
  %L = @lib(user32,GetKeyState,int:,$2D)
    IF @equal(%I,1)
   %I = NUM
   else
   %I = """"
  end
   IF @equal(%J,1)
   %J = CAPS
   else
   %J = """"
  end
   IF @equal(%K,1)
   %K = SCROLL
   else
   %K = """"
  end
   IF @equal(%L,1)
   %L = OVR
   else
   %L = INS
  end
  DIALOG SET, STATUS1, @tab()%I@tab()%J@tab()%K@tab()%L
     goto EVLOOP
   
:TEXT1click
REM CTRL and CTRL+ALT KEY DECLATATION
   IF @NOT(@equal(%M,0))
    If @NOT(@equal(%N,0))
      INFO You Ctrl+Alt clicked me !
     %M = 0
     %N = 0
     %O = 0
     goto EVLOOP
     Else
      If @NOT(@equal(%O,0))
      INFO You Shift+Ctrl clicked me !
      %M = 0
      %N = 0
      %O = 0
      goto EVLOOP
       else
       INFO You Ctrl clicked me !
      %M = 0
      %N = 0
      %O = 0
      goto EVLOOP
      end
      end
    ELSE
    END
REM SHIFT and SHIFT+ALT KEY DECLATATION
IF @NOT(@equal(%o,0))
   If @NOT(@equal(%N,0))
     INFO You Shift+Alt clicked me !
     %M = 0
     %N = 0
     %O = 0
     goto EVLOOP
     else
     INFO You Shift clicked me !
     %M = 0
     %N = 0
     %O = 0
     goto EVLOOP
      end
    ELSE
    END
REM ALT KEY DECLATATION
IF @NOT(@equal(%N,0))
   %M = 0
   %N = 0
   %O = 0
   INFO You Alt clicked me !@CR()OR pressed Alt button once and then clicked me.!

@CR()To avoid this problem use a key combination@CR()eg. Alt+Shift rather than Alt

alone !
   goto EVLOOP
   end
%M = 0
%N = 0
%O = 0
   goto EVLOOP

:OKBUTTON
   
:Close
REM DON'T FORGET TO UNLOAD THE USER32.DLL BEFORE EXIT
REM TO PREVENT UNDESIRABLE CONSEQUENCES.
FREELIB USER32
  exit

________________________________________________________________________________
I am unsure if these codes are going to be of some help to anybody or are just a curious thingy here.
If anyone wants i will try to add another similar example to get input from Play,Pause mute keys for a VDS player that can use these advanced hotkeys. I was also planning a tray helper for VDS 5 IDE to launch afew apps like notepad, minmise the stubborn help file and restore IDE set on top any window just clicking them and undo etc- any more ideas ?

_________________
Regards
- CodeScript
Arrow Give your application a professional look with the VDSGUI Extension
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Advanced VDS 5 Source Code All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum




Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group