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 


Adding Custom Items to System Menu

 
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: 1060
Location: India

PostPosted: Sun Jul 13, 2003 9:44 am    Post subject: Adding Custom Items to System Menu Reply with quote

Adding Custom Items to System Menu :
This Script demonstrates how to add new custom items to the system menu and to respond to custom WM_SYSCOMMAND message generated by clicking that menu item.
The principle is similar to subclassing in VB but here we use the command provided by VDS 5 itself.

Please note that this script uses Non VDS dll and API calls.
Any errors/mistakes will crash VDS/Operating system.
Try at your own risk.

Enjoy.

Code:

#-----------------------------------------------------------------------------#
#-Calling a Non-VDs dll aDD Custom Items to System Menu by CodeScript---------#
#-Author: CodeScript----------------------------------------------------------#
#-Copyright: You can remove this info while Using this code in your app.------#
#------------but may be kind enough to add a word to 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 Adding Custom Items to System Menu by CodeScript
  OPTION MSGEVENT, $112, About,
rem thanx to mindpower for pointing that out !   
  DIALOG CREATE,Adding Custom Items to System Menu - CodeScript,-1,0,422,62,CLASS

MYWIN,RESIZABLE
  DIALOG ADD,TEXT,TEXT1,24,90,240,16,Right click on the sysbar to see the custom items !
  DIALOG SHOW
    LOADLIB USER32
%H = @strdel(@WINEXISTS(#MYWIN),1,1)
 IF %H
      %I = @lib(user32,GetSystemMenu,INT:,%H, 0)
REM NOW %I IS THE HANDLE TO THE SYSTEM MENU TO BE REFERENCED IN
REM ALL THE SUBSEQUENT COMMANDS
      %M = @lib(user32,AppendMenuA,BOOL:,%I,$800,false,0)
      %M = @lib(user32,AppendMenuA,BOOL:,%I,0,1,&About)
      %M = @lib(user32,AppendMenuA,BOOL:,%I,0,2,&Version)
      %M = @lib(user32,DrawMenuBar,BOOL:,%H)
       ELSE
   ERROR -1
  end
FREELIB USER32

:evloop
Wait event
goto @EVENT()

:About
IF @EQUAL(@MSGPARAMS(W),1)
 Info Message event and adding a custom menu Item @CR()by Codescript
  else
  IF @EQUAL(@MSGPARAMS(W),2)
   INFO There is no need for any version I say !@CR()Any way version is 1.0.0.0
   end
END
goto EVLOOP

:RESIZE
goto EVLOOP

:CLOSE
Exit

_____________________________________________________________________________________

_________________
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
Skit3000
Admin Team


Joined: 11 May 2002
Posts: 2166
Location: The Netherlands

PostPosted: Sun Jul 13, 2003 11:08 am    Post subject: Reply with quote

Nice code... Smile
_________________
[ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial!
Back to top
View user's profile Send private message
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Sun Jul 13, 2003 11:20 am    Post subject: Reply with quote

Looks cool CodeScript! Very Happy
_________________
FreezingFire
VDSWORLD.com
Site Admin Team
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