Preface

The Cyber Café Management System
Cyber Café Management System is a popular, powerful and easy to use Internet Café billing and Management software. In cyber Café Management System We can Manage the cyber café very efficiently and effective. We can keep the track of all the computer’s by Cyber Café Management system. In Cyber Café management system We can create new user’s who can use this software. We can change the user password and login name of the system. We can enter the system details Like Machine number and Configuration and this details can be used for billing of particular system.

Project Report :: Cyber Café Management System

Visual Basic Environment
What is Visual Basic?

Visual Basic is a tool that allows you to develop Windows (Graphic User Interface - GUI) applications. The applications have a familiar appearance to the user. As you develop as a Visual Basic programmer, you will begin to look at Windows applications in a different light. You will recognize and understand how various elements of Word, Excel, Access and other applications work. You will develop a new vocabulary to describe the elements of Windows applications. Visual Basic is event-driven, meaning code remains idle until called upon to respond to some event (button pressing, menu selection, ...). Visual Basic is governed by an event processor. Nothing happens until an event is detected. Once an event is detected, the code corresponding to that event (event procedure) is executed. Program control is then returned to the event processor.

All Windows applications are event-driven. For example, nothing happens in Word until you click on a button, select a menu option, or type some text. Each of these actions is an event. • The event-driven nature of Visual Basic makes it very easy to work with. As you develop a Visual Basic application, event procedures can be built and tested individually, saving development time. And, often event procedures are similar in their coding, allowing re-use (and lots of copy and paste).

Project Report :: Cyber Café Management System

• Some Features of Visual Basic ⇒ ⇒ ⇒ ⇒ ⇒ ⇒ ⇒ ⇒ ⇒ ⇒ ⇒ Full set of controls - you 'draw' the application Lots of icons and pictures for your use Response to mouse and keyboard actions Clipboard and printer access Full array of mathematical, string handling, and graphics functions Can handle fixed and dynamic variable and control arrays Sequential and random access file support Useful debugger and error-handling facilities Powerful database access tools ActiveX support Package & Deployment Wizard makes distributing your applications simple

Drawing the User Interface and Setting Properties • Visual Basic operates in three modes. *0 Design mode - used to build application *1 Run mode - used to run the application *2 Break mode - application halted and debugger is available We focus here on the design mode. • Six windows appear when you start Visual Basic. Each window can be viewed (made visible) by selecting menu options, depressing function keys or using the toolbar. Use the method you feel most comfortable with.
*3 The Main Window consists of the title bar, menu bar, and toolbar. The title

bar indicates the project name, the current Visual Basic operating mode, and the current form. The menu bar has drop-down menus from which you control the *4 operation of the Visual Basic environment. The toolbar has buttons that provide shortcuts to some of the menu options. The main window also shows the location of the current form relative to the upper left corner of the screen (measured in twips) and the width and length of the current form. Of particular interest is the Help menu item. The Visual Basic on-line help system is invaluable as you build

Project Report :: Cyber Café Management System

Project Report :: Cyber Café Management System . Become accustomed with its use. *0 The Form Window is central to developing Visual Basic applications.applications. Usually just pressing <F1> can get you the help you need. It is where you draw your application.

Help with any control is available by clicking the control and pressing <F1>.*0 The Toolbox is the selection menu for controls used in your application. Project Report :: Cyber Café Management System .

Help with any property can be obtained by highlighting the property of interest and pressing <F1>. Project Report :: Cyber Café Management System . The drop-down box at the top of the window lists all objects in the current form.*0 The Properties Window is used to establish initial property values for objects (controls). Under this box are the available properties for the currently selected object. Two views are available: Alphabetic and Categorized.

The cost of the project includes the cost of hardware. software development and implementation. Our system is working in the way of the user wants. and determines whether. The cost of the project is not out weighted the budget. • Technical Feasibility :- • Economic Feasibility :- Economic feasibility is the most important study that determines the cost and benefits of the proposed system and compares with the budget. A feasibility study is a test of the system proposal according to its work ability impact on the organization ability to meet user need and effective use of resources. hardware& software etc. These technical resources are sufficient for the proposed system. Different feasibility study: It center’s on the existing computer system i. determines that the system will operate in the way that user wants.Feasibility study Depending on the problem defined the project is expanded to a more detailed feasibility study. so our system is operational feasible. Project Report :: Cyber Café Management System .e. • Operational Feasibility :- In the operational feasibility.

Analysis Done For the Analysis of the Clinic Management System (CAS) various nearby Clinics were visited and a detailed study of the current system was performed.Feasibility study of the New Proposed System .Planning for time management As stated above Analysis phase is the first stone towards the building of the Proposed System.Getting user requirements and converting them to Requirement Specifications .Cost Benefit analysis .Coding . Various staff personnel were questioned about the prevailing system and problems related to it.Analysing the Current System . a.Detailed Design . which includes detailed study of the proposed system.Testing . System Analysis and Design is the core of System Development Life Cycle (SDLC). The Directors/Owners of Clinics were also part of the analysis. so it needs to be efficiently and perfectly performed.i) SYSTEM ANALYSIS ii) iii) Introduction System analysis & Design forms a major part of the project work.Analysis .Implementation & Support The first one is the Analysis phase. b. . They were asked about the amount that they could spend on the proposed System and about the scope of the proposed system. It involves many steps where detailed study of the concerned topic needs to be done. The various activities that are involved while going through Analysis phase are: . Project Report :: Cyber Café Management System . The aim of this stage is to get prepared for the development phase.Arrangement of Resources required. Their requirements were taken and understood for the design of the proposed system. System Analysis & Design includes various stages: .Preliminary Design .

Receptionist and Office Assistants.Bill generation should be provided so as to perform the work of Billing Department . Directors.At last all of them were clubbed together to perform feasibility study. What are his requirements and which of them are analysed perfectly and which one needs more study. . .Some of them required having some provision for finding out the amount collected in a certain period of time to be retrieved.There should be a provision for recording and retrieval of information about every Patient who visits the Clinic.There was also a requirement to maintain information about Doctors. iv) Requirement Specifications Now after the Current System was understood it’s the time for getting requirements for the user that what the user wants in the new online system.Most of the Clinics required some system for maintaining the Immunisation record of children. there contact information and area of Specialisation. They will follow as the report moves further Project Report :: Cyber Café Management System . These were the various requirements that were obtained from the would be End Users.There should be a provision for recording every Diagnosis given to the Patient which would be helpful in future .Requirements included the storage of information about diseases and medicines related to them so that the doctor can refer it while providing diagnosis. . The requirements that they give and were understood are . requirement specifications and further things. These requirements were satisfied by various subsystems that were proposed and discussed before.They also require some access control over the system. Requirements were taken from various people like Doctors. These systems were than designed and them coded to perform these operations. . . Compounders.

Clinic Automation Software can be developed using current available technology with efficiency and effectiveness.0 for Visual Basics 6. The cost of project depends upon the number of man hours required. which is done in the period of time). Microsoft Office for Microsoft Access for Back Hand Database management will be required. Clinic Automation Software does not require enormous amount of money to be developed.0 used for front-end interface development. C) Economical feasibility: This feasibility checks weather the system can be developed with the available funds or not. The system is fully operational. economical. The distribution of time into various tasks is given as under. For the technical perspective licensed software like Visual studio 6.A reliable Clinic Automation Software can be developed in considerable amount of time B) Technical feasibility: This feasibility says that the system should be developed with the current available technology. so it is economically feasible. D) Operational feasibility: The system is operationally feasible as it is very easy for the End users to operate it. 3 month (full The project was started on 10th July 2008 and was completed on 21th August 2008. socially and technically feasible. This can be done economically if planned judicially.1) Feasibility analysis A) Time feasibility: This feasibility says that the system should be developed within a reasonable period of time . Project Report :: Cyber Café Management System . It only needs basic information about Windows platform. Time Sheet The time schedule of the project work.

During this period various Processes specifications were done. Coding 5days (18th Aug 2008 to 23rd Aug 2008) Project Report :: Cyber Café Management System . This included very rigorous work both from developers end and users end as each design was then sent to the end user for approval and then finalized.1. Primary key and Foreign Keys are used as and when required. 2.Reports . Various modules were made and finalized as per requirements and then Input and Output Screens were designed for them.Forms . Designing of Input and Output screens includes . Detailed Design 30 days (9th Aug 2008 to 17th Aug 2008) During this period the detailed design of the project was undertaken. While designing the database care was taken for updation / deletion and insertion anomalies as well as utmost care was taken to design a non-redundant database. 3. Preliminary Design 15 days (25th Jul 2008 to 8th Aug 2008) Database Design was made and was then normalised.Menus After all this the detailed design of the project was finalized and the project is then ready for coding. 4. Analysis & User requirement Gathering 15 days (10th July 2008to 24th July 2004) During this period of time various nearby Clinics were visited and a detailed analysis of the current system was done. Then various user requirements were take n and then freezed as per the final requirements. During this period various alternative solutions were also studied for every process and then the best suitable solution was taken out from it.

During this period of actual coding of the modules designed in the Detailed Design stage were done. reports and other modules. 6. Project Report :: Cyber Café Management System . It was the Alpha Testing performed at Developers site.0 with back end support of Microsoft Access 97. 5. Coding was performed in Visual Basics 6. Coding for performed for various user actions and inputs as well as for the outputs like reports that user required. Beta testing was done at a nearby Clinic and it took 2 days only because the Software was almost up to mark as per user requirements. It took such a less time because the End users were familiar with Windows environment thus only menus and some forms were needed to be taught to them. The User manual was created during the coding and testing phase collectively so it is not stated separately. Support & Implementation 2 days (21th Aug 2008 to 22th Aug 2008) During this time period the Software was installed properly at users site and End users were trained how to use the software. which took around 7 days to get completed. Testing 9 days (9th Aug 2008 to 12th Aug 2008) During the testing phase test data was generated first and then this data was used to test various forms.

0) Microsoft Word 2007 (Microsoft Office 2007) Microsoft Access Intel Celeron Processor 512 MB Ram Intel 810 chipset Colored Monitor Resolution 800 x 600 Software for Front End : Software used for Documentation RDBMS : : Hardware Configuration : Rest of the things are same as that of normal Personal Computers. Project Report :: Cyber Café Management System . No special or additional Hardware or Software was used in project work.0 (Visual Studio 6.Details of Hardware & Software used Hardware and Software used while developing this project are : Operating System : Windows Xp Visual Basics 6.

2)MAIN REPORT Database Description of database Tables and its Fields Table :: MachineDetails Field Name Machine no Processor Ram Motherboard Casing Monitor SoundCard AgpCard KeyBoard Mouse CdromDrive FloppyDrive Speaker Amount Data Type Text Text Text Text Text Text Text Text Text Text Text Text Text Text Table :: Machine Records Field Name Machine no MachineName CurrentStatus Data Type Text Text Yes/No Table :: NewMachineRecord Field Name MachineNo MachineName Data Type Number Text Project Report :: Cyber Café Management System .

MEntryDate Date/Time Table :: RateSetting Field Name OneHour StartingDate EndingDate Comment Data Type Number Date/Time Date/Time Text Table :: Tran Field Name StartTime MachineNo Amount BillNo Date Mounth Year EndTime Hour Minute Dt Data Type Date/Time Text Text Currency Date/Time Number Number Date/Time Number Number Text Table :: Users Field Name UserName UserId EndingDate Comment Data Type Text Text Text Date/Time Table :: Chek Field Name Count Data Type Number Table :: Chek Field Name last_date Data Type Date/Time Project Report :: Cyber Café Management System .

CN While rs. Password End If If rs.EOF = False If LCase(txtUserId. Create New User (frmAddnewUser) :: Dim rs As New ADODB.SetFocus MsgBox "Please Enter Password" Exit Sub ElseIf txtConfirmPassword.CursorLocation = adUseClient rs.CursorType = adOpenStatic rs.Open "select * from Users". vbOKOnly.LockType = adLockOptimistic rs.Text = txtConfirmPassword.Text = "" Then txtPassword.Text Then MsgBox "Password doesn't match".Text = "" Then txtUserName.Text) = rs("UserId") Then MsgBox "User Id Already Exists" txtUserId.SetFocus txtUserId.Close End If rs.SetFocus MsgBox "Please Enter User Name" Exit Sub ElseIf txtUserId.current_date hours_consumed Date/Time Number Decription of Forms And Their Code 1).Text = "" Then txtOldPassword.Text = "" Then txtUserId.State = adStateOpen Then rs.SelStart = 0 Project Report :: Cyber Café Management System .Recordset Private Sub cmdCancel_Click() Unload Me End Sub Private Sub cmdOK_Click() If txtUserName.SetFocus Exit Sub MsgBox "Please Confirm Your Password" End If If Not txtPassword.SetFocus MsgBox "Please Enter User Id" Exit Sub ElseIf txtPassword.

SetFocus 'txtUserId.Close End If rs.Any More?".Text = "" Project Report :: Cyber Café Management System .Open "select * from Users".SetFocus txtConfirmPassword.Text) rs("Password") = txtPassword.CursorType = adOpenStatic rs.Enabled = False Exit Sub End If txtUserName.Text) Exit Sub End If rs.SelLength = Len(txtUserId.SelLength = Len(txtConfirmPassword.Text = "" txtUserId.Text) MsgBox ("Your Supplied Pasword Does Not Match") Exit Sub End If If rs.Text rs("UserId") = LCase(txtUserId.Text) ' 'Exit Sub 'End If 'rs.SelStart = 0 txtConfirmPassword.Text Then txtConfirmPassword.Text = "" txtPassword. "Questions") If R <> vbYes Then cmdOk.Text rs("CreationDate") = Date rs.SelStart = 0 'txtUserId.AddNew rs("UserName") = txtUserName.Text = "" txtConfirmPassword.CursorLocation = adUseClient rs.State = adStateOpen Then rs. CN ' 'While rs.Update R = MsgBox("Successfully Created. vbYesNo.Text = rs("UserId") Then 'MsgBox "User Id Already Exists" 'txtUserId.MoveNext 'Wend rs.Text <> txtConfirmPassword.EOF = False 'If txtUserId.LockType = adLockOptimistic rs.txtUserId.MoveNext Wend If txtPassword.SelLength = Len(txtUserId.

EditMode End Sub Private Sub Form_Load() txtUserName.SetFocus End Sub Private Sub txtConfirmPassword_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then cmdOk.Text = "" 'txtUserName.SetFocus End If End Sub Project Report :: Cyber Café Management System .SetFocus End If End Sub Private Sub txtUserId_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then txtPassword.txtUserName.SetFocus End If End Sub Private Sub txtPassword_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then txtConfirmPassword.Text = "" txtPassword.SetFocus ' 'rs.Text = "" txtConfirmPassword.SetFocus End If End Sub Private Sub txtUserName_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then txtUserId.

2).Caption = Val(text2. Billing (frmBilling) :: Private Sub cmdOK_Click() If Text1." Else txttotal. vbOKOnly End If Unload Me End Sub Private Sub Command4_Click() Unload Me End Sub Project Report :: Cyber Café Management System .Text = "" Then MsgBox "Please Enter PC No.Text) * Val(20) MsgBox "Transaction Complete".

Format(date0.ForeColor = vbBlue 'RGB(170. date1. "mm").3). tel. 235) Label3(x). "dddd.Caption = Format(Date. first. HScroll1.BorderStyle = 1 Exit For End If Project Report :: Cyber Café Management System .Left = 4500 date0 = Date Command1_Click SetDate End Sub Private Sub SetDate() Label2. tel As Integer Private Sub Command1_Click() HScroll1.ForeColor = vbRed Label3(x). date3 As String Dim x. dd mmmm yyyy") For x = 0 To 36 If Label3(x). date1.Top = 1600 Me. 238. date1) If DateDiff("m". "yyyy")) For x = 0 To 36 Label3(x).Value.Value = 0 date0 = DateAdd("m".Value = 0 HScroll2. Calender (frmCalander.frm) :: Option Explicit Dim date0.Caption = Day(Date) Then Label3(x).Visible = True tel = tel + 1 Next x If date0 = Date Then Label4. "mmmm")) Label211.1 date2 = date1: tel = 0 For x = first To 36 date2 = DateAdd("d".Visible = False Label3(x).Caption = Day(date2) Label3(x).Caption = (Format(date0. "w")) . "yyyy"). date2) > 0 Then Exit For Label3(x).BorderStyle = 0 Next x first = Val(Format(date1. 1) End Sub Private Sub Form_Activate() Me. Date) date1 = DateSerial(Format(date0. date2.Caption = UCase(Format(date0.

Value * 12) + HScroll1. UnloadMode As Integer) Unload Me End Sub Private Sub HScroll1_Change() date0 = DateAdd("m". Date) date1 = DateSerial(Format(date0. (HScroll2.Value.Value * 12) + HScroll1. 1) SetDate End Sub Private Sub HScroll2_Change() date0 = DateAdd("m". Format(date0. (HScroll2. 1) SetDate End Sub Project Report :: Cyber Café Management System . Format(date0.Next x End If HScroll1.SetFocus End Sub Private Sub Form_QueryUnload(Cancel As Integer.Value. "mm"). "yyyy"). "mm"). Date) date1 = DateSerial(Format(date0. "yyyy").

SelStart = 0 txtConfirmPassword.LockType = adLockOptimistic rs.Text <> txtNewPassword.Close End If rs.SetFocus Exit Sub MsgBox "Please Confirm Your Password" End If If txtConfirmPassword.Text = rs("Password") txtUserName.4).Text = "" Then txtOldPassword.State = adStateOpen Then rs.Text = rs("UserName") txtNewPassword.SelLength = Len(txtConfirmPassword. CN txtOldPassword.Text) MsgBox "Both Password Doesn't Match" Exit Sub End If If rs.Close End If rs.Text = "" Then txtNewPassword. Change Password (frmChangePassword.SetFocus MsgBox "Please Enter a Password" Exit Sub ElseIf txtConfirmPassword.SetFocus txtConfirmPassword.SetFocus ' MsgBox "Please Enter a Value" ' Exit Sub If txtNewPassword.State = adStateOpen Then rs.CursorType = adOpenStatic rs.frm) :: Dim rs As New ADODB.CursorLocation = adUseClient rs.CursorLocation = adUseClient Project Report :: Cyber Café Management System .Text Then txtConfirmPassword.Open "select * from Users where UserId='" & cmbUserId & "'".SetFocus End Sub Private Sub cmdOK_Click() If User = True Then ' If txtOldPassword.Text = "" Then ' txtOldPassword.Recordset Private Sub cmbUserId_Click() If rs.

Text 'Data1. .txtOldPassword.Text = "" 'cmbUserId.Recordset.Recordset.State = adStateOpen Then rs.Path & "\Cyber.Text & "'" 'If Data1.RecordCount > 0 Then GoTo Correct ' Data1.SetFocus Exit Sub End If If txtConfirmPassword.Update rs("Password") = txtConfirmPassword.FindFirst "password='" & Form1.Text) 'MsgBox "Please Enter a Correct Password" 'Exit Sub 'Else 'Data1.DatabaseName = App.Recordset.rs.Text <> txtNewPassword.Text Then txtConfirmPassword.CursorType = adOpenStatic rs.Open "select * from Users where UserId='" & txtUserId.RecordCount > 0 Then GoTo Correct End Sub Project Report :: Cyber Café Management System .SelStart = 0 txtConfirmPassword.mdb" ' Data1.Text) MsgBox "Both Password Doesn't Match" Exit Sub End If If rs.Close End If rs.Text rs.LockType = adLockOptimistic rs.Text = "" txtNewPassword.ListIndex (0) 'txtOldPassword.SetFocus txtConfirmPassword.SelStart = 0 'txtOldPassword.LockType = adLockOptimistic rs.Text & "'".Edit Correct: 'Data1. CN If rs. "Change Pass" txtOldPassword.CursorType = adOpenStatic rs.Recordset.SelLength = Len(txtOldPassword.CursorLocation = adUseClient rs.Text = "" txtConfirmPassword.SetFocus 'txtOldPassword. CN If rs.NoMatch = True Then 'txtOldPassword.Update MsgBox "Your Password hass Changed".Refresh 'Data1.RecordSource = "select * from user_id" 'Data1.SelLength = Len(txtConfirmPassword.Recordset("password") = txtConfirmPassword.Open "select * from Users where UserId='" & cmbUserId.Text & "'".

Visible = True If rs.Text = rs("Password") End If Project Report :: Cyber Café Management System .Recordset.CancelUpdate End Sub Private Sub cmdExit_Click() Unload Me 'Unload frmLogin End Sub Private Sub Form_Load() If User = True Then txtUserId.AddItem rs("UserId") ' End If rs.LockType = adLockOptimistic rs.Edit 'Unload Me 'Data1.CursorType = adOpenStatic rs.Recordset. CN While rs.Visible = False txtUserId.LockType = adLockOptimistic rs.CursorLocation = adUseClient rs.CursorType = adOpenStatic rs.MoveNext Wend Else ' cmdExit.Open "select * from Users where UserId='" & UserNa & "'". CN If rs.RecordCount > 0 Then txtUserName.Visible = True txtUserId.Visible = True 'cmdDelete.Close End If rs.Text = UserNa If rs.Open "select * from Users".Text = rs("UserName") txtOldPassword.State = adStateOpen Then rs.Private Sub cmdCancel_Click() 'Data1.EOF = False 'If IsNull(rs("TotalTime")) Then cmbUserId.Close End If rs.Appearance = AlignmentConstants cmbUserId.CursorLocation = adUseClient rs.Visible = False cmbUserId.State = adStateOpen Then rs.

SetFocus End If End Sub Project Report :: Cyber Café Management System .SetFocus End If End Sub Private Sub txtNewPassword_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then txtConfirmPassword.End If End Sub Private Sub txtConfirmPassword_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then cmdOk.

5). Delete (frmDelete.frm) ::
Dim rs As New ADODB.Recordset Private Sub cmbUserId_Click() If rs.State = adStateOpen Then rs.Close End If rs.CursorLocation = adUseClient rs.CursorType = adOpenStatic rs.LockType = adLockOptimistic rs.Open "select * from Users where UserId='" & cmbUserId.Text & "'", CN If rs.RecordCount > 0 Then txtUserName.Text = rs("UserName") txtUserName.Visible = True txtPassword.Text = rs("Password") txtPassword.Visible = True txtCreationDate.Text = rs("CreationDate") txtCreationDate.Visible = True Label2.Visible = True Label3.Visible = True Label4.Visible = True cmdRefresh.Enabled = True End If End Sub Private Sub cmdDelete_Click() Label1.Visible = True Label5.Visible = True cmbUserId.Visible = True 'cmdRefresh.Enabled =True End Sub Private Sub cmdRefresh_Click() R = MsgBox("Are U Confirm to Delete", vbYesNo, "Warning") If R <> vbYes Then Label1.Visible = False Label2.Visible = False Label3.Visible = False Label4.Visible = False Label5.Visible = False cmbUserId.Visible = False

Project Report :: Cyber Café Management System

txtUserName.Visible = False txtPassword.Visible = False txtCreationDate.Visible = False cmdRefresh.Enabled = False Exit Sub End If If rs.State = adStateOpen Then rs.Close End If rs.CursorLocation = adUseClient rs.CursorType = adOpenStatic rs.LockType = adLockOptimistic rs.Open "select * from Users where UserId='" & cmbUserId.Text & "'", CN If rs.RecordCount > 0 Then rs.Delete adAffectCurrent MsgBox "Record has been Deleted" Else MsgBox "No Record Found", , "Message" Exit Sub End If ' txtOldPassword.Text = "" 'txtMachineName.Text = "" 'cmdUserId.un cmbUserId.Clear Form_Load 'Label1.Visible = False 'Label2.Visible = False 'Label3.Visible = False 'Label4.Visible = False 'Label5.Visible = False 'cmdUserId.Visible = False 'txtUserName.Visible = False 'txtPassword.Visible = False 'txtCreationDate.Visible = False End Sub Private Sub Command1_Click() Unload Me End Sub Private Sub Form_Load() Label1.Visible = False Label2.Visible = False Label3.Visible = False Label4.Visible = False Label5.Visible = False

Project Report :: Cyber Café Management System

cmbUserId.Visible = False txtUserName.Visible = False txtPassword.Visible = False txtCreationDate.Visible = False cmdRefresh.Enabled = False If rs.State = adStateOpen Then rs.Close End If rs.CursorLocation = adUseClient rs.CursorType = adOpenStatic rs.LockType = adLockOptimistic rs.Open "select * from Users ", CN If rs.RecordCount > 0 Then While rs.EOF = False cmbUserId.AddItem rs("UserId") rs.MoveNext Wend End If End Sub

Project Report :: Cyber Café Management System

Enabled = False Call check 'Label5.Visible = False 'Label5.Show frmLogon.Recordset Private Sub Command1_Click() 'frmSplash.Hide End Sub Private Sub Command2_Click() Unload Me End Sub Private Sub Form_Load() flag = True 'Label1.Text1.6).AttendConn 'modconn.Show 'Unload Me Me.Visible = False modconn. Intialization (frmInitialization.Text End Sub Private Sub Form_Unload(Cancel As Integer) Unload frmLogon Unload MDIForm1 modconn.Caption = frmmain.frm) :: Option Explicit Dim a As Integer Dim flag As Boolean Dim rs As New ADODB.CloseConn End Sub Private Sub Label6_Click() End Sub Private Sub Label7_Click() End Sub Project Report :: Cyber Café Management System .Caption = Count TimerCheck.counted 'Label5.

Private Sub Timer1_Timer() '''a = a + 1 '''If a = 5 Then '''frmLogon.CursorType = adOpenStatic rs.Visible = False flag = False Else ''Shape2.Enabled = True 'frmmain.MnuReport.LockType = adLockOptimistic 'frmmain.Visible = True 'Shape2.State = adStateOpen Then rs.MnuReport.Visible = True ''Shape1.RecordCount > 0 Then 'rs.Show '''Unload Me '''End If ''Label1.MnuAdmin.Update End If Project Report :: Cyber Café Management System .Open "select * from Chek".Visible = True 'Label5.CursorLocation = adUseClient rs.Visible = False ''Label1.Close End If rs.ForeColor = QBColor(15) 'Label5.Visible = True If flag = True Then ''Label1.Visible = False 'Label1.ForeColor = QBColor(15) flag = True End If End Sub Public Sub check() If rs.MnuAdmin. CN 'If txtUserName = "Administrator" Then 'frmmain.ForeColor = QBColor(12) 'Shape1.Enabled = True rs.AddNew 'rs("mn") = rs("mn") + 1 rs("count") = rs("count") + 1 rs.Open "select * from status where procode= '" & procod & "'and netcode='" & netcod & "'".Enabled = False 'RS1.ForeColor = QBColor(12) 'Label5. CN If rs.Enabled = False 'frmmain.

CN If rs.Enabled = True 'Unload frmmain End If 'If count > 10 Then 'Unload frmLogon 'Unload frmmain 'End If End If End Sub Private Sub TimerCheck_Timer() a=a+1 If a = 10 Then Unload frmInitialization End If End Sub Project Report :: Cyber Café Management System .Caption = rs("count") .RecordCount > 0 Then 'Label5.LockType = adLockOptimistic rs.1 ''MsgBox "Updated" ''Text1.CursorType = adOpenStatic rs.CursorLocation = adUseClient rs.' If rs.Text = c ''Text1.Close End If rs.Text = rs("count") If rs("count") > 100 Then TimerCheck.Open "select count from Chek".State = adStateOpen Then rs.

Close End If rs.SetFocus Private Sub cmdExit_Click() Unload Me End Sub Private Sub cmdCancel_Click() Unload Me Unload MDIForm1 Unload frmInitialization End Sub Private Sub cmdCancel_GotFocus() End Sub Private Sub cmdOK_Click() 'Call check If rs.LockType = adLockOptimistic 'frmmain.Show If rs("UserId") = "admin" Then User = True Project Report :: Cyber Café Management System .Recordset 'txtUserName. CN If rs.MnuReport. CN 'If txtUserName = "Administrator" Then 'frmmain.7).Enabled = True rs.Open "select * from Users where UserId='" & txtUserName & "'and Password='" & txtPassword & "'".MnuReport.CursorType = adOpenStatic rs.MnuAdmin. vbInformation + vbSystemModal. Login Form (frmLogon.MnuAdmin.Open "select * from status where procode= '" & procod & "'and netcode='" & netcod & "'". "Access Granted" ' frmmain.Enabled = False 'RS1.frm) :: Dim ChrPass As String Dim rs As New ADODB.Enabled = False 'frmmain.CursorLocation = adUseClient rs.Enabled = True ' MainMdi.Enabled = True 'frmmain.State = adStateOpen Then rs.RecordCount > 0 Then 'Call check ' MsgBox "A c c e s s G r a n t e d".

".Visible = True 'frmmain.mnu_deleteRecord.AttendConn 'ChrPass = "secret" Me.Enabled = True End If Me.SmnuComputersetting.Enabled = True Else MsgBox "Invalid Password ! Please try again.Enabled = True MDIForm1.MnuAdmin.Enabled = True 'frmmain.'frmmain.mnu_createNUser.AttendConn MDIForm1.Enabled = False 'Timer2.Hide UserNa = txtUserName MDIForm1.MDIForm1.Show End Sub Private Sub Form_Unload(Cancel As Integer) ' If Not txtPassword = ChrPass Then ' Unload Me '' Unload MainMdi ' ' Else ' Load MainMdi Project Report :: Cyber Café Management System .Enabled = True 'frmmain.mnu_int_admin.MnuReport.Left = 4900 ' MainMdi.Enabled = True 'frmmain.Top = 3200 Me.mnu_computerSetting.Enabled = True MDIForm1.Enabled = True MDIForm1.Enabled = True ' .SmnuRateofbilling.Enabled = False 'frmmain.MnuAdmin.Enabled = True 'frmmain.Caption = Time & " User Logon" 'modconn.Left = 3700 lbl1.Interval = 100 'Unload Me 'modconn.Text = "" txtPassword. "Invalid Password" txtPassword.Enabled = True 'frmmain.SmnuNewuser. vbCritical + vbSystemModal.Enabled = True 'mnu_changeUPassword.SmnuRecorddelete.SetFocus Exit Sub End If End Sub Private Sub Form_Load() 'Label1.Enabled = False MDIForm1.mnu_rateOBilling.MnuReport.

'frmmain.Visible = False lbl1.Visible = True lbl1.Left <= -3900 Then lbl2.50 If lbl2.Left <= -1500 Then lbl2.Left .Show ' End If 'modconn.Move lbl2. vbLowerCase) ' cmdOK_Click 'End If 'End Sub Private Sub txtUserName_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then txtPassword.Text = LCase(txtUserName.Visible = True lbl1.Enabled = True ' MainMdi.CloseConn Unload MDIForm1 End Sub Private Sub Timer1_Timer() 'lbl1.Left .50 If lbl1.Left = 4900 End If End If End Sub 'Private Sub txtPassword_KeyPress(KeyAscii As Integer) ' If KeyAscii = 13 Then ' txtPassword = StrConv(txtPassword.Left <= -2850 Then 'If lbl1.Left = 4900 lbl2.SetFocus End If End Sub Private Sub txtUserName_LostFocus() txtUserName.Text) End Sub Project Report :: Cyber Café Management System .Visible = False lbl2.Left = 4900 lbl1.Move lbl1.

Recordset Private Sub cmbMachineNo_Click() '******************************************** ' DAO Start '******************************************* 'Data1.Visible = True 'cmbMachineNo.Text = Data1.Recordset.Recordset("MachineName") 'txtMachineNo.Text & "'" 'txtMachineNo.8).Path & "\Cyber. Computer Setting (frmpcsetting.Text = rs("MachineNo") txtMachineName.Text = Data1.SelStart = 0 txtMachineName.SelLength = Len(txtMachineName.Visible = False End If End Sub Private Sub cmdOK_Click() '**************************************************** 'DAO Start Project Report :: Cyber Café Management System .Visible = True cmbMachineNo.CursorLocation = adUseClient rs.RecordCount > 0 Then txtMachineNo.Close End If rs.Visible = False '************************************ 'DAO End '************************************ '********************************************** 'ADODB START '********************************************** If rs.Refresh 'Data1.State = adStateOpen Then rs.Text = rs("MachineName") txtMachineName.CursorType = adOpenStatic rs.FindFirst "MachineNo='" & cmbMachineNo.DatabaseName = App.Text) txtMachineNo.RecordSource = "select * from MachineRecords" 'Data1.Open "select * from MachineRecords where MachineNo='" & cmbMachineNo.SetFocus txtMachineName.LockType = adLockOptimistic rs. CN If rs.mdb" 'Data1.Recordset("MachineNo") 'txtMachineName.frm) Dim str As String Dim rs As New ADODB.Text & "'".

Refresh ''Data1.Text) '' MsgBox "Machine No already Exit".DatabaseName = App.SetFocus ''MsgBox "Please enter a Machine Name".Clear '' Data1.Refresh '' cmbMachineNo.'**************************************************** '' If str = "AddNew" Then ''If txtMachineNo.SetFocus ''MsgBox "Please enter a Machine No". "Login" '' Exit Sub '' End If ''Data1.Text ''Data1.Path & "\Cyber.DatabaseName = App.SetFocus '' txtMachineNo.Recordset.Text = "" Then ''txtMachineNo.Recordset("MachineNo") = txtMachineNo.RecordSource = "select * from MachineRecords" ''Data1.Recordset. "Warnig" ''Exit Sub ''End If ''Data1.Visible = True ''ElseIf str = "Modify" Then '' Data1.Visible = False '' cmdAddNew.Recordset("MachineNo") '' Data1.MoveNext '' Loop '' cmbMachineNo.FindFirst "MachineNo='" & txtMachineNo.Recordset.Path & "\Cyber.mdb" '' Data1.Text ''Data1.RecordSource = "select * from MachineRecords" '' Data1.EOF '' cmbMachineNo.Recordset.Recordset.Visible = True '' cmdModify. "Warnig" ''Exit Sub ''ElseIf txtMachineName. .Visible = True '' cmdDelete.FindFirst "MachineNo='" & cmbMachineNo.SelStart = 0 '' txtMachineNo.Text & "'" Project Report :: Cyber Café Management System .Path & "\Cyber.Recordset("MachineName") = txtMachineName.AddNew ''Data1.AddItem Data1.mdb" ''Data1.ListIndex = 0 '' cmdOK.Text = "" Then ''txtMachineName. .Text Then '' txtMachineNo.Text & "'" '' If Data1.AddItem "Select a Machine name" '' Do While Not Data1.mdb" '' Data1.Recordset.RecordSource = "select * from MachineRecords" '' Data1.Recordset("MachineNo") = txtMachineNo.Update ''MsgBox "New Entery Completed" '' cmbMachineNo.Refresh ''Data1.SelLength = Len(txtMachineNo. .DatabaseName = App.

RecordCount > 0 Then txtMachineNo.Refresh '' cmbMachineNo. CN If rs.Text = "" Then txtMachineName.mdb" '' Data1.RecordSource = "select * from MachineRecords" '' Data1.CursorType = adOpenStatic rs.Text ''Data1.Recordset.Edit ''Data1. .LockType = adLockOptimistic rs.''Data1.Recordset.Visible = True '' cmdModify. "Warnig" Exit Sub ElseIf txtMachineName.Recordset("MachineName") = txtMachineName.SetFocus txtMachineNo.Recordset("MachineNo") = txtMachineNo.AddItem Data1.Path & "\Cyber.Text = "" Then txtMachineNo.SelStart = 0 Project Report :: Cyber Café Management System .State = adStateOpen Then rs.Update ''MsgBox "Updation Comleted" '' cmbMachineNo.DatabaseName = App.Text ''Data1.Clear '' Data1.Open "select * from MachineRecords where MachineNo='" & txtMachineNo.Visible = True '' cmdDelete.Recordset("MachineNo") '' Data1.ListIndex = 0 '' cmdOK.Visible = False '' cmdAddNew.Recordset.SetFocus MsgBox "Please enter a Machine Name". "Warnig" Exit Sub End If If rs.CursorLocation = adUseClient rs.SetFocus MsgBox "Please enter a Machine No".Close End If rs. .Recordset.Text & "'".Visible = True ''End If '******************************************************** 'DAO End '******************************************************** '******************************************************** 'ADO Start '******************************************************** If str = "AddNew" Then If txtMachineNo.MoveNext '' Loop '' cmbMachineNo.AddItem "Select a Machine name" '' Do While Not Data1.EOF '' cmbMachineNo.

ListIndex = 0 cmdOk.Open "select * from MachineRecords".EOF = False cmbMachineNo.CursorLocation = adUseClient rs.Enabled = True cmdModify.Clear '**************************************** 'Here Loaded Combo after Update Database '**************************************** If rs.LockType = adLockOptimistic rs. "Login" Exit Sub End If rs.Enabled = False cmdAddNew.State = adStateOpen Then rs.EditMode rs("MachineNo") = txtMachineNo.CursorLocation = adUseClient rs. CN 'rs.CursorType = adOpenStatic rs.LockType = adLockOptimistic rs.txtMachineNo.Close End If rs.AddNew rs("MachineNo") = txtMachineNo.State = adStateOpen Then rs.Enabled = True cmdDelete.SetFocus ElseIf str = "Modify" Then If rs.CursorType = adOpenStatic rs.Close End If rs.Text rs("MachineName") = txtMachineName.Update MsgBox "New Entery Completed" cmbMachineNo.Text rs.Text rs("MachineName") = txtMachineName.Open "select * from MachineRecords where MachineNo='" & cmbMachineNo.MoveNext Wend cmbMachineNo.Text) MsgBox "Machine No already Exist".Clear '***************************************************** Project Report :: Cyber Café Management System .Text & "'".Text rs.SelLength = Len(txtMachineNo. . CN While rs.AddItem rs("MachineNo") rs.Update MsgBox "Updation Comleted" cmbMachineNo.Enabled = True cmdExit.

'Again loaded into combo '***************************************************** If rs.Shape2.Visible = True End Sub Private Sub cmdAddNew_Click() txtMachineNo.Enabled = True cmdDelete.Visible = False cmbMachineNo.Enabled = False cmdDelete.EOF = False cmbMachineNo.Close End If rs.Visible = False txtMachineNo. CN While rs.MoveNext Wend cmbMachineNo.Enabled = False cmdAddNew.AddItem rs("MachineNo") rs.Enabled = False 'cmdRefresh.SetFocus End If '******************************************************** 'ADO End '******************************************************** 'frmpcstatus.Text = "" txtMachineName.SetFocus str = "AddNew" cmdAddNew.Enabled = True cmdModify.LockType = adLockOptimistic rs.Visible = False cmdOk.State = adStateOpen Then rs.Enabled = True cmdDelete.Enabled = True cmdExit.Text = "" txtMachineNo.Enabled = True cmdModify.FillColor = QBColor(11) End Sub Private Sub cmdCancel_Click() cmdAddNew.Enabled = True 'cmdRefresh.Enabled = True Project Report :: Cyber Café Management System .Enabled = False cmdModify.Locked = False txtMachineNo.Open "select * from MachineRecords".CursorLocation = adUseClient rs.CursorType = adOpenStatic rs.ListIndex = 0 cmdOk.

Enabled = True cmdCancel.Delete 'MsgBox "Record has been Deleted" 'Data1.Visible = True txtMachineNo.End Sub Private Sub cmdModify_Click() cmbMachineNo.Clear 'Data1.RecordCount = 0 Then 'MsgBox "No Record Found".DatabaseName = App.DatabaseName = App. vbYesNo.Path & "\Cyber.Text = "" ' txtMachineName.Recordset. .Enabled = False cmdDelete.Enabled = False cmdRefresh.Enabled = False cmbMachineNo.mdb" 'Data1.Enabled = False cmdModify.Recordset.FindFirst "MachineNo='" & txtMachineNo.Recordset.Visible = False txtMachineNo.Enabled = False cmdAddNew.RecordSource = "select * from MachineRecords" ' Data1.RecordSource = "select * from MachineRecords" Project Report :: Cyber Café Management System .Text = "" ' cmbMachineNo.Refresh 'Data1.MoveFirst 'If Data1.mdb" ' Data1.Visible = False End Sub Private Sub cmdRefresh_Click() '***************************************************** '*DAO Start '***************************************************** 'Data1.Locked = False txtMachineName.Path & "\Cyber.Enabled = False cmdRefresh. "Message" 'Exit Sub 'End If ' txtMachineNo.Visible = True txtMachineNo.Enabled = True End Sub Private Sub cmdDelete_Click() d = MsgBox("Are you sure".Enabled = True cmdDelete.Enabled = False cmdOk.Locked = False str = "Modify" cmdModify.Enabled = False cmdAddNew. "Warnig") If d <> vbYes Then Exit Sub cmdOk.Recordset.Text & "'" 'Data1.

CN If rs.RecordCount > 0 Then rs.Update Project Report :: Cyber Café Management System .Recordset.Recordset("MachineNo") 'Data1.Text = "" txtMachineName.EOF 'cmbMachineNo.AddItem "Select a Machine name" 'Do While Not Data1.MoveNext Wend 'rs.Text = "" cmbMachineNo.Visible = True 'cmdDelete.Open "select * from MachineRecords".EOF = False cmbMachineNo. "Message" Exit Sub End If txtMachineNo.CursorType = adOpenStatic rs.CursorLocation = adUseClient rs. CN While rs.LockType = adLockOptimistic rs.'Data1.Recordset.CursorLocation = adUseClient rs.Visible = False 'cmdAddNew.AddItem Data1.Delete adAffectCurrent MsgBox "Record has been Deleted" Else MsgBox "No Record Found".Refresh ''cmbMachineNo.Open "select * from MachineRecords where MachineNo='" & txtMachineNo.Clear If rs.MoveNext 'Loop ''cmbMachineNo.CursorType = adOpenStatic rs. .Close End If rs.Visible = True 'cmdModify.State = adStateOpen Then rs.Close End If rs.ListIndex = 0 'cmdRefresh.AddItem rs("MachineNo") rs.LockType = adLockOptimistic rs.Visible = True '***************************************************** '*DAO End '***************************************************** '***************************************************** '*ADO Start '***************************************************** If rs.Text & "'".State = adStateOpen Then rs.

Enabled = False cmdAddNew.State = adStateOpen Then rs.Recordset.MoveNext Wend '**************************************** 'ADO End '*************************************** Project Report :: Cyber Café Management System .Path & "\Cyber.Enabled = True '***************************************************** '*ADO End '***************************************************** End Sub Private Sub cmdExit_Click() Unload Me End Sub Private Sub Form_Load() '***************************************************** 'DAO Start '***************************************************** 'Data1.Enabled = True cmdDelete.ListIndex = 0 '************************************ 'DAO End '************************************ '****************************************************** 'ADO Start '****************************************************** If rs.EOF = False cmbMachineNo.AddItem Data1.AddItem "Select a Machine name" 'Do While Not Data1.CursorLocation = adUseClient rs.Enabled = True cmdModify.LockType = adLockOptimistic rs.AddItem rs("MachineNo") rs.cmdRefresh.RecordSource = "select * from MachineRecords" 'Data1.MoveNext 'Loop 'cmbMachineNo.Open "select * from MachineRecords". CN While rs.Close End If rs.Recordset.EOF 'cmbMachineNo.mdb" 'Data1.CursorType = adOpenStatic rs.DatabaseName = App.Refresh 'cmbMachineNo.Recordset("MachineNo") 'Data1.

Enabled = False cmdOk.SetFocus = True End Sub Private Sub txtMachineName_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then cmdOk.SetFocus 'cmdCancel.SetFocus End If End Sub Private Sub txtMachineNo_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then txtMachineName.SetFocus End If End Sub Public Sub check() End Sub Project Report :: Cyber Café Management System .cmdRefresh.Enabled = False txtMachineNo.Locked = True 'cmdAddNew.

CursorType = adOpenStatic rs.Enabled = True cmdModify.Locked = False 'txtThirtyFortyfive.Update MsgBox "Settings has benn Updated" cmdOk.frm) Dim rs As New ADODB.Close End If rs.Locked = True End Sub Private Sub cmdModify_Click() s = MsgBox("Want to Modify your Settings".Text = "" txtPerHour.Recordset Private Sub cmdOK_Click() If rs.Fields("15_30") = Val(txtFifteenThirty.Fields("OneHour") = Val(txtPerHour.LockType = adLockOptimistic rs.Locked = True ''txtThirtyFortyfive. "Settings") If s <> vbYes Then Exit Sub txtStartingDate.Enabled = True ''txtZeroFifteen.Fields("StartingDate") = Date rs.CursorLocation = adUseClient rs.Enabled = False End Sub Project Report :: Cyber Café Management System .Locked = False 'txtFifteenThirty.Update rs.Enabled = False cmdModify.Fields("45_60") = Val(txtZeroFifteen.9).Locked = True ''txtFifteenThirty.Open "select * from RateSetting where EndingDate is null". vbYesNo.Text) 'rs.State = adStateOpen Then rs.Text) rs.Visible = False txtPerHour.Locked = False 'txtFortyfiveSixty.Text) 'rs.Locked = True ''txtFortyfiveSixty.Text) 'rs. Rate Setting (frmRateSetting.Visible = False Label2.Locked = False cmdOk.AddNew rs.SetFocus 'txtZeroFifteen. CN rs("EndingDate") = Date rs.Fields("30_45") = Val(txtZeroFifteen.

Close End If rs.Fields("OneHour") txtStartingDate.CursorType = adOpenStatic rs.LockType = adLockOptimistic rs. CN txtPerHour.State = adStateOpen Then rs.Text = rs.Open "select * from RateSetting where EndingDate is Null".Enabled = False End Sub Project Report :: Cyber Café Management System .Text = rs.CursorLocation = adUseClient rs.Fields("StartingDate") cmdOk.Private Sub cmdCancel_Click() Unload Me End Sub Private Sub Form_Load() If rs.

10).dll" Alias "ShellExecuteA" (ByVal hwnd As Long. ByVal nShowCmd As Long) As Long Dim rs As New ADODB.Text = rs("MachineName") M1.Recordset Private Sub cmbMachineNo_Click() '********************************************** 'DAO Start '********************************************** 'Data1.Text = "" cmdOk.Open "select * from MachineRecords where MachineNo='" & cmbMachineNo.RecordSource = "select * from machine_records" 'Data1.CursorLocation = adUseClient rs.CursorType = adOpenStatic rs.Recordset("machine_name") 'cmdOk.FindFirst "machine_no='" & cmbMachineNo. ByVal lpFile As String.Text & "'". ByVal lpParameters As String.Text = Data1.Text = "" 'cmdOk. Transaction (frmTransaction.Enabled = True '*********************************************** 'ADO Start '*********************************************** If rs.NoMatch = True Then 'txtMachineName.Recordset.Text = Format(Now.Enabled = False ''MsgBox "Machine No doesn't exit" 'Exit Sub 'End If 'txtMachineName.Close End If rs.Text & "'" 'If Data1.Enabled = True 'MsgBox "Machine No doesn't exit" Exit Sub End If xtMachineName. ByVal lpDirectory As String.Refresh 'Data1.Text = Time cmdOk.Path & "\Cyber.LockType = adLockOptimistic rs.Enabled = False Project Report :: Cyber Café Management System .DatabaseName = App.mdb" 'Data1.Recordset.Recordset Dim rs1 As New ADODB. CN If rs.State = adStateOpen Then rs. ByVal lpOperation As String. "dd/mm/yyyy") txtStartTime.RecordCount > 0 Then txtMachineName.frm) Private Declare Function ShellExecute Lib "shell32.

Recordset.Recordset.Text 'Data1.DatabaseName = App.FindFirst "machine_no='" & cmbMachineNo.mdb" ' Data2. "Entery") ' If r <> vbYes Then Exit Sub 'Data1.Recordset("mnts") = 0 'Debug.Recordset("mont") = 0 ''Data1.Update ' End If ' r = MsgBox("New Entery".Update 'cmdOk. "dd/mm/yyyy") 'Data1.Recordset.Recordset("hr")) Then ' 'MsgBox "Machine is Already Alloted".Refresh 'Data1.Text & "'" ' 'If Not IsNull(Data2. "Warning" ' Exit Sub ' Else ' Data2.Refresh ' Data2.Recordset("end_time") = 0 ''Data1.Recordset("total_time") = 0 ''Data1.Enabled = False Project Report :: Cyber Café Management System .AddNew 'Data1.Text).Print Format(CVDate(M1. .Path & "\Cyber.Recordset.mdb" 'Data1.Path & "\Cyber.Text). "Warning" ' 'Exit Sub ' 'End If ' If Data2.Recordset("amount") = 0 ''Data1. .End Sub Private Sub cmdOK_Click() '*********************************** 'DAO Start '*********************************** ' Data2.Edit ' Data2. "dd/mm/yyyy") ''********** ''Data1.Recordset("machine_no") = cmbMachineNo.Recordset("yr") = 0 ''Data1.Recordset("hr") = 0 ''Data1.RecordSource = "select * from transaction" 'Data1. vbYesNo.Recordset("oc") = True Then ' MsgBox "Machine is Already Alloted".Recordset("oc") = True ' Data2.DatabaseName = App.Recordset("start_time") = CDate(txtStartTime.Text) 'Data1.RecordSource = "select * from machine_records" ' Data2.Recordset("date") = Format(CVDate(M1.Recordset("bill_no") = 0 ''Data1.Recordset.

Open "select * from Tran".Text = "" 'M1. .Text = "" Project Report :: Cyber Café Management System .Close End If rs.LockType = adLockOptimistic rs.Text).State = adStateOpen Then rs.LockType = adLockOptimistic rs1.Update 'loadTransaction cmdOk. vbYesNo.AddNew rs1("StartTime") = CDate(txtStartTime.Text = "" txtStartTime.Print modconn.CursorLocation = adUseClient rs1.'Debug. CN If rs.CursorType = adOpenStatic rs. "Warning" ' Exit Sub ' Else rs("CurrentStatus") = True rs.CursorType = adOpenStatic rs1.sa '************************************************ 'ADO Start '*********************************************** If rs.State = adStateOpen Then rs1.Text & "'".CursorLocation = adUseClient rs.Update End If ' r = MsgBox("New Entery".sa cmbMachineNo.Close End If rs1.Text) rs1("MachineNo") = cmbMachineNo.Recordset.Open "select * from MachineRecords where MachineNo='" & cmbMachineNo.Print modconn. "dd/mm/yyyy") rs1. "Entery") ' If r <> vbYes Then Exit Sub If rs1.Update 'Data1.Clear txtMachineName.Text rs1("Date") = Format(CVDate(M1. CN ' rs1.Enabled = False 'Form_Load 'Debug.RecordCount > 0 Then 'If rs("CurrentStatus") = True Then ' MsgBox "Machine is Already Alloted".

RecordCount > 0 Then While rs.DatabaseName = App.CursorLocation = adUseClient rs.Close End If rs.CursorLocation = adUseClient rs.State = adStateOpen Then rs.Open "select * from MachineRecords".LockType = adLockOptimistic rs.CursorType = adOpenStatic rs.Recordset.Close End If rs.Open "select * from MachineRecords where CurrentStatus=False ". CN If rs.EOF = False cmbMachineNo.CancelUpdate End Sub Private Sub cmdExit_Click() Unload Me End Sub Project Report :: Cyber Café Management System .State = adStateOpen Then rs.RecordSource = "select * from machine_records" 'Data1.MoveNext Wend 'End If 'cmbMachineNo.Path & "\Cyber.Enabled = False '***************************** End Sub Private Sub cmdCancel_Click() '****************************** 'DAO Start '****************************** 'Data1.Text = cmbMachineNo.'****************************** If rs.List(0) End If cmdOk. CN rs.CancelUpdate '******************************* 'ADO Start '******************************* If rs.mdb" 'Data1.Refresh 'Data1.LockType = adLockOptimistic rs.AddItem rs("MachineNo") rs.CursorType = adOpenStatic rs.

Path & "\Cyber.rediffmail.AddItem rs("MachineNo") rs.Text = Format(Now.RecordSource = "select * from machine_records" 'Data1.Open "select * from MachineRecords where CurrentStatus=False order by MachineNo". CN If rs. SW_MAXIMIZE End Sub Private Sub Form_Load() '********************************************* 'DAO Start '********************************************* 'Data1.AddItem Data1.CursorLocation = adUseClient rs.CursorType = adOpenStatic rs.MoveNext 'Loop 'cmbMachineNo.State = adStateOpen Then rs1.Text = cmbMachineNo. "Open".Text = Time End Sub Public Sub loadTransaction() If rs1.Recordset.AddItem "Select a Machine No" 'Do While Not Data1.Text = Time '************************************************** 'ADO Start '************************************************** cmdOk.EOF = False cmbMachineNo.Close End If rs.Text = cmbMachineNo.com".Private Sub Command4_Click() ShellExecute 0.Enabled = False If rs. "http://www.RecordCount > 0 Then While rs.MoveNext Wend 'End If cmbMachineNo. 0.Recordset("machine_no") 'Data1.Text = Format(Now. "dd/mm/yyyy") 'txtStartTime. 0.DatabaseName = App.List(0) End If M1.State = adStateOpen Then rs.Close End If Project Report :: Cyber Café Management System .mdb" 'Data1. "dd/mm/yyyy") 'txtStartTime.EOF 'cmbMachineNo.Recordset.LockType = adLockOptimistic rs.Refresh 'cmbMachineNo.List(0) 'M1.

Text).CursorLocation = adUseClient rs1. "dd/mm/yyyy") rs1.rs1. CN rs1.Text) rs1("MachineNo") = cmbMachineNo.AddNew rs1("StartTime") = CDate(txtStartTime.Text rs1("Date") = Format(CVDate(M1.CursorType = adOpenStatic rs1.Open "select * from Tran".Update End Sub Project Report :: Cyber Café Management System .LockType = adLockOptimistic rs1.

Show End Sub Private Sub mnu_createNUser_Click() frmAddnewUser.11).Enabled = False 'mnu_changeUPassword.Enabled = False mnu_createNUser.Recordset Private Sub MDIForm_Load() SetMenus hwnd.Show End Sub Private Sub mnu_computerSetting_Click() frmpcsetting.Enabled = False End Sub Private Sub MDIForm_Unload(Cancel As Integer) Unload frmInitialization End Sub Private Sub mnu_about_Click() frmAbout. SmallImages 'mnu_int_admin.Enabled = False mnu_computerSetting. vbMinimizedFocus Exit Sub End Sub Private Sub mnu_changeUPassword_Click() frmChangePassword.Show End Sub Project Report :: Cyber Café Management System .Enabled = False mnu_rateOBilling.Show End Sub Private Sub mnu_calc_Click() On Error Resume Next Shell ("calc").Enabled = False mnu_deleteRecord.frm) :: 'Public cur_user As String 'Dim ST As Boolean 'Public cur_company_name As String 'Dim comp_saved As Boolean 'Public LOGOUT_CLICKED As Boolean Dim rs As New ADODB. MDI Form (MDIForm1.

Show End Sub Private Sub mnu_exit_Click() Unload Me End Sub Private Sub mnu_expense_Click() frmBilling.Show End Sub Private Sub mnu_income_Click() frmTransaction.Show End Sub Private Sub mnu_mine_Click() On Error Resume Next Shell "winmine". vbNormalFocus Exit Sub End Sub Private Sub mnu_notepad_Click() On Error Resume Next Shell ("notepad"). vbNormalFocus Exit Sub End Sub Private Sub mnu_rateOBilling_Click() frmRateSetting.Show End Sub Private Sub mnu_sol_Click() On Error Resume Next Project Report :: Cyber Café Management System .Show End Sub Private Sub mnu_log_out_Click() Unload MDIForm1 Unload frmInitialization frmInitialization.Private Sub mnu_deleteRecord_Click() frmDeleteUser. vbMaximizedFocus Exit Sub End Sub Private Sub mnu_osk_Click() On Error Resume Next Shell "osk".

3.Open "select * from Users".Close End If rs.51.CursorLocation = adUseClient rs.BooksInHand.Show End Sub Private Sub un_cr_report_Click() On Error GoTo last ' Dim db As Connection ' Set db = New Connection ' db.DataSource = rs rptTotalUSer.Tel.State = adStateOpen Then rs. CN Set rptTotalUSer." ' ''''''''''''''''''''''''''''''''''''''' ' Set adoprimaryrs = New Recordset 'rs.Show End Sub Private Sub mnucyber_Click() 'frmHelp.OLEDB.Data Source=" & M. adOpenStatic.CursorLocation = adUseClient ' db.Show Dte = InputBox("Enter The Date:MM/DD/YYYY") If Dte <> vbCancel Then If rs.State = adStateOpen Then rs.Open "select MemberId.LockType = adLockOptimistic rs. vbNormalFocus Exit Sub End Sub Private Sub mnu_we_Click() On Error Resume Next Shell ("explorer").Email. vbMaximizedFocus Exit Sub End Sub Private Sub mnuCalender_Click() frmCalender.DataSource = rs 'FineBalReport.Jet.Open "PROVIDER=Microsoft. adLockOptimistic 'Set FineBalReport.Address from Members where FineBal>0".CursorType = adOpenStatic rs.Close Project Report :: Cyber Café Management System .FileName & ". db.Shell "sol".Show End Sub Private Sub rp_menu_int_sales_Click() If rs.FineBal.

Action = 0 On Error GoTo last Mon = InputBox("Enter The Month") 'rptMounthlyReport If rs. CN If rs.CursorType = adOpenStatic rs.CursorType = adOpenStatic rs.rpt" 'CrystalReport1.State = adStateOpen Then rs.LockType = adLockOptimistic rs.Open "select * from Tran where Date=#" & Dte & "#".Show Else MsgBox "No Record Found" Exit Sub End If Exit Sub last: MsgBox "Your Supplied Criteria isn't Meaninig full" Project Report :: Cyber Café Management System .RecordCount > 0 Then Set rptDailyTotalReport.DataSource = rs rptMounthlyReport.LockType = adLockOptimistic rs.Path + "\PcStatus.CursorLocation = adUseClient rs.End If rs.ReportFileName = App.RecordCount > 0 Then Set rptMounthlyReport.Close End If rs.Open "select * from Tran where Month(Date)='" & Mon & "'".Show Else MsgBox "No Record Found" Exit Sub End If Exit Sub last: MsgBox "Your Supplied Criteria isn't Meaninig full" Exit Sub 'cancel: Else MsgBox "Operation Cancel" End If End Sub Private Sub un_pr_book_Click() 'CrystalReport1. CN If rs.CursorLocation = adUseClient rs.DataSource = rs rptDailyTotalReport.

Show Else MsgBox "No Record Found" Exit Sub End If Exit Sub End Sub Project Report :: Cyber Café Management System .Open "select * from Tran where Year(Date)='" & Yea & "' order by MachineNo". CN If rs.End Sub Private Sub un_sales_book_Click() 'On Error GoTo last: Yea = InputBox("Enter The Year:YYYY") If rs.LockType = adLockOptimistic rs.Close End If rs.CursorType = adOpenStatic rs.DataSource = rs rptYearlyReport.RecordCount > 0 Then Set rptYearlyReport.CursorLocation = adUseClient rs.State = adStateOpen Then rs.

ByVal lpOperation As String.Close Set CN = Nothing End Sub Public Sub counted() End Sub Project Report :: Cyber Café Management System .4.OLEDB.Persist Security Info=False.Jet OLEDB:Database Password=babu.bas) :: 'Public Declare Function ShellExecute Lib "shell32. ByVal lpDirectory As String. ByVal nShowCmd As Long) As Long Public sa Public ent As Boolean Public c As Integer 'count = 0 '******************************** 'This two variables are used for change password '************************ Public User As Boolean Public UserNa As Variant '***************************** Public ID As String Public CN As New ADODB.Open User = False End Sub Public Sub CloseConn() CN.Connection Public Sub AttendConn() CN. ByVal lpParameters As String.mdb.Path & "\CyberCafe.ConnectionString = "Provider=Microsoft.dll" Alias "ShellExecuteA" (ByVal hwnd As Long.0." CN. ByVal lpFile As String.Data Source= " & App.Jet. Module Connection (modconn.Decription of Modules And Their Code 1).

2). ByVal x1 As Long. _ ByVal dwLanguageID As Long. ByVal y As Long. ByVal Y1 As Long. ByVal ySrc As Long. dwMessageID As Long. ByVal nBkMode As Long) As Long Public Const NEWTRANSPARENT = 3 'use with SetBkMode() Private Declare Function CreatePen Lib "gdi32" _ (ByVal nPenStyle As Long. ByVal crColor As Long) As Long Private Declare Function MoveToEx Lib "gdi32" _ (ByVal hDC As Long. ByVal y As Long) As Long Public Declare Function GetTextColor Lib "gdi32" (ByVal hDC As Long) As Long Public Declare Function SetTextColor Lib "gdi32" (ByVal hDC As Long. ByVal fuFlags As Long) As Long Private Declare Function RealizePalette Lib "gdi32" (ByVal hDC As Long) As Long Private Declare Function CopyImage Lib "user32" (ByVal Handle As Long. _ ByVal xSrc As Long. ByVal x As Long. _ ByVal nWidth As Long. ByVal lFlags As Long) As Long Private Declare Function OleTranslateColor Lib "oleaut32. ByVal hSrcDC As Long. ByVal lpDrawStateProc As Long. ByVal nWidth As Long. Module Drawing (modDrawingXP. ByVal wParam As Long.bas) :: Option Explicit Private Declare Function GetLastError Lib "kernel32" () As Long Private Declare Function FormatMessage Lib "kernel32" Alias "FormatMessageA" ( _ ByVal dwFlags As Long. ByVal nSrcWidth As Long. ByVal nHeight As Long. lpBuffer As String. ByVal Y2 As Long) As Long Project Report :: Cyber Café Management System . ByVal crColor As Long) As Long Public Declare Function SetBkMode Lib "gdi32" (ByVal hDC As Long. ByVal x As Long. ByVal y As Long. ByVal cy As Long. ByVal lParam As Long. ByVal x As Long. ByVal bForceBackground As Long) As Long Public Declare Function GetPixel Lib "gdi32" (ByVal hDC As Long. ByVal cx As Long. _ ByVal nSize As Long. ByVal y As Long) As Long Private Declare Function Rectangle Lib "gdi32" _ (ByVal hDC As Long. ByVal y As Long. ByVal lHPalette As Long. Arguments As Long) As Long ' ===================================================================== ' APIs used primarily for drawing/graphics ' ===================================================================== Private Declare Function StretchBlt Lib "gdi32" ( _ ByVal hDC As Long. _ ByVal hPalette As Long. lColorRef As Long) As Long Private Declare Function SelectPalette Lib "gdi32" (ByVal hDC As Long. ByVal dwRop As Long) _ As Long Public Declare Function DrawState Lib "user32" Alias "DrawStateA" (ByVal hDC As Long. ByVal X2 As Long.dll" _ (ByVal lOleColor As Long. ByVal newWidth As Long. _ ByVal nSrcHeight As Long. ByVal ImageType As Long. lpSource As Any. ByVal hBR As Long. lpPoint As POINTAPI) As Long Private Declare Function LineTo Lib "gdi32" _ (ByVal hDC As Long. ByVal x As Long. _ ByVal NewHeight As Long. ByVal x As Long.

ByVal y As Long. ByVal xLeft As Long. ByVal cyWidth As Long. ByVal crColor As Long) As Long Public Declare Function GetBkColor Lib "gdi32" (ByVal hDC As Long) As Long Private Declare Function PatBlt Lib "gdi32" (ByVal hDC As Long. ByVal hbrFlickerFreeDraw As Long. ByVal hIcon As Long. lpBits As Any) As Long Private Declare Function SetBkColor Lib "gdi32" (ByVal hDC As Long. ByVal diFlags As Long) As Long Public Declare Function CreateSolidBrush Lib "gdi32" (ByVal crColor As Long) As Long Public Declare Function SelectObject Lib "gdi32" (ByVal hDC As Long. ByVal dwRop As Long) As Long Public Declare Function DrawText Lib "user32" Alias "DrawTextA" (ByVal hDC As Long. ByVal nWidth As Long. ByVal hObject As Long) As Long Public Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Integer Public Declare Function CreateFontIndirect Lib "gdi32" Alias "CreateFontIndirectA" (lpLogFont As LOGFONT) As Long Private Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA" (ByVal uAction As Long. ByVal hSrcDC As Long. ByVal yTop As Long. ByVal fuWinIni As Long) As Long Public Declare Function GetSysColor Lib "user32" (ByVal nIndex As Long) As Long Private Declare Function CreateCompatibleDC Lib "gdi32" (ByVal hDC As Long) As Long Private Declare Function DeleteDC Lib "gdi32" (ByVal hDC As Long) As Long Private Declare Function CreateCompatibleBitmap Lib "gdi32" _ (ByVal hDC As Long. ByVal uParam As Long. ByVal nWidth As Long. ByVal cxWidth As Long. ByVal nBitCount As Long. ByVal nHeight As Long. lpRect As RECT. ByVal y As Long. _ ByVal nHeight As Long. ByVal dwRop As Long) As Long Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long.' following public functions/types may not be used in these modules but are ' used in my CodeSafe program & are here for organizational reasons Public Declare Function DrawIconEx Lib "user32" (ByVal hDC As Long. _ ByVal ySrc As Long. ByVal nHeight As Long) As Long Private Declare Function CreateBitmap Lib "gdi32" (ByVal nWidth As Long. ByVal nCount As Long. ByVal wFormat As Long) As Long Public Const DT_CALCRECT = &H400 Public Const DT_LEFT = &H0 Public Const DT_SINGLELINE = &H20 Public Const DT_NOCLIP = &H100 Private Const DT_CENTER = &H1 ' Types used for fonts & images Public Type POINTAPI x As Long y As Long End Type Public Type LOGFONT lfHeight As Long Project Report :: Cyber Café Management System . ByVal lpStr As String. ByVal x As Long. ByVal xSrc As Long. ByVal istepIfAniCur As Long. ByVal nWidth As Long. ByVal nPlanes As Long. lpvParam As NONCLIENTMETRICS. _ ByVal x As Long. _ ByVal nHeight As Long.

lfWidth As Long lfEscapement As Long lfOrientation As Long lfWeight As Long lfItalic As Byte '0=false. 255=true lfUnderline As Byte '0=f. 255=t lfStrikeOut As Byte '0=f. 255=t lfCharSet As Byte lfOutPrecision As Byte lfClipPrecision As Byte lfQuality As Byte lfPitchAndFamily As Byte lfFaceName As String * 32 End Type Public Type RECT Left As Long Top As Long Right As Long Bottom As Long End Type Private Type TEXTMETRIC tmHeight As Long tmAscent As Long tmDescent As Long tmInternalLeading As Long tmExternalLeading As Long tmAveCharWidth As Long tmMaxCharWidth As Long tmWeight As Long tmOverhang As Long tmDigitizedAspectX As Long tmDigitizedAspectY As Long tmFirstChar As Byte tmLastChar As Byte tmDefaultChar As Byte tmBreakChar As Byte tmItalic As Byte tmUnderlined As Byte tmStruckOut As Byte tmPitchAndFamily As Byte tmCharSet As Byte End Type Private Type NONCLIENTMETRICS cbSize As Long iBorderWidth As Long iScrollWidth As Long Project Report :: Cyber Café Management System .

iScrollHeight As Long iCaptionWidth As Long iCaptionHeight As Long lfCaptionFont As LOGFONT iSMCaptionWidth As Long iSMCaptionHeight As Long lfSMCaptionFont As LOGFONT iMenuWidth As Long iMenuHeight As Long lfMenuFont As LOGFONT lfStatusFont As LOGFONT lfMessageFont As LOGFONT End Type ' Other constants used for graphics Private Const WHITENESS = &HFF0062 Private Const MAGICROP = &HB8074A Private Const DSna = &H220326 '0x00220326 'Color constants for GetSysColor Public Enum ColConst COLOR_ACTIVEBORDER = 10 COLOR_ACTIVECAPTION = 2 COLOR_ADJ_MAX = 100 COLOR_ADJ_MIN = -100 COLOR_APPWORKSPACE = 12 COLOR_BACKGROUND = 1 COLOR_BTNFACE = 15 COLOR_BTNHIGHLIGHT = 20 COLOR_BTNLIGHT = 22 COLOR_BTNSHADOW = 16 COLOR_BTNTEXT = 18 COLOR_CAPTIONTEXT = 9 COLOR_GRAYTEXT = 17 COLOR_HIGHLIGHT = 13 COLOR_HIGHLIGHTTEXT = 14 COLOR_INACTIVEBORDER = 11 COLOR_INACTIVECAPTION = 3 COLOR_INACTIVECAPTIONTEXT = 19 COLOR_MENU = 4 COLOR_MENUTEXT = 7 COLOR_SCROLLBAR = 0 COLOR_WINDOW = 5 COLOR_WINDOWFRAME = 6 COLOR_WINDOWTEXT = 8 End Enum ' local variables Private m_hDC As Long ' reference to DC being drawn in Project Report :: Cyber Café Management System .

tRect. nWidth.Right = tRect. iTab As Integer. Clr) End Function Public Sub DrawCaption(ByVal x As Long. tRect As RECT. hStr. x1 As Long ' set text color and set x. ByVal X2 As Long.iOffset . Clr x1 = tRect. _ Optional iOffset As Integer = 0) ' ===================================================================== ' Prints text to current DC in the coodinates & colors provided ' ===================================================================== If m_hDC = 0 Then Exit Sub 'Equivalent to setting a form's property FontTransparent = True SetBkMode m_hDC.Right Else tRect.y coordinates for printing OT = GetTextColor(m_hDC) SetTextColor m_hDC. ByVal y As Long. x1.Top = y tRect.Left + tRect.Right ' print the caption/text If bCenter Then DrawText m_hDC. ByVal Y1 As Long. Len(hStr). tRect. Len(hStr). _ ByVal hStr As String. hAccel As String.Bottom + y DrawText m_hDC. ByVal Clr As Long) As Long ' ===================================================================== ' Creates a colored pen for drawing ' ===================================================================== GetPen = CreatePen(0. X2.Bottom = tRect.tRect.Left = x + iOffset End If tRect. Y1.Left = (x1 . hStr.Right) \ 2 + iOffset tRect.Private m_Font(0 To 1) As Long ' local copy of menu font Private m_FontOld As Long ' font of DC prior to replacing with menu font Public Sub DrawRect(ByVal x1 As Long. _ ByVal Clr As Long. Y2) End Sub Public Function GetPen(ByVal nWidth As Long. ByVal Y2 As Long) ' ===================================================================== ' Simply draws a rectangle using the current DC's background color ' ===================================================================== If m_hDC = 0 Then Exit Sub Call Rectangle(m_hDC. DT_NOCLIP Or DT_CALCRECT Or DT_CALCRECT Or DT_SINGLELINE tRect. DT_SINGLELINE Or DT_NOCLIP Or DT_LEFT Project Report :: Cyber Café Management System . NEWTRANSPARENT Dim OT As Long. Optional bCenter As Boolean = False.

hAccel.2.Top = y DrawText m_hDC. DT_LEFT Or DT_NOCLIP Or DT_SINGLELINE End If 'Restore old text color SetTextColor m_hDC. CurPen) 'First . Y1 LineTo m_hDC.Left + iTab . tRect. GetSysColor(Choose(iOffset. dm LineTo m_hDC. x1 + 2.If Len(hAccel) Then ' here we will print an acceleraor key if needed tRect. _ Optional Sunken As Boolean = False) If m_hDC = 0 Then Exit Sub Dim CurPen As Long. COLOR_BTNHIGHLIGHT))) Else CurPen = GetPen(1. GetSysColor(Choose(iOffset. offset when set indicates erasing iOffset = Abs(CInt(bSelected)) + 1 If Sunken = False Then CurPen = GetPen(1. ByVal Y1 As Long. COLOR_MENU. Y1 SelectObject m_hDC. bSelected As Boolean. OldPen DeleteObject CurPen ' Next .Dark line If Sunken = False Then Project Report :: Cyber Café Management System . COLOR_BTNSHADOW))) End If OldPen = SelectObject(m_hDC.iOffset tRect. iOffset As Integer ' select colors. COLOR_MENU.Light Line MoveToEx m_hDC.Left = tRect. OldPen As Long Dim dm As POINTAPI. X2 . Y2. x1 + 2. Len(hAccel). _ ByVal X2 As Long. OT End Sub Public Property Let TargethDC(ByVal vNewValue As Long) ' ===================================================================== ' Maintain a local reference to the DC being drawn in ' simply prevents having to pass it to each call to a drawing routine ' ===================================================================== m_hDC = vNewValue End Property Public Sub ThreeDbox(ByVal x1 As Long. ByVal Y2 As Long.

lDrawType As Long. _ Optional IMGheight As Integer = 16. Optional IMGwidth As Integer = 16. lImageType As Long Const DSS_DISABLED = &H20 Const DSS_NORMAL = &H0 Const DSS_BITMAP = &H4 Const DSS_ICON = &H3 Const CI_BITMAP = &H0 Const CI_ICON = &H1 Dim rcImage As RECT If ImageType < 2 Then lDrawType = DSS_BITMAP lImageType = CI_BITMAP Else lDrawType = DSS_ICON lImageType = CI_ICON End If lImageSmall = CopyImage(lImageHdl. GetSysColor(Choose(iOffset. COLOR_MENU. Optional bInColor As Boolean = True. _ Optional bForceTransparency As Long = 0. ImageType As Long. lImageType. OldPen DeleteObject CurPen End Sub Public Sub DrawMenuIcon(lImageHdl As Long. x1 + 2. Optional lMask As Long = -1) ' ensure the requested image exists If lImageHdl = 0 Then Exit Sub Dim lImageSmall As Long.2. dm LineTo m_hDC. Optional iOffset As Integer = 0. CurPen) MoveToEx m_hDC. COLOR_MENU. COLOR_BTNSHADOW))) Else CurPen = GetPen(1. Y2 LineTo m_hDC. _ rt As RECT. _ Optional yOffset As Integer. X2 . bdisabled As Boolean.CurPen = GetPen(1. DSS_NORMAL) If lImageSmall = 0 Then ' failed to make a copy from the imagetype passed. try the other settings If lDrawType = DSS_BITMAP Then lDrawType = DSS_ICON lImageType = CI_ICON Else Project Report :: Cyber Café Management System .2. IMGwidth. COLOR_BTNHIGHLIGHT))) End If OldPen = SelectObject(m_hDC. GetSysColor(Choose(iOffset. IMGheight. Y1. X2 . Y2 ' Replace pen & delete temp pen SelectObject m_hDC.

.Top + yOffset. vbNull) End If ' // draw image into memory DC--fill BG white first ' // create memory dc Dim hOldBitmap As Long Dim hmemDC As Long hmemDC& = CreateCompatibleDC(m_hDC&) hOldBitmap = SelectObject(hmemDC&. IMGwidth. 0. lMask. IMGwidth. 0.Top + yOffset.Left + iOffset. 0. then straightforward extraction/drawing on coords If ((lImageType = CI_ICON And bForceTransparency < 2) Or bForceTransparency = 2) Then DrawState m_hDC. hbrHilite As Long Project Report :: Cyber Café Management System . I modified several lines of code so ' it is customized for CodeSafe & should it fail -. WHITENESS) If (lImageType = CI_ICON And bForceTransparency < 2) Or bForceTransparency = 2 Then DrawState hmemDC&. RGB(255. 0. . 0. lImageType. lDrawType Else MakeTransparentBitmap lImageSmall. DSS_NORMAL) End If If lImageSmall = 0 Then Exit Sub If bdisabled = False Then ' if not disabled. 0. 0. hmemDC End If DeleteObject lImageSmall ' // This seems to be required. 0. 1. 255. rt. lDrawType Else MakeTransparentBitmap lImageSmall. 1.lDrawType = DSS_BITMAP lImageType = CI_BITMAP End If lImageSmall = CopyImage(lImageHdl. IMGheight. IMGheight. IMGwidth. lImageSmall. rt. 0. ' To be fair to him. IMGheight. hBitmap&) Call PatBlt(hmemDC&.Left + iOffset. rt. rt.not his fault ' // create mono or color bitmap Dim hBitmap As Long If bInColor Then hBitmap& = CreateCompatibleBitmap(m_hDC&. IMGheight. IMGheight) Else hBitmap& = CreateBitmap(IMGwidth. . 0. IMGwidth. lMask End If DeleteObject lImageSmall Else ' ' This function is from Paul DiLascia's DrawEmbossed function ' which draws colored disabled pictures. 0. 0. 0. IMGheight. then shadow Dim hbrShadow As Long. . lImageSmall. IMGwidth. Dim hOldBackColor As Long hOldBackColor& = SetBkColor(m_hDC&. 0. 255)) ' // Draw using hilite offset by (1. 0.1). 0.

_ Optional destDC As Long = 0) Dim hdcSrc As Long Dim hbmMemSrcOld As Long Dim hdcMask As Long 'HDC of the created mask image Dim hdcColor As Long 'HDC of the created color image Dim hbmMask As Long 'Bitmap handle to the mask image Dim hbmColor As Long 'Bitmap handle to the color image Dim hbmColorOld As Long Dim hbmMaskOld As Long Dim hPalOld As Long Dim hdcScreen As Long Dim hdcScnBuffer As Long 'Buffer to do all work on Project Report :: Cyber Café Management System . _ Optional ByVal ySrc As Long = 0. _ Optional clrMask As OLE_COLOR = -1. rt. IMGheight. _ Optional xSrc As Long = 0. MAGICROP) Call SelectObject(m_hDC&. 0. _ ByVal Height As Long.Left + 1 + iOffset. IMGheight. 0.Top + 1 + yOffset.Top + yOffset.hbrShadow& = CreateSolidBrush(GetSysColor(COLOR_BTNSHADOW)) hbrHilite& = CreateSolidBrush(GetSysColor(COLOR_BTNHIGHLIGHT)) Dim hOldBrush As Long hOldBrush& = SelectObject(m_hDC&. hOldBitmap&) Call DeleteObject(hOldBrush&) Call DeleteObject(hbrHilite&) Call DeleteObject(hbrShadow&) Call DeleteObject(hOldBackColor&) Call DeleteObject(hOldBitmap&) Call DeleteObject(hBitmap&) Call DeleteDC(hmemDC&) End If End Sub Private Sub MakeTransparentBitmap(imgHdl As Long. hOldBrush&) Call SetBkColor(m_hDC&. hbrHilite&) Call BitBlt(m_hDC&. hmemDC&. hOldBackColor&) Call SelectObject(hmemDC&. rt. _ ByVal xDest As Long. MAGICROP) Call SelectObject(m_hDC&. IMGwidth. 0. _ ByVal yDest As Long. IMGwidth. hbrShadow&) Call BitBlt(m_hDC&. rt. 0. hmemDC&. rt. _ ByVal Width As Long.Left + iOffset.

hbmScnBuffer) hPalBufferOld = SelectPalette(hdcScnBuffer. True) RealizePalette hdcColor 'In case hdcSrc contains a monochrome bitmap. yDest. 0. lMaskColor 'Create a color bitmap to server as a copy of the destination 'Do all work on this bitmap and then copy it back over the 'destination when it's done. hPal. '(Specifically.Dim hbmScnBuffer As Long Dim hbmScnBufferOld As Long Dim hPalBufferOld As Long Dim lMaskColor As Long Const hPal As Long = 0 On Error Resume Next hdcScreen = GetDC(0&) If destDC = 0 Then destDC = m_hDC hdcSrc = CreateCompatibleDC(hdcScreen) hbmMemSrcOld = SelectObject(hdcSrc. 0. 1. because this will create a 'DIB section if the original bitmap is a DIB section) hbmColor = CreateCompatibleBitmap(hdcScreen. hbmColor) hPalOld = SelectPalette(hdcColor. Height. 0) OleTranslateColor clrMask. ByVal 0&) 'First. Height) 'Create DC for screen buffer hdcScnBuffer = CreateCompatibleDC(hdcScreen) hbmScnBufferOld = SelectObject(hdcScnBuffer. We do this 'first and then use it instead of the source bitmap 'because the source bitmap may be 'a DIB section. destDC. imgHdl) RealizePalette hdcSrc If clrMask < 0 Then clrMask = GetPixel(hdcSrc. 1. which behaves differently than a bitmap. we must set Project Report :: Cyber Café Management System . blt the source bitmap onto the cover. Height) 'Now create a monochrome bitmap for the mask hbmMask = CreateBitmap(Width. hbmScnBuffer = CreateCompatibleBitmap(hdcScreen. hdcColor = CreateCompatibleDC(hdcScreen) hbmColorOld = SelectObject(hdcColor. hPal. Height. Width. True) RealizePalette hdcScnBuffer 'Copy the destination to the screen buffer BitBlt hdcScnBuffer. vbSrcCopy 'Create a (color) bitmap for the cover (can't use 'CompatibleBitmap with hdcSrc. Width. Width. hPal. copying from a DIB section to a monochrome 'bitmap does a nearest-color selection rather than painting 'based on the backcolor and forecolor. 0. xDest.

'the destination foreground/background colors according to 'those currently set in hdcSrc (because Windows will 'associate these colors with the two monochrome colors) SetBkColor hdcColor, GetBkColor(hdcSrc) SetTextColor hdcColor, GetTextColor(hdcSrc) BitBlt hdcColor, 0, 0, Width, Height, hdcSrc, xSrc, ySrc, vbSrcCopy 'Paint the mask. What we want is white at the transparent 'color from the source, and black everywhere else. hdcMask = CreateCompatibleDC(hdcScreen) hbmMaskOld = SelectObject(hdcMask, hbmMask) 'When bitblt'ing from color to monochrome, Windows sets to 1 'all pixels that match the background color of the source DC. 'All other bits are set to 0. SetBkColor hdcColor, lMaskColor SetTextColor hdcColor, vbWhite BitBlt hdcMask, 0, 0, Width, Height, hdcColor, 0, 0, _ vbSrcCopy 'Paint the rest of the cover bitmap. 'What we want here is black at the transparent color, 'and the original colors everywhere else. To do this, 'we first paint the original onto the cover (which we 'already did), then we AND the inverse of the mask onto 'that using the DSna ternary raster operation '(0x00220326 - see Win32 SDK reference, Appendix, '"Raster Operation Codes", "Ternary 'Raster Operations", or search in MSDN for 00220326). 'DSna [reverse polish] means "(not SRC) and DEST". ' 'When bitblt'ing from monochrome to color, Windows 'transforms all white bits (1) to the background color 'of the destination hdc. All black (0) 'bits are transformed to the foreground color. SetTextColor hdcColor, vbBlack SetBkColor hdcColor, vbWhite BitBlt hdcColor, 0, 0, Width, Height, hdcMask, 0, 0, DSna 'Paint the Mask to the Screen buffer BitBlt hdcScnBuffer, 0, 0, Width, Height, hdcMask, 0, 0, vbSrcAnd 'Paint the Color to the Screen buffer BitBlt hdcScnBuffer, 0, 0, Width, Height, hdcColor, 0, 0, vbSrcPaint 'Copy the screen buffer to the screen BitBlt destDC, xDest, yDest, Width, Height, hdcScnBuffer, 0, 0, vbSrcCopy 'All done! DeleteObject SelectObject(hdcColor, hbmColorOld) SelectPalette hdcColor, hPalOld, True RealizePalette hdcColor

Project Report :: Cyber Café Management System

DeleteDC hdcColor DeleteObject SelectObject(hdcScnBuffer, hbmScnBufferOld) SelectPalette hdcScnBuffer, hPalBufferOld, True RealizePalette hdcScnBuffer DeleteDC hdcScnBuffer DeleteObject SelectObject(hdcMask, hbmMaskOld) DeleteDC hdcMask ReleaseDC 0&, hdcScreen SelectObject hdcSrc, hbmMemSrcOld RealizePalette hdcSrc DeleteDC hdcSrc ReleaseDC 0&, hdcScreen End Sub Public Sub SetMenuFont(bSet As Boolean, Optional hDC As Long, _ Optional bReduced As Boolean = False, Optional otherFont As Long = 0) ' reference the current DC for all drawing If hDC Then m_hDC = hDC If bSet Then ' in order to set the font, we must first determine what it is If m_Font(0) = 0 And otherFont = 0 Then Dim ncm As NONCLIENTMETRICS, newFont As LOGFONT ncm.cbSize = Len(ncm) ' this will return the system font info along with other stuff SystemParametersInfo 41, 0, ncm, 0 ' here we create a memory font based off of system menu font newFont = ncm.lfMenuFont m_Font(0) = CreateFontIndirect(newFont) ' now we are going to try to create a scalable font for ' separator bar text just in case the computer's menu font ' is not scalable. The following is a shortcut way of creating ' the font & I hope it works on all systems! newFont.lfFaceName = "Tahoma" & Chr$(0) newFont.lfCharSet = 1 newFont.lfHeight = (7.5 * -20) / Screen.TwipsPerPixelY 'newFont.lfHeight = newFont.lfHeight + 1 m_Font(1) = CreateFontIndirect(newFont) End If ' add the font to the DC & keep reference to old font ' Calling routines responsbile for restoring original font ' with call back to this routine & a FALSE parameter If m_FontOld = 0 And otherFont = 0 Then m_FontOld = SelectObject(m_hDC, m_Font(Abs(CInt(bReduced))))

Project Report :: Cyber Café Management System

Else If otherFont Then SelectObject m_hDC, otherFont Else SelectObject m_hDC, m_Font(Abs(CInt(bReduced))) End If End If Else ' Restoring old font If m_hDC = 0 Then Exit Sub SelectObject m_hDC, m_FontOld End If End Sub Public Sub DestroyMenuFont() ' ===================================================================== ' Simply destroy the memory font to free up resources ' ===================================================================== On Error Resume Next SelectObject m_hDC, m_FontOld DeleteObject m_Font(0) DeleteObject m_Font(1) m_Font(0) = 0 m_Font(1) = 0 End Sub Public Sub DoGradientBkg(lColor As Long, tRect As RECT, hwnd As Long) '======================================================================= '======================================================================= Dim sColor As String, i As Integer, tmpSB As PictureBox, formID As Long Dim R As Integer, B As Integer, G As Integer Dim lColorStep As Long, lNewColor As Long On Error GoTo GradientErrors ' we are going to create a picturebox to draw the gradient in ' tried drawing directly to hdc via MoveTo & LineTo APIs, but ' everytime, it failed -- maybe Win98, maybe my graphics card? ' This works though a little slower formID = GetFormHandle(hwnd) ' create the picture box in memory Set tmpSB = Forms(formID).Controls.Add("VB.PictureBox", "pic___tmp_s_b", Forms(formID)) With tmpSB ' set picturebox attributes .Visible = False

Project Report :: Cyber Café Management System

lColorStep R = (lNewColor And &HFF) . 0.1)-(tRect.Width = .Height = .Bottom.hDC.BorderStyle = 0 .1). i .Right. . . G.lColorStep ' ensure the Red..ScaleMode) . 0.ScaleY(tRect.DrawWidth = 1 .Bottom) * i ' modify the current color B = ((lNewColor \ &H10000) Mod &H100) .Right. B) ' cache the color & draw the line tmpSB. i . vbPixels.1 ' this line is used to subtract/add colors ' for a more dramatic fade. increment the #2 below lColorStep = (2 / tRect. . lNewColor. tRect.Bottom . tRect. vbPixels. BF Next ' now that the gradient has been drawn.Remove "pic___tmp_s_b" Set tmpSB = Nothing End Sub Project Report :: Cyber Café Management System .Right.Line (0.ScaleMode) . copy it to the menu panel BitBlt m_hDC.ScaleX(tRect.Bottom.ScaleMode = vbPixels lNewColor = lColor ' loop thru each line & color it For i = 1 To tRect.DrawMode = 13 . Blue values are in acceptable ranges If R < 0 Then R=0 ElseIf R > 255 Then R = 255 End If If G < 0 Then G=0 ElseIf G > 255 Then G = 255 End If If B < 0 Then B=0 ElseIf B > 255 Then B = 255 End If lNewColor = RGB(R. Green.lColorStep G = ((lNewColor \ &H100) Mod &H100) . 0.AutoRedraw = True . 0. vbSrcCopy End With GradientErrors: On Error Resume Next ' clean up Forms(formID).Controls.

4 + yOffset LineTo m_hDC. 6 + yOffset LineTo m_hDC.Top + 6 ' Here we are simply tracing the outline of a check box ' Created by opening a 8x8 bitmap editor and drawing a ' simple checkmark from left to right. 6 + xOffset. 5 + yOffset LineTo m_hDC. dm LineTo m_hDC. 2 + yOffset LineTo m_hDC. Y2 As Integer CurPen = GetPen(1. 3 + xOffset. lColor) OldPen = SelectObject(m_hDC. OldPen As Long Dim dm As POINTAPI Dim yOffset As Integer. 2 + xOffset. 4 + yOffset LineTo m_hDC. 2 + xOffset. OldPen DeleteObject CurPen End Sub Project Report :: Cyber Café Management System . 5 + xOffset. 4 + xOffset. 4 + xOffset. 5 + yOffset LineTo m_hDC.Public Sub DrawCheckMark(pRect As RECT. 1 + xOffset. 4 + yOffset. 6 + yOffset LineTo m_hDC. 0 + yOffset ' replace original pen SelectObject m_hDC. _ bdisabled As Boolean. 1 + yOffset LineTo m_hDC. Optional xtraOffset As Long = 0) Dim CurPen As Long. 4 + yOffset LineTo m_hDC. xOffset As Integer Dim x1 As Integer. 7 + xOffset. 7 + xOffset. 5 + xOffset. X2 As Integer Dim Y1 As Integer. 2 + yOffset LineTo m_hDC. 1 + yOffset LineTo m_hDC. lColor As Long. 3 + xOffset. CurPen) xOffset = 6 + xtraOffset yOffset = pRect. 6 + xOffset. bottom to top MoveToEx m_hDC.

Y coords of image/text within sidebar PanelIcon As Long ' does 1 or more menu items have an icon Status As Byte ' icon or bitmap.3) Menus (modMenus.bas) :: Option Explicit ' Types used to retrieve current menu item information Public Type MenuDataInformation ' information to store menu data ItemHeight As Integer ' submenu item height ItemWidth As Long ' pixel width of caption and hotkey Icon As Long ' icon index HotKeyPos As Integer ' instr position for hotkey Status As Byte ' 2=Separator. Font ID for text ID As Long End Type Private Type MENUITEMINFO cbSize As Long fMask As Long fType As Long fState As Long Project Report :: Cyber Café Management System . 0 for text Caption As String ' Text. unless image is used instead FColor As Long ' Sidebar text fore color BColor As Long ' Sidebar back color SBarIcon As Long ' icon/bitmap ID for sidebar. 4=ForceTransparency 8=ForceNoTransparency Caption As String ' Caption OriginalCaption As String ' used to check for updated menu captions Parent As Long ' submenu ID ID As Long ' menu item ID End Type Public Type PanelDataInformation Height As Long ' height of the menu panel Width As Long ' width of the menu panel HKeyPos As Long ' left edge for all hot keys SideBar As Long ' width of SideBar (default is 32) SideBarXY As Long ' X.

wID As Long hSubMenu As Long hbmpChecked As Long hbmpUnchecked As Long dwItemData As Long dwTypeData As Long 'String cch As Long End Type Private Type MEASUREITEMSTRUCT CtlType As Long CtlID As Long ItemId As Long ItemWidth As Long ItemHeight As Long ItemData As Long End Type Private Type DRAWITEMSTRUCT CtlType As Long CtlID As Long ItemId As Long itemAction As Long itemState As Long hwndItem As Long hDC As Long rcItem As RECT ItemData As Long End Type Private Type OSVERSIONINFO ' used to help identify operating system dwOSVersionInfoSize As Long dwMajorVersion As Long dwMinorVersion As Long dwBuildNumber As Long dwPlatformId As Long szCSDVersion As String * 128 End Type Private Type BITMAP bmType As Long bmWidth As Long bmHeight As Long bmWidthBytes As Long bmPlanes As Integer bmBitsPixel As Integer bmBits As Long End Type Private Type ICONINFO fIcon As Long Project Report :: Cyber Café Management System .

piconinfo As ICONINFO) As Long Private Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long.xHotSpot As Long yHotSpot As Long hbmMask As Long hbmColor As Long End Type ' APIs needed to retrieve menu information Private Declare Function WindowFromDC Lib "user32" (ByVal hDC As Long) As Long Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long. ByVal nPos As Long) As Long Private Declare Function GetMenuItemCount Lib "user32" (ByVal hMenu As Long) As Long Private Declare Function GetMenuItemID Lib "user32" (ByVal hMenu As Long. _ ByVal byPosition As Long. ByVal dwBytes As Long) As Long Private Declare Function GlobalFree Lib "kernel32" (ByVal hMem As Long) As Long ' Subclassing APIs & stuff Public Declare Function CallWindowProc Lib "user32" Alias _ "CallWindowProcA" (ByVal lpPrevWndFunc As Long. ByVal ByteLen As Long) Private Declare Function OffsetRect Lib "user32" (lpRect As RECT. ByVal bRevert As Long) As Long Private Declare Function GlobalAlloc Lib "kernel32" (ByVal wFlags As Long. ByVal wParam As Long. lpRect As RECT) As Long Private Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" (LpVersionInformation As OSVERSIONINFO) As Long Private Declare Function GetMenu Lib "user32" (ByVal hwnd As Long) As Long Private Declare Function GetSubMenu Lib "user32" (ByVal hMenu As Long. ByVal hDC As Long) As Long Public Declare Sub CopyMemory Lib "kernel32" Alias _ "RtlMoveMemory" (pDest As Any. ByVal y As Long) As Long Private Declare Function GetParent Lib "user32" (ByVal hwnd As Long) As Long Private Declare Function GetObject Lib "gdi32" Alias "GetObjectA" (ByVal hObject As Long. _ ByVal hwnd As Long. ByVal uItem As Long. ByVal nPos As Long) As Long Private Declare Function SetMenuItemInfo Lib "user32" Alias "SetMenuItemInfoA" (ByVal hMenu As Long. lpcMenuItemInfo As MENUITEMINFO) As Long Private Declare Function GetMenuItemInfo Lib "user32" Alias _ "GetMenuItemInfoA" (ByVal hMenu As Long. ByVal bool As Boolean. ByVal MSG As Long. _ ByVal lParam As Long) As Long Project Report :: Cyber Café Management System . ByVal nCount As Long. ByVal un As Long. lpObject As Any) As Long Private Declare Function GetIconInfo Lib "user32" (ByVal hIcon As Long. ByVal x As Long. lpMenuItemInfo As MENUITEMINFO) As Boolean Public Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long Public Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long. pSource As Any.

Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _ (ByVal hwnd As Long. ByVal iMode As Long) As Long Private Declare Function IsZoomed Lib "user32" (ByVal hwnd As Long) As Long ' Subclassing & Windows Message Constants Public Const GWL_WNDPROC = (-4) Private Const WM_DRAWITEM = &H2B Private Const WM_MEASUREITEM = &H2C Private Const WM_INITMENU = &H116 Private Const WM_INITMENUPOPUP = &H117 Private Const WM_ENTERIDLE = &H121 Private Const WM_MDICREATE = &H220 Private Const WM_MDIACTIVATE = &H222 Private Const WM_ENTERMENULOOP = &H211 Private Const WM_EXITMENULOOP = &H212 Private Const GMEM_FIXED = &H0 Private Const GMEM_ZEROINIT = &H40 Private Const GPTR = (GMEM_FIXED Or GMEM_ZEROINIT) ' Menu Constants Private Const MF_BYCOMMAND = &H0 Private Const MF_BYPOSITION = &H400 Private Const MF_OWNERDRAW = &H100 Private Const MF_SEPARATOR = &H800 Private Const MFT_SEPARATOR = MF_SEPARATOR Private Const ODS_SELECTED = &H1 Private Const ODT_MENU = 1 Private Const MIIM_TYPE = &H10 Private Const MIIM_DATA = &H20 Private Const MIIM_SUBMENU = &H4 Private MenuData As Collection ' Collection of clsMyMenu objects Private ActiveHwnd As String ' Index to focused form Private iTabOffset As Integer ' See DetermineOS function Private lSubMenu As Long Private lMDIchildClosed As Long Private VisibleMenus As Collection Public Sub SetMenus(Form_hWnd As Long. Optional MenuImageList As Control) If bAmDebugging Then Exit Sub ' here we set the collection index & see if it's already been subclassed Dim lMenus As Long. Looper As Integer On Error Resume Next Project Report :: Cyber Café Management System . ByVal nIndex As Long. _ ByVal dwNewLong As Long) As Long Private Declare Function SetGraphicsMode Lib "gdi32" (ByVal hDC As Long.

Add NewMenuData. do nothing! Exit Sub End If Err.ParentForm = Form_hWnd End With ' Add the class to the class collection & remove the instance of the new class MenuData.MainMenuID. Looper) Next SetFreeWindow True ' hook the window so we can intercept windows messages End Sub Public Sub ReleaseMenus(hwnd As Long) ' Sub prepares for Forms unloading ' This must be placed in the forms Unload event in order to ' release memory & prevent crash of program If MenuData Is Nothing Then Exit Sub On Error GoTo ByPassRelease ActiveHwnd = CStr(hwnd) ' set current index SetFreeWindow False ' unhook the window On Error Resume Next If MenuData(ActiveHwnd).MainMenuID) For Looper = 0 To lMenus .SetImageViewer MenuImageList .ChildStatus = 1 Then lMDIchildClosed = MenuData(ActiveHwnd).MainMenuID = GetMenu(Form_hWnd) ' used to redirect MDI children to parent for submenu info (see MsgProc:MDIactivate) .If GetFormHandle(Form_hWnd) = -1 Then Exit Sub lMenus = MenuData(CStr(Form_hWnd)).Count = 0 Then Project Report :: Cyber Café Management System .MainMenuID If Err Then ' then new form to subclass ' Initialize a collection of classes if needed If MenuData Is Nothing Then Set MenuData = New Collection Dim NewMenuData As New clsMyMenu ' save the ImageList & Handle to the form's menu With NewMenuData .Clear ActiveHwnd = CStr(Form_hWnd) ' set collection index to current form CleanMDIchildMenus lMenus = GetMenuItemCount(MenuData(ActiveHwnd).Remove ActiveHwnd If MenuData. CStr(Form_hWnd) Set NewMenuData = Nothing Else ' form is already subclassed.1 'GetMenuMetrics GetSubMenu(MenuData(ActiveHwnd).ParentForm End If ' remove references to that form's class & ultimately unload the class MenuData.

fMask = &H1 Or &H2 mII.Print "entering loop" ' When a menu is activated.Print "MDI child created" ' MDI children get their menus subclassed to the parent by Windows ' We set the class's parentform value to the MDI's parent & when ' submenus are processed.GetPanelID(Looper) If GetMenuItemCount(mMenu) < 0 Then . enabled status.PurgeObsoleteMenus mMenu Next End With lMDIchildClosed = 0 End Sub Public Function MsgProc(ByVal hwnd As Long. mMenu As Long.fType = 0 On Error Resume Next With MenuData(CStr(lMDIchildClosed)) For Looper = . ' this will prevent unnecessary reads each time the submenu is displayed Set VisibleMenus = New Collection Case WM_MDIACTIVATE 'Debug.cbSize = Len(mII) mII. _ ByVal wParam As Long. no changes can be made to the captions.PanelIDcount To 1 Step -1 mMenu = . etc ' So we will save each submenu as it is opened and read the info only once.Raise 5 ActiveHwnd = CStr(hwnd) ' ensure index to current form is set Select Case wMsg Case WM_ENTERMENULOOP 'Debug. we send anything thru unless we are measuring ' or drawing an item. mII As MENUITEMINFO mII. On Error GoTo SendMessageAsIs ' the following is a tell-tale sign of a system menu If lParam = &H10000 Then Err.TargethDC = 0 ' get rid of refrence in that module End If ByPassRelease: End Sub Private Sub CleanMDIchildMenus() ' reset parent's menu items (see that routine for remarks) If lMDIchildClosed = 0 Then Exit Sub Dim Looper As Long.' here we clean up a little when all subclassed forms have been unloaded Set MenuData = Nothing ' erase the collection of classes which will unload the class DestroyMenuFont ' get rid of memory font modDrawing. relayed or ' skipped. ByVal wMsg As Long. they are redirected to the parent Project Report :: Cyber Café Management System . ByVal lParam As Long) As Long ' Here we determine which messages will be processed. Basically.

False). When the child is maximized its system menu ' shows up on the parent form & needs to be compared so the class ' doesn't draw for the system menu which it can't do! MenuData(ActiveHwnd). Send flag to redraw menu if needed ' If we drew it.Print "Popup ends" ' occurs after the entire menu has been measured & displayed ' at least once. 0.ParentForm = GetParent(GetParent(hwnd)) MenuData(CStr(MenuData(ActiveHwnd). 0 End Select SendMessageAsIs: MsgProc = CallWindowProc(MenuData(ActiveHwnd). WM_INITMENU If wParam = 0 Then Err.Raise 5 ' ignore these messages & pass them thru 'Debug. don't let windows measure it again If CustomDrawMenu(wMsg.OldWinProc. wParam) = True Then Exit Function Case WM_INITMENUPOPUP '. wMsg is the handle ' Send flag to drawing routine to allow icons to be redrawn CustomDrawMenu wMsg. True MenuData(ActiveHwnd). wParam) = True Then Exit Function Case WM_EXITMENULOOP 'Debug.ParentForm)). we remove the collection of submenus ' so they can be redrawn again as needed Set VisibleMenus = Nothing Case WM_ENTERIDLE 'Debug.GetSetMDIchildSysMenu GetSystemMenu(hwnd. don't let windows redraw it If CustomDrawMenu(wMsg. lParam. lParam) End Function Public Function GetMenuIconID(Menu_Caption As String) As Long Project Report :: Cyber Café Management System . hwnd. 0. lParam. wMsg. just about every time the mouse moves ' over the menu.ChildStatus = 1 Case WM_MEASUREITEM 'Debug. Send flag to not redraw icons CustomDrawMenu wMsg. wParam.Print "exiting loop" ' When a menu is clicked on or closed.Print "Popup starts" ' Occurs each time a menu is about to be displayed.Print "measuring" ' occurs after menu initialized & before drawing takes place ' send to drawing routine to measure the height/width of the menu panel ' If we measured it. 0 GetMenuMetrics wParam ' get measurements for menu items ' allow message to pass to the destintation Case WM_DRAWITEM 'Debug.Print "drawing" ' sent numerous times.' The ChildStatus is set to clean out the parent's class when the ' child window is closed ' The GetSetMDIchildSysMenu command is run to store the system menu ' with the parent form.

sysMenuLoc As Long Dim mII As MENUITEMINFO. lmnuID As Long. bRecalcSideBar As Long Dim iSeparator As Integer. iTransparency As Integer Dim bSetHotKeyOffset As Boolean. bSpecialSeparator As Boolean On Error Resume Next If MenuData(ActiveHwnd). ":") + 1)) End If Exit Function NoIcon: GetMenuIconID = 0 End Function Private Sub GetMenuMetrics(hSubMenu As Long) ' Routine gets the meaurements of the submenus & their submenus. ' their checked status. "{IMG:") If i Then GetMenuIconID = Val(Mid$(Menu_Caption.GetSetMDIchildSysMenu(hSubMenu. meDC As Long. enabled status. bTabOffset As Boolean Dim IconID As Integer. lMetrics(0 To 10) As Long Dim sCaption As String.TargethDC = meDC DetermineOS Project Report :: Cyber Café Management System . False) = True Then Exit Sub If Not VisibleMenus Is Nothing Then ' here we track which submenus are currently visible so we don't ' re-process data which isn't needed until after the submenu is closed lMenus = VisibleMenus(CStr(hSubMenu)) If lMenus Then Exit Sub End If On Error GoTo 0 meDC = GetDC(CLng(ActiveHwnd)) hWndRedirect = MenuData(ActiveHwnd).' Returns the icon assigned in the menu caption as a long value ' Example: {IMG:9}&Open would return 9 ' Note: Not used in any modules here.ParentForm ' Get the ID for the next submenu item lMenus = GetMenuItemCount(hSubMenu) lSubMenu = hSubMenu modDrawing. InStr(Menu_Caption. ' control keys. sBarCaption As String Dim sHotKey As String. but provided for programmer use ' if needed in their applications Dim i As Integer On Error GoTo NoIcon i = InStr(Menu_Caption. mI() As Byte Dim tRect As RECT. hWndRedirect As String Dim Looper As Long. icon index. etc Dim lMenus As Long. bNewItem As Boolean Dim bHasIcon As Boolean.

True. False. " Caption: ". ' we bypass the VB crash that happens on Win98 & XP & probably others ReDim mI(0 To 255) mII. sCaption Else bNewItem = True If Len(sBarCaption) > 0 And bRecalcSideBar = 0 Then bRecalcSideBar = lmnuID .fMask = &H10 Or &H1 Or &H2 mII. "has submenus".With MenuData(hWndRedirect) ' class for this form For Looper = 0 To lMenus .1 ' loop thru each subitem ' get the submenu item bSpecialSeparator = False iSeparator = 0: iTransparency = 0 sHotKey = "" ' now set some flags & stuff to return the caption. it automatically ' increases the menu panel width. let's get some measurements ' first extract the caption. mII. mII 'Debug. Chr$(0).OriginalCaption = sCaption . controlkeys & icon If InStr(sCaption.Icon <> 0 Then bHasIcon = True If InStr(sCaption.dwTypeData = VarPtr(mI(0)) mII.wID bNewItem = . Chr$(9)) Then bTabOffset = True ' when Win98 encounters a hotkey above.fType = 0 mII. "")) = 0 Then sCaption = . hSubMenu.Status = 0 ' new item or change in caption. lmnuID.cbSize = Len(mII) mII.cch = UBound(mI) ' get the submenu item information GetMenuItemInfo hSubMenu. True) sCaption = Left$(StrConv(mI.Print "reading existing " & Looper + 1. hSubMenu.SetMenuID(lmnuID.ItemWidth If LoWord(lMetrics(10)) > lMetrics(0) Then lMetrics(0) = LoWord(lMetrics(10)) If HiWord(lMetrics(10)) > lMetrics(9) Then lMetrics(9) = HiWord(lMetrics(10)) lMetrics(4) = .wID = -1 Then Exit Sub lmnuID = mII. Chr$(9)) Then bTabOffset = True 'Debug.SideBarWidth If . sCaption If .wID) = 4096 Or mII.hSubMenu If Abs(mII.cch) If Len(Replace$(sCaption.Print lmnuID. Looper.ItemHeight lMetrics(10) = . mII.OriginalCaption = sCaption And bNewItem = False Then ' here we can get cached info vs reprocessing it again lMetrics(1) = lMetrics(1) + .Print hWndRedirect. vbUnicode).OriginalCaption If Left(UCase(sCaption). 9) = "{SIDEBAR:" Then sBarCaption = sCaption 'Debug. checked & enabled status ' by referencing the dwTypeData as a byte array vs long or string. We need to note that ' so we can decrease the panel widh appropriately and Project Report :: Cyber Café Management System .

Print "iconid=". bSpecialSeparator ' add smaller menu font ' measure the caption width to help identify how wide ' the menu panel should be (greatest width of all submenu items) DrawText meDC.Status Or iTransparency * 4 . tRect.ItemWidth = 0 .Bottom = 10 tRect.Status = .Right If iSeparator = 0 Or bSpecialSeparator = True Then ' set min height text menu items to match 16x16 icon height If tRect.Icon = 0 Else 'Debug. . IconID Debug.Bottom = tRect. sCaption FindImageAndHotKey hWndRedirect. iTransparency.Caption = Trim$(sCaption & " " & sHotKey) .Bottom + 6 Else tRect. 2) & " " & sHotKey bSpecialSeparator = True sHotKey = "" ' not used for separators End If ' start saving the information .Icon = IconID .ItemHeight = 0 . this will be used to ' left align control keys for the entire panel If tRect. This helps prevent extra ' wide menu panels If Left(UCase(sCaption).fType And MF_SEPARATOR) = MF_SEPARATOR) If iSeparator Then IconID = 0 ' no pictures on separator bars! If Len(sCaption) > 0 And iSeparator = 1 Then ' separator bar with text ' calculate entire caption & set a few flags sCaption = Mid$(sCaption.Status = .Status Or iSeparator * 2 If IconID Then bHasIcon = True SetMenuFont True.Status = .Bottom < 10 And bSpecialSeparator = False Then tRect.Right lMetrics(10) = tRect.Print "Caption ". sHotKey. 1) = "-")) If iSeparator = 0 Then iSeparator = Abs(CInt(mII. 9) = "{SIDEBAR:" Then iSeparator = 1 .Right > lMetrics(0) Then lMetrics(0) = tRect. IconID ' identify whether or not this is a separator iSeparator = Abs(CInt(Len(sCaption) = 0 Or Left$(sCaption. sCaption. DT_CALCRECT Or DT_LEFT Or DT_SINGLELINE Or DT_NOCLIP ' keep track of the largest width. Len(sCaption).' offset the automatic increase.Bottom = 5 ' make default separators 0 height End If Project Report :: Cyber Café Management System . sCaption.Status Or 16 .

fType = MF_SEPARATOR Or iSeparator = 1 Then mII. Trim(sHotKey).PanelHeight <> lMetrics(1) And .fMask = mII. False. Add 12 pixels for ' buffer between end of caption & beginning of control key If tRect. 0) End If End If End If ' we ensure the item is drawn by us ' force a separator status if appropriate mII.fType Or MF_OWNERDRAW End If mII.SideBarItem <> 0 Then bRecalcSideBar = lmnuID End If lMetrics(3) = 5 + Abs(CInt(bHasIcon)) * 18 lMetrics(2) = lMetrics(0) + 12 lMetrics(0) = lMetrics(2) + lMetrics(9) + lMetrics(3) + lMetrics(4) + CInt(bTabOffset) * iTabOffset If bRecalcSideBar Then . DT_CALCRECT Or DT_LEFT Or DT_NOCLIP Or DT_SINGLELINE ' keep track of the widest control key text ' this is used w/widest caption to determine overall ' panel width including icons & checkmarks. lMetrics().' store the height of the caption text .Bottom SetMenuFont False If Len(sHotKey) Then . CInt(tRect.fType = mII. True. False ReturnSideBarInfo hWndRedirect. sBarCaption.HotKeyPos = Len(sCaption) + 1 ' now do the same for the hotkey DrawText meDC.ItemWidth = MakeLong(CInt(lMetrics(10)). Looper.fMask = 0 If mII.Right > lMetrics(9) Then lMetrics(9) = tRect.ItemWidth = MakeLong(CInt(lMetrics(10)). hSubMenu.fType = MF_SEPARATOR Or MF_OWNERDRAW Else ' otherwise it's normal mII. Len(Trim(sHotKey)). tRect.Bottom lMetrics(1) = lMetrics(1) + tRect.fMask Or MIIM_TYPE Or MIIM_DATA ' reset mask ' save updates to allow us to draw the menu item SetMenuItemInfo hSubMenu. then check the overall panel height ' if it changed. mII Next If Looper > 0 Then ' menu items processed If bRecalcSideBar = 0 Then ' sidebar menu id ' if no sidebar was processed.ItemHeight = tRect. meDC Project Report :: Cyber Café Management System .Right)) Else .Right .SetMenuID bRecalcSideBar. we need to reprocess the sidebar again since ' the graphics & text are centered in the panel If .

Print "icon count=". imgTransparency As Integer. i)) sKey = Mid$(sKey. menu builder supplied control key sAccel = Trim$(Mid$(sKey.Add 1. sBarCaption. (bRecalcSideBar = 0) End If End With If Not VisibleMenus Is Nothing Then VisibleMenus. then reset it to zero Debug. sKey As String. i . "|Y}") Then imgTransparency = 1 If InStr(sHeader. sSpecial As String. "}") If i Then sHeader = UCase(Left$(sKey. meDC ReleaseDC CLng(ActiveHwnd). 6)) ' if the value<1 or >nr of images.1)) Project Report :: Cyber Café Management System . i + 1)) sKey = Trim$(Left$(sKey. sAccel As String. MenuData(hWndRedirect). "|N}") Then imgTransparency = 2 End If End If End If ' Parse the Caption & the Control Key sAccel = "" ' First let's see if it's a menu builder supplied control key ' if so.TotalIcons Then imgIndex = 0 Else ' optional transparency flag ' Y=always use transparency ' N=never user transparency ' default: Icons never use transparency.TotalIcons If imgIndex < 1 Or imgIndex > MenuData(hWndRedirect). meDC Erase lMetrics Erase mI End Sub Private Sub FindImageAndHotKey(hWndRedirect As String. Bitmaps always If InStr(sHeader. it's easy to identify 'cause it is preceeded by a vbTab i = InStr(sKey. Chr$(9)) If i Then ' yep.UpdatePanelID lMetrics(). 5) = "{IMG:" Then i = InStr(sKey. imgIndex As Integer) On Error Resume Next Dim i As Integer. i + 1) ' extract the image index imgIndex = Val(Mid$(sHeader. sHeader As String imgIndex = 0 imgTransparency = 0 If Left$(UCase(sKey).End If . (CStr(hSubMenu)) ' now we replace the default font & release the form's DC SetMenuFont False.

a little more difficult to find For i = 1 To 3 ' look for Ctrl. lFontM As LOGFONT. " HOME". "SHIFT+". picInfo As ICONINFO Dim TempBMP As Long. " END". InStr(UCase(sKey). "CTRL+". InStrRev(UCase(sKey).1)) Exit For End If Next End If End Sub Private Sub ReturnSideBarInfo(hWndRedirect As String. "F" & i))) sKey = Trim$(Left$(sKey. "SHIFT+". InStrRev(UCase(sKey). Len("F" & i)) = "F" & i Then ' if found. sBarInfo As String. 1) = "}" Then sBarInfo = Left$(sBarInfo. "ALT+")) Then ' if found. Len(sSpecial)) = sSpecial Then sAccel = Trim$(Mid$(sKey. UCase(sAccel)) . Alt & Shift combinations 1st If InStr(UCase(sKey). "SHIFT+". InStr(UCase(sKey). ImageDC As Long. sSpecial))) sKey = Trim$(Left$(sKey. sText As String Dim bMetrics As Boolean. InStrRev(UCase(sKey). " INS". sbarType As Integer ' here we are just adding a delimeter at end of string to make parsing easier If Right$(sBarInfo. "ALT+")) . sSpecial) .1)) Exit Sub End If Next For i = 1 To 15 ' look for F keys next If Right$(UCase(sKey). it will be preceded by a space and must ' be at end of caption. Choose(i. "CTRL+".1)) Exit Sub End If Next ' here we look for other types of hot keys. vBarInfo() As Long. Choose(i. " DEL". " PGDN") If Right$(UCase(sKey). InStrRev(UCase(sKey). then exit routine sAccel = Trim$(Mid$(sKey. then exit routine sAccel = Trim$(Mid$(sKey. " PGUP". "CTRL+". these can be customized ' as needed by following the logic below For i = 1 To 6 ' hot key looking for. sImgID As String Dim lRatio As Single. Len(sBarInfo) . Choose(i. "ALT+")))) sKey = Trim$(Left$(sKey. sTmp As String Dim lFont As Long. otherwise we ignore it sSpecial = Choose(i. tDC As Long) Dim i As Integer.1) sBarInfo = sBarInfo & "|" Project Report :: Cyber Café Management System .Else ' user supplied control key. hPrevFont As Long Dim tRect As RECT Dim imgInfo As BITMAP.

InStr(UCase(sBarInfo). "|WIDTH:") Then ' width of the sidebar (user-provided) ' undocumented! this allows the sidebar width to be modified vBarInfo(4) = Val(Mid$(sBarInfo. "|CAPTION:") + 9) i = InStr(sText. "|") sTmp = Left$(sTmp. if any DeleteObject MenuData(hWndRedirect). i . i . 32 pixels wide seems to look the best vBarInfo(4) = 32 ' default width of sidebars End If If IsNumeric(sImgID) Then ' user is providing image handle vs a form picture object vBarInfo(10) = Val(sImgID) ' ref to picture if it exists sbarType = 2 ' status: image sidebar vBarInfo(9) = 8 ' type default as bmp Else If sImgID = "TEXT" Then sbarType = 4 ' status: text sidebar vBarInfo(9) = 0 If InStr(UCase(sBarInfo).wasted memory If MenuData(hWndRedirect). Making width too small or too large ' may prevent menu from displaying or crash on memory ' suggest using between 32 & 64 If InStr(UCase(sBarInfo).1) End If sBarInfo = UCase(sBarInfo) ' make it easier to parse If InStr(sBarInfo. InStr(sBarInfo. ":") + 1) ' return the type of sidebar Image or Text i = InStr(sBarInfo.SideBarItem End If vBarInfo(10) = 0 ' reset to force no sidebar ' use with caution. "{SIDEBAR:") sBarInfo = Mid$(sBarInfo. "|CAPTION:") Then sText = Mid$(sBarInfo. "|") sText = Left$(sText. InStr(UCase(sBarInfo).SideBarItem <> 0 Then ' kill the previous font for this item. "|WIDTH:") + 7)) Else ' however.1) Else sTmp = "Arial" ' default if not provided Project Report :: Cyber Café Management System . "|FONT:") Then ' parse out the font sTmp = Mid$(sBarInfo.' stripoff the SIDEBAR header i = InStr(UCase(sBarInfo).SideBarIsText = True And MenuData(hWndRedirect).1) On Error Resume Next ' can't leave memory fonts running around loose -. "|") ' if the next line <> TEXT then we have an image handle or image control sImgID = Left$(sBarInfo. "|FONT:") + 6) i = InStr(sTmp. i . InStr(sBarInfo.

InStr(sBarInfo.lfHeight = (i * -20) / Screen. "|FSIZE:") Then i = Val(Mid$(sBarInfo. "|FSIZE:") + 7)) If i < 4 Then i = 12 ' min & max fonts If i > 24 Then i = 24 Else i = 12 ' default font size End If Do ' here we are going to create fonts to see if it will ' fit in the sidebar.Right > vBarInfo(1) Or tRect.lfFaceName = sTmp & Chr$(0) If InStr(sBarInfo.lfCharSet = 0 ' scalable only lFontM.per MSDN drawtext won't measure rotated fonts lFont = CreateFontIndirect(lFontM) ' create the font without rotation hPrevFont = SelectObject(tDC.lfEscapement = 900 lFont = CreateFontIndirect(lFontM) ' create the font vBarInfo(10) = lFont ' save it vBarInfo(8) = tRect. "|BOLD") Then sTmp = sTmp & " Bold" If InStr(sBarInfo. "|UNDERLINE") Then lFontM. DT_CALCRECT Or DT_LEFT Or DT_SINGLELINE Or DT_NOCLIP Or &H800 ' regardless we delete the font. hPrevFont DeleteObject lFont If tRect. tRect. now we rotate it & save it lFontM. then make it so If InStr(sBarInfo.Right ' measurements vBarInfo(5) = tRect. sText.lfFaceName = sTmp ' if user wants other font attributes.Bottom Exit Do End If Loop Else Project Report :: Cyber Café Management System . lFont) ' load it into the DC ' see if it will fit in the sidebar DrawText tDC.Bottom > vBarInfo(4) Then ' font is too big. reduce it by 1 and try again i=i-1 If i < 4 Then Exit Do Else ' font is ok.End If lFontM. "|ITALIC") Then sTmp = sTmp & " Italic" lFontM. cause we'll need to rotate it SelectObject tDC.TwipsPerPixelY ' can't rotate the font before measuring it . unfortunately we need to do this ' each time the menubar is initially displayed or resized because ' the sidebar height may have changed with adding/removing ' or making menu items invisible lFontM. Len(sText).lfUnderline = 1 ' if user wants a different fontsize then make it so If InStr(sBarInfo.

Controls(sTmp). i + 1)) If bIsMDI Then If Forms(formID).Controls(sImgID) End If End If ' cache the picture handle & type vBarInfo(10) = vControl.Controls(sImgID) End If Else Set vControl = Forms(formID).Item(i) End If Else If bIsMDI Then If Forms(formID). we reference it this way Set vControl = Forms(formID).Print "Sidebar failed" vBarInfo(4) = 0 Exit Sub Project Report :: Cyber Café Management System . we reference it this way Set vControl = Forms(formID).Handle If vControl.' here we have an image/picturebox control containing an image ' we need to extract the image handle Dim formID As Long. "(") sTmp = Left$(sImgID.Item(i) Else ' when control is in an MDIs active form.ActiveForm Is Nothing Then Set vControl = Forms(formID).1) i = Val(Mid$(sImgID. bIsMDI) If formID > -1 Then sbarType = 2 'status: image sidebar ' let's see if the control passed is indexed If Right$(sImgID.Item(i) End If Else Set vControl = Forms(formID).Picture.Controls(sImgID) Else ' when control is in an MDIs active form. vControl As Control.Controls(sTmp).Type = 3 Then vBarInfo(9) = 16 Else vBarInfo(9) = 8 Set vControl = Nothing End If End If End If If vBarInfo(10) = 0 Then 'failed retrieving sidebar information Debug.Picture. i . 1) = ")" Then ' indexed image i = InStrRev(sImgID. bIsMDI As Boolean ' loop thru each open form to determine which is the active formID = GetFormHandle(CLng(hWndRedirect).ActiveForm.Controls(sTmp).ActiveForm.ActiveForm Is Nothing Then Set vControl = Forms(formID).

this way we don't have ' to remeasure when the menu is being displayed. CInt(vBarInfo(8))) ' save the left & top offsets for the image. let's get the rest of the attributes If InStr(sBarInfo. InStr(sBarInfo.vBarInfo(8)) \ 2) Else ' if user want's gradient background for text sidebar then If InStr(sBarInfo. 4) Case "NONE": vBarInfo(6) = -1 Case "BACK": ' short for background ' if a text sidebar & background was provided we change to default If sbarType = 2 Then vBarInfo(6) = -2 Else vBarInfo(6) = -1 Case Else ' numeric background color -. "|FCOLOR:") + 8)) If vBarInfo(7) < 0 Then vBarInfo(7) = 0 Else Project Report :: Cyber Café Management System . "|BCOLOR:") + 8)) End Select Else vBarInfo(6) = -1 ' default: use the menubar background color End If If vBarInfo(6) = -1 Then vBarInfo(6) = GetSysColor(COLOR_MENU) If vBarInfo(10) Then If sbarType = 2 Then ' now if an image sidebar. top offset & new image width. height If vBarInfo(5) > vBarInfo(4) Or vBarInfo(8) > vBarInfo(1) Then ' image is larger than menu panel If vBarInfo(5) / vBarInfo(4) > vBarInfo(8) / vBarInfo(1) Then lRatio = vBarInfo(4) / vBarInfo(5) Else lRatio = vBarInfo(1) / vBarInfo(8) End If vBarInfo(5) = CInt(vBarInfo(5) * lRatio) vBarInfo(8) = CInt(vBarInfo(8) * lRatio) End If vBarInfo(7) = MakeLong(CInt(vBarInfo(5)). "|FCOLOR:") Then vBarInfo(7) = Val(Mid$(sBarInfo. "|BCOLOR:") + 8). InStr(sBarInfo.use it vBarInfo(6) = Val(Mid$(sBarInfo. vBarInfo(5) = MakeLong((vBarInfo(4) . let's get the forecolor of the text & black is default If InStr(sBarInfo.vBarInfo(5)) \ 2. we call subroutine for more attributes GoSub DrawPicture ' let's get the size of the image vs the size of the menu panel & ' either center or shrink the image to fit ' we will return the left offset.End If sBarInfo = UCase(sBarInfo) ' make it easier to parse 'ok. (vBarInfo(1) . InStr(sBarInfo. "|BCOLOR:") Then ' Background color for the sidebar Select Case Left$(Mid$(sBarInfo. "|GRADIENT") > 0 And sbarType = 4 Then vBarInfo(9) = vBarInfo(9) Or 32 ' text sidebar.

' 1.yHotSpot Else vBarInfo(9) = 8 vBarInfo(5) = imgInfo. 0. Image passed is a control to get height/width values 'Get the info about our image If GetObject(vBarInfo(10).yHotSpot = 0 Then 'if the image passed was a handle vs control and not a bitmap ' sidebar fails Debug.Print "Sidebar failed image is not a bitmap or icon type" vBarInfo(10) = 0 vBarInfo(4) = 0 Return End If vBarInfo(9) = 16 vBarInfo(5) = picInfo. 0. try again with differnt picture type Project Report :: Cyber Café Management System .PictureBox".AutoRedraw = True If vBarInfo(6) = -2 Then If vBarInfo(9) = 8 Then i = 4 Else i = 3 ' draw the image to the picturebox If DrawState(.xHotSpot vBarInfo(8) = picInfo. 0. picInfo If picInfo. vBarInfo(10).hDC. Forms(formID) With Forms(formID).Add "VB. 0.xHotSpot = 0 Or picInfo. 0..Controls("pic___Ic_on_s") . When we need the background color for a mask ' 2.Visible = False .bmWidth vBarInfo(8) = imgInfo. 0... imgInfo) = 0 Then 'And vControl Is Nothing Then GetIconInfo vBarInfo(10). 0. "pic___Ic_on_s". Len(imgInfo).Print "font?".Controls. CLng(i)) = 0 Then ' drawing failed. (vBarInfo(9) And 4) = 4.bmHeight End If Err. vBarInfo(10) sBarInfo = sText Exit Sub DrawPicture: ' this routine is used when.Clear If vBarInfo(6) = -2 Then Dim picIcon As PictureBox Forms(formID).vBarInfo(7) = 0 End If vBarInfo(5) = MakeLong(CInt(vBarInfo(5)). CInt(vBarInfo(8))) End If End If vBarInfo(9) = sbarType Or vBarInfo(9) vBarInfo(0) = vBarInfo(0) + vBarInfo(4) 'Debug.

OldWinProc MenuData(ActiveHwnd). 0. set flag to allow drawing of icons bDrawIcon = True: bDrawPanel = True: bGetPanelData = True lLastSubMenu = 0 Project Report :: Cyber Café Management System . 0. bDrawPanel As Boolean. Select Case wMsg Case WM_INITMENUPOPUP ' menu is about to be displayed. ' then the ParentForm property is the same as the form's actual handle hWndRedirect = MenuData(ActiveHwnd). 0) End If End With Forms(formID). 0. vBarInfo(10).OldWinProc = 0 End If End If End Sub Private Function CustomDrawMenu(wMsg As Long. bGetPanelData As Boolean Static lOffsets(0 To 2) As Long. 0. GWL_WNDPROC. if the child isn't maximized in the MDI parent.OldWinProc <> 0 And bSet = False Then ' hook only if window was already hooked SetWindowLong CLng(ActiveHwnd). lParam As Long. MenuData(ActiveHwnd). we redirect to the routine to ' get the info from the parent. hWndRedirect As String Static bDrawIcon As Boolean. CLng(i) End If ' get the mask color vBarInfo(6) = GetPixel(.hDC. I redirect the actions to the parent via the GetMenuMetrics sub ' regardless whether or not the child is maximized ' Since each menu drawn is now stored the parent class. 0. then the menus are ' not subclassed (pain in the neck until this was figured out & re-thought) ' To work around this & prevent the submenus from being stored in both the parent ' and child classes. 0. GWL_WNDPROC.OldWinProc = SetWindowLong(CLng(ActiveHwnd).hDC.If i = 4 Then i = 3 Else i = 4 DrawState . AddressOf MsgProc) Else If MenuData(ActiveHwnd).OldWinProc = 0 And bSet = True Then ' hook only if window not already hooked MenuData(ActiveHwnd). wParam As Long) As Boolean Dim IsSep As Boolean. If the form is the MDI parent or is a non-MDI form.Controls. 0. lLastSubMenu As Long ' MDI children menus are subclassed to parent by Windows ' However.Remove "pic___Ic_on_s" End If Return End Sub Private Sub SetFreeWindow(bSet As Boolean) If MenuData(ActiveHwnd). 0.ParentForm ' here we set this flag.

pData(1) tRect.hwndItem If MenuData(hWndRedirect).hwndItem.Status And 16) = 16) If (IsSideBar = True And bDrawPanel = False) Then Exit Function IsSep = (MenuData(hWndRedirect). hOldBr As Long.itemState And 7) = 7) ' don't continue the process if the disabled item or separator ' was already drawn. other windows items send above message ' and we don't want to interfere with those. ByVal lParam.it doesn't change If bDrawIcon = False And (bMenuItemDisabled = True Or IsSep = True) Then Exit Function bMenuItemChecked = CBool((DrawInfo. lTextColor As Long Dim tRect As RECT Dim iRectOffset As Integer.CtlType <> ODT_MENU Then Exit Function CustomDrawMenu = True IsSideBar = CBool((MenuData(hWndRedirect). hOldPen As Long.itemState And 8) = 8 Or (DrawInfo. LenB(DrawInfo)) ' only process menu items.Case WM_DRAWITEM Dim DrawInfo As DRAWITEMSTRUCT Dim IsSideBar As Boolean Dim hBR As Long.GetPanelInformation pData().Status And 2) = 2 And IsSideBar = False ' get the checked & enabled status bMenuItemDisabled = CBool((DrawInfo.Bottom = pData(1) tRect.itemState And 9) = 9) ' set a reference in the drawing module to this menu's DC & set the font modDrawing.hDC If bDrawPanel = True Or lLastSubMenu <> DrawInfo. we don't touch it lSubMenu = DrawInfo.Print "panel xy:".itemState And 6) = 6 Or (DrawInfo. bMenuItemChecked As Boolean Dim bSelected As Boolean. iSBoffset As Integer Dim sAccelKey As String. no need to redraw it again . Also if we didn't ' process it.TargethDC = DrawInfo. sCaption As String Dim bMenuItemDisabled As Boolean. DrawInfo.Right = pData(4) hBR = CreateSolidBrush(pData(6)) Project Report :: Cyber Café Management System .ItemId. bHasIcon As Boolean 'Get DRAWINFOSTRUCT which gives us sizes & indexes Call CopyMemory(DrawInfo. sCaption lOffsets(2) = pData(3) If lOffsets(2) Then lOffsets(2) = lOffsets(2) + 5 lOffsets(1) = pData(4) If pData(4) Then lOffsets(1) = lOffsets(1) + 3 lOffsets(0) = lOffsets(1) + lOffsets(2) If bDrawPanel = True Then If pData(10) <> 0 Then Debug.SetMenuID(DrawInfo. False) = False Then Exit Function If DrawInfo. False. pData(4). hChkBr As Long Dim hPen As Long.hwndItem Then Dim pData(0 To 10) As Long MenuData(hWndRedirect).

2. LoWord(pData(7)).itemState And ODS_SELECTED) = ODS_SELECTED ' Now let's set some colors to draw with With DrawInfo If bSelected = True And bMenuItemDisabled = False And IsSep = False Then hBR = CreateSolidBrush(GetSysColor(COLOR_HIGHLIGHT)) hPen = GetPen(1.hDC. hOldPen DeleteObject hPen pData(8) = CLng(HiWord(pData(5))) pData(5) = CLng(LoWord(pData(5))) If (pData(9) And 2) = 2 Then modDrawing.hDC. tRect. CInt(pData(8)).hDC. DT_LEFT Or DT_NOCLIP Or DT_SINGLELINE Or &H800 SetMenuFont False End If End If End If bDrawPanel = False lLastSubMenu = DrawInfo.Left = (pData(4) . pData(6)) hOldPen = SelectObject(DrawInfo.hDC.hDC. tRect. pData(10) tRect. hPen) hOldBr = SelectObject(DrawInfo.Top = (pData(1) . .hDC.Right. _ tRect.hPen = GetPen(1.pData(5)) \ 2 tRect. 0.TargethDC = DrawInfo.hwndItem Erase pData End If If IsSideBar Then CustomDrawMenu = True Exit Function End If SetMenuFont True ' determine if this item is focused or not which also determines ' what colors we use when we are drawing bSelected = (DrawInfo. GetSysColor(COLOR_HIGHLIGHT)) Project Report :: Cyber Café Management System .hDC If (pData(9) And 32) = 32 Then DoGradientBkg pData(6).hDC. tRect. Abs(CInt((pData(9) Or 16) = 16) * 2) + 1. pData(7) DrawText DrawInfo.hDC DrawMenuIcon pData(10). . tRect. HiWord(pData(7)). hOldBr DeleteObject hBR SelectObject DrawInfo. hBR) DrawRect 0. NEWTRANSPARENT DetermineOS DrawInfo.Bottom SelectObject DrawInfo. Len(sCaption). sCaption. CLng(hWndRedirect) SetMenuFont True. CInt(pData(5)). False. .pData(8)) \ 2 + pData(8) SetTextColor DrawInfo. pData(6) Else SetBkMode DrawInfo.

Right.hDC.2 Else 'If bMenuItemChecked Then ' iRectOffset = lOffsets(0) . MenuData(hWndRedirect).Bottom 'Print the menu item's text If MenuData(hWndRedirect). .rcItem.HotKeyPos) Project Report :: Cyber Café Management System . does this item have an icon? ' Here we do one more extra check in case the ImageViewer ' is no longer available or has no images (then handle is 0) ' we also set the offset for highlighting rectangle's left ' edge so it doesn't highlight icons If MenuData(hWndRedirect).lTextColor = GetSysColor(COLOR_HIGHLIGHTTEXT) Else hBR = CreateSolidBrush(GetSysColor(COLOR_MENU)) hPen = GetPen(1. hPen) 'Do we have a separator bar? bHasIcon = False sCaption = MenuData(hWndRedirect).rcItem. so identify it & its left edge sAccelKey = Mid$(sCaption. GetSysColor(COLOR_MENU)) If bMenuItemDisabled Or IsSep = True Then lTextColor = GetSysColor(COLOR_HIGHLIGHTTEXT) Else lTextColor = GetSysColor(COLOR_MENUTEXT) End If End If If bMenuItemDisabled = True Then ' for checked & disabled items.rcItem.rcItem.Left + iRectOffset.hDC.HotKeyPos Then ' we have a control key.Top.Caption If Not IsSep Then ' Ok. . we use default back color hChkBr = CreateSolidBrush(GetSysColor(COLOR_MENU)) Else ' here we set the back color of a depressed button hChkBr = CreateSolidBrush(GetSysColor(COLOR_BTNLIGHT)) End If 'Select our new. hBR) hOldPen = SelectObject(. correctly colored objects: hOldBr = SelectObject(.ImageViewer > 0 And _ MenuData(hWndRedirect).2 'Else iRectOffset = lOffsets(1) 'End If End If 'Draw the highlighting rectangle DrawRect . .Icon > 0 Then bHasIcon = True iRectOffset = lOffsets(0) .

rcItem DrawCaption .. sAccelKey)) End If ' send the caption.Left + lOffsets(0) .rcItem. vIconDat(1). lOffsets(1) If bMenuItemDisabled Then DrawCheckMark .2. .HotKeyEdge. _ GetSysColor(COLOR_GRAYTEXT) End If If bMenuItemChecked Then ' for checked items. lOffsets(0) .Top.hDC. . sAccelKey.rcItem ' get starting rectangle & OffsetRect tRect.rcItem.rcItem. . hChkBr DrawRect lOffsets(1). lTextColor.Top + 3. True. . sCaption. _ tRect.5.1 ThreeDbox lOffsets(1) .GetIconData vIconDat(). . lOffsets(1) End If End If End If 'If the item has an icon. _ tRect. -1 ' offset by 1 top & left ' print text again with offsets DrawCaption . bMenuItemDisabled. GetSysColor(COLOR_MENUTEXT)). We make the checked item appear in a sunken ' box and make the backcolor of the box lighter than normal SelectObject .Top + 2. we do a few ' things different. type & transparency option Dim vIconDat() As Long MenuData(hWndRedirect).Top.rcItem. selected or not.3. True.Right = tRect. False.rcItem.rcItem. lTextColor If bMenuItemDisabled Then ' add the engraved affect tRect = . control key.Left = 4 + lOffsets(1) tRect. sCaption.Bottom .hDC. InStr(sCaption.HotKeyEdge. tRect. IIf(bMenuItemDisabled. icon offset.Top + 16 'send the icon information to be drawn DrawMenuIcon vIconDat(0). lOffsets(0) .rcItem. hBR If bMenuItemDisabled = False And bMenuItemChecked = False Then Project Report :: Cyber Café Management System . GetSysColor(COLOR_GRAYTEXT).rcItem. MenuData(hWndRedirect).Left + lOffsets(0).Top) . since they can have icons. -1.Top tRect. MenuData(hWndRedirect). etc to be printed tRect = .rcItem.rcItem.Bottom = tRect. vIconDat(2) End If SelectObject . disabled or not If bHasIcon = True Then If bDrawIcon = True Or bMenuItemChecked = True Then ' we are redrawing icons ' extract icon handle.16) \ 2 + .Top = ((.1. MenuData(hWndRedirect). bMenuItemDisabled.Icon 'set up the location to be drawn tRect.rcItem. True If bHasIcon = False Then ' now if the checked item doesn't have an icon we draw a checkmark in the icons' place DrawCheckMark .Bottom . .2.sCaption = Left$(sCaption.Bottom .Left + 16 tRect. sAccelKey.rcItem.rcItem.

hDC. True ' use smaller font tRect = . sCaption. True 'tRect = ..Bottom . bSelected End If End If If IsSep Then 'Finally. hOldPen) 'Delete the ones we created Call DeleteObject(hBR) Project Report :: Cyber Café Management System . sCaption.Bottom . -1 ' move coords up & left by 1 ' send caption again in gray 'DrawCaption . -1.4 + lOffsets(1). True End If Else ' This will remove or add a 3D raised box for checked/non-checked items If bMenuItemChecked = False Then ThreeDbox lOffsets(1) + .rcItem. lTextColor.rcItem.Bottom .rcItem. True ThreeDbox tRect. CInt(lOffsets(1)) 'DrawCaption . _ tRect.Top.Right .rcItem.rcItem ' recopy menuitem coords 'OffsetRect tRect. .rcItem. . then we need to do ' some additional calculations If Len(sCaption) Then ' separator bars with text SetMenuFont True.Top.Top) \ 2 + .4.rcItem.rcItem. lOffsets(0) . if the separator has text.rcItem. GetSysColor(COLOR_GRAYTEXT).Left .1.rcItem.rcItem. 0. 0. _ (.rcItem.Top + 3. tRect. hOldBr) Call SelectObject(.rcItem ' copy the menuitem coords ' send caption to be printed in menu-select color ' of course any color can be used & if you want to use the ' standard 3D gray disabled color then Rem out the next line ' and un-rem the next 3 lines & the second DrawCapton line DrawCaption . _ (.Left.Bottom .Right + 4.rcItem.5.Left. "".Left .. tRect..rcItem. .Right . .rcItem.' here we draw or remove the 3D box around the icon ThreeDbox lOffsets(1).Top + 2. .rcItem.Top) \ 2 + 1 + . . _ (.rcItem.Top) \ 2 + .rcItem.rcItem. GetSysColor(COLOR_HIGHLIGHT).Bottom . . draw the special separator bar if needed ' however.rcItem.Top. 0.rcItem.Top + 2.Top. True.Top + 3. _ (. "". True If bMenuItemChecked = False Then ' here we add the lines on both sides of the separator caption ThreeDbox 4 + lOffsets(1).Left.Top) \ 2 + 1 + . .rcItem. .rcItem.. sCaption. _ . True End If End If 'Select the old objects into the menu's DC Call SelectObject(.2.4.hDC.rcItem.Top.rcItem.Bottom .1.rcItem. "". tRect.

False) = False Then Exit Function If MeasureInfo. 2) End Function Private Function DetermineOS(Optional SetGraphicsModeDC As Long = 0) As Integer ' The following are the platform. we don't touch it If MenuData(hWndRedirect).ItemHeight MeasureInfo. lSubMenu.ItemWidth = MenuData(hWndRedirect). MeasureInfo. add a buffer of 3 pixels top/bottom for text MeasureInfo.SetMenuID(MeasureInfo. Len(MeasureInfo)) CustomDrawMenu = True Case WM_ENTERIDLE ' done displaying panel. basically submenu item height/width Call CopyMemory(MeasureInfo. let's stop drawing icons bDrawIcon = False End Select End Function Public Function HiWord(LongIn As Long) As Integer Call CopyMemory(HiWord. False. other windows items send above message ' and we don't want to interfere with those. major version & minor version of OS to date (acquired from MSDN) Const os_Win95 = "1. ByVal HiWord As Integer) As Long MakeLong = CLng(LoWord) Call CopyMemory(ByVal VarPtr(MakeLong) + 2. LongIn. 2) End Function Public Function LoWord(LongIn As Long) As Integer Call CopyMemory(LoWord.PanelWidth 'Return the information back to Windows Call CopyMemory(ByVal lParam.ItemId.0" Project Report :: Cyber Café Management System . Len(MeasureInfo)) ' only process menu items. ByVal lParam.Status And 16) = 16) 'Tell Windows how big our items are. Also if we didn't ' process it.ItemHeight = MenuData(hWndRedirect). 2) End Function Private Function MakeLong(ByVal LoWord As Integer.CtlType <> ODT_MENU Then Exit Function IsSep = (((MenuData(hWndRedirect). ' add height of each item.4. ByVal VarPtr(LongIn) + 2. HiWord.Status And 2) = 2) And (Not MenuData(hWndRedirect).Call DeleteObject(hPen) Call DeleteObject(hChkBr) SetMenuFont False End With CustomDrawMenu = True ' set flag to prevent resending to form Case WM_MEASUREITEM Dim MeasureInfo As MEASUREITEMSTRUCT 'Get the MEASUREITEM info.

hwnd = hwnd Then Exit For Next If i > -1 Then If TypeOf Forms(i) Is MDIForm Then bIsMDI = True GetFormHandle = i End If End Function Description of Class Modules (clsMyMenu) :: Project Report :: Cyber Café Management System . assume no adjustment is necessary Select Case sVersion Case os_Win98: iTabOffset = 32 Case os_Win2K: iTabOffset = 0 Case os_WinNT4: iTabOffset = 0 Case os_WinNT351 ' Problems when printing rotated text 'According to MSDN.5.dwPlatformId & ".4. otherwise. SetGraphicsMode SetGraphicsModeDC." & . Optional bIsMDI As Boolean) As Long Dim i As Long For i = Forms.4.90" Const os_WinXP = "2.0" Const os_WinNT351 = "2.0" Const os_WinME = "1.51 only works on a setting of 2." & .1" Dim verinfo As OSVERSIONINFO.dwMinorVersion End With ' those where the iTabOffset is set are systems that I have seen the ' results on.3.dwMajorVersion & ". NT 3.5.4.10" Const os_WinNT4 = "2.Const os_Win98 = "1. 2 Case os_Win95 Case os_WinXP: iTabOffset = 0 Case os_WinME End Select End Function Public Function GetFormHandle(hwnd As Long. sVersion As String verinfo.Count .1 To 0 Step -1 If Forms(i). Don't have the opportunity to test this.51" Const os_Win2K = "2.dwOSVersionInfoSize = Len(verinfo) If (GetVersionEx(verinfo)) = 0 Then Exit Function ' use default 0 With verinfo sVersion = .

Icon = lValue End Property Property Get Icon() As Long Icon = MyMI(menuIDs(mIDcurrent)).ItemHeight End Property Property Let ItemWidth(lValue As Long) MyMI(menuIDs(mIDcurrent)).ItemHeight = lValue End Property Property Get ItemHeight() As Long ItemHeight = MyMI(menuIDs(mIDcurrent)).ItemWidth = lValue End Property Property Get ItemWidth() As Long ItemWidth = MyMI(menuIDs(mIDcurrent)).HotKeyPos = lValue End Property Property Get HotKeyPos() As Long HotKeyPos = MyMI(menuIDs(mIDcurrent)).HotKeyPos End Property Property Let Status(lValue As Long) Project Report :: Cyber Café Management System .for others it is it's own handle Private MyMI() As MenuDataInformation ' collection of menuitems Private menuIDs As Collection ' index to myMI array Private mIDcurrent As Long ' current menu item Private MyPanels() As PanelDataInformation Private PanelData As Collection Private pIDcurrent As Long Private MDIchildren As Collection Property Get TotalIcons() As Long On Error Resume Next TotalIcons = ImageLister. can't use handle 'cause it can change per MSDN Public MainMenuID As Long ' handle to form's main menu Public OldWinProc As Long ' handle to form's window message processor Public ChildStatus As Byte ' 1 indicates a child Public ParentForm As Long ' for MDI children.ListImages.Count End Property Property Let Icon(lValue As Long) MyMI(menuIDs(mIDcurrent)). this is the MDI parent -.Icon End Property Property Let ItemHeight(lValue As Long) MyMI(menuIDs(mIDcurrent)).ItemWidth End Property Property Let HotKeyPos(lValue As Long) MyMI(menuIDs(mIDcurrent)).Private ImageLister As Control ' name of menus imagelist.

Caption End Property Property Get ImageViewerObj() As Control On Error Resume Next Set ImageViewerObj = ImageLister End Property Property Get ImageViewer() As Long On Error Resume Next ImageViewer = ImageLister.Caption = sValue End Property Property Get Caption() As String Caption = MyMI(menuIDs(mIDcurrent)).MyMI(menuIDs(mIDcurrent)).Status And 4) = 4 End Property Property Get SideBarItem() As Long SideBarItem = MyPanels(CStr(pIDcurrent)).OriginalCaption End Property Property Let OriginalCaption(sValue As String) MyMI(menuIDs(mIDcurrent)).hImageList End Property Public Sub SetImageViewer(vObject As Control) Set ImageLister = vObject End Sub Property Get OriginalCaption() As String OriginalCaption = MyMI(menuIDs(mIDcurrent)).Status = lValue End Property Property Get Status() As Long Status = MyMI(menuIDs(mIDcurrent)).OriginalCaption = sValue End Property Property Get SideBarIsText() As Boolean On Error Resume Next SideBarIsText = (MyPanels(CStr(pIDcurrent)).SideBar End Property Property Get PanelWidth() As Long PanelWidth = MyPanels(CStr(pIDcurrent)).Status End Property Property Let Caption(sValue As String) MyMI(menuIDs(mIDcurrent)).SBarIcon End Property Property Get SideBarWidth() As Long SideBarWidth = MyPanels(CStr(pIDcurrent)).Width End Property Property Get PanelIDcount() As Long Project Report :: Cyber Café Management System .

Count End Property Property Get PanelHeight() As Long On Error Resume Next PanelHeight = MyPanels(CStr(pIDcurrent)).Height End Property Property Get HotKeyEdge() As Integer HotKeyEdge = CInt(MyPanels(CStr(pIDcurrent)).Add MDIchildren.HKeyPos = vData(2) .Count End Property Public Sub UpdatePanelID(vData() As Long. bPartial As Boolean) On Error Resume Next With MyPanels(CStr(pIDcurrent)) .Count + 1. sText As String.Clear End Function Property Get MenuIDcount() As Integer On Error Resume Next MenuIDcount = menuIDs.Caption = sText .FColor = vData(7) .BColor = vData(6) .Width = vData(0) .Height = vData(1) .Status = vData(9) .SideBar = vData(4) .SideBarXY = vData(5) . CStr(lValue) Else lHwnd = MDIchildren(CStr(lValue)) GetSetMDIchildSysMenu = (lHwnd <> 0) End If Err.HKeyPos) End Property Public Function GetSetMDIchildSysMenu(lValue As Long.On Error Resume Next PanelIDcount = PanelData. bSet As Boolean) As Boolean On Error Resume Next Dim lHwnd As Long If bSet = True Then If MDIchildren Is Nothing Then Set MDIchildren = New Collection lHwnd = MDIchildren(CStr(lValue)) If lHwnd = 0 Then MDIchildren.Print "full update on paneldata" .PanelIcon = vData(3) If bPartial = False Then 'Debug.SBarIcon = vData(10) Project Report :: Cyber Café Management System .

" & CStr(hSubMenu) mIDcurrent = menuIDs.Parent = hSubMenu ' return a value indicating this is a new add SetMenuID = True Project Report :: Cyber Café Management System . 1.HKeyPos vData(3) = .SBarIcon End With End Sub Public Function SetMenuID(iID As Long.SideBar vData(5) = .Width + 16 vData(1) = .End If End With End Sub Public Sub GetPanelInformation(vData() As Long. sText As String) On Error Resume Next ReDim vData(0 To 10) With MyPanels(PanelData(CStr(MyMI(menuIDs(mIDcurrent)).Status vData(10) = .Caption vData(9) = . Optional bAlwaysCreate As Boolean = True) As Boolean On Error Resume Next ' we reference passed menu item. hSubMenu As Long.Count ' now we will add an MyMI array ReDim Preserve MyMI(1 To menuIDs.3) mIDcurrent = iID Else ' menu item is by ID vs position mIDcurrent = menuIDs(CStr(iID) & ".2..Count) MyMI(menuIDs(mIDcurrent)). CStr(iID) & ".BColor vData(7) = .e.Add menuIDs.PanelIcon vData(4) = .ID = iID MyMI(menuIDs(mIDcurrent)).Height vData(2) = . if we don't have a reference ' an error occurs which triggers a new reference if the ' bAlwaysCreate boolean is set to true If byPosition Then ' menu item is positional (i.Parent))) vData(0) = .SideBarXY vData(6) = .FColor sText = . byPosition As Boolean.Count + 1." & CStr(hSubMenu)) End If If Err Then ' new reference If bAlwaysCreate = True Then ' let's add a new reference & use the menu ID as a key menuIDs.

Count). the menu metrics is calling this and we ' need to return false indicating this is not a new add If bAlwaysCreate = False Then SetMenuID = True End If pIDcurrent = PanelData(CStr(hSubMenu)) End Function Public Sub GetIconData(vData() As Long.Type If (MyMI(menuIDs(mIDcurrent)).Clear PanelData. PanelData. CStr(hSubMenu) ReDim Preserve MyPanels(1 To PanelData.Count) MyPanels(PanelData.Item(iID)).Count + 1.Count End If End If Else ' reference already exists ' if the following flag wasn't set.Print "new panel created-count=".Count Then ReDim newMyMI(1 To menuIDs.ListImages(IconIndex).Picture.Clear pIDcurrent = PanelData(CStr(hSubMenu)) If Err Then Err.Add PanelData.Status And 8) = 8 Then vData(2) = 2 End If End If End Sub Public Function GetPanelID(iID As Long) As Long On Error Resume Next GetPanelID = MyPanels(PanelData.Picture. IconIndex As Long) On Error Resume Next ReDim vData(0 To 2) If Not ImageLister Is Nothing Then vData(0) = ImageLister. newMyPanels() As PanelDataInformation Dim Looper As Long.Err.ListImages(IconIndex). lCounter As Long On Error GoTo ExitSub If menuIDs.ID End Function Public Sub PurgeObsoleteMenus(hSubMenu As Long) Dim newMyMI() As MenuDataInformation. hSubMenu.ID = hSubMenu 'Debug. then the drawing/measuring ' routine wants to know if we have a reference ' so we set return to true if so ' otherwise.Count) Project Report :: Cyber Café Management System .Handle vData(1) = ImageLister.Status And 4) = 4 Then vData(2) = 1 Else If (MyMI(menuIDs(mIDcurrent)).

Item(Looper)).Print "Finished indexing menuitems" End If Erase newMyMI End If If PanelData.Parent <> hSubMenu Then newMyMI(lCounter) = MyMI(menuIDs.1 Then Erase MyPanels ReDim MyPanels(1 To lCounter .Item(Looper)) If SideBarIsText = True Then DeleteObject MyPanels(PanelData.lCounter = 1 For Looper = menuIDs.1 Then Erase MyMI ReDim MyMI(1 To lCounter .Add Looper.Parent) Next 'Debug.Count To 1 Step -1 pIDcurrent = Looper If MyPanels(PanelData. CStr(newMyMI(Looper).ID) & ".1) Set PanelData = Nothing Set PanelData = New Collection For Looper = 1 To lCounter .SBarIcon lCounter = lCounter + 1 End If Next If lCounter .Count To 1 Step -1 If MyMI(menuIDs." & CStr(newMyMI(Looper).Item(Looper)).1 MyPanels(Looper) = newMyPanels(Looper) PanelData.Add Looper.ID <> hSubMenu Then newMyPanels(lCounter) = MyPanels(PanelData.Print "Finished Indexing panels" End If Erase newMyPanels End If Looper = 0 Looper = MDIchildren(CStr(hSubMenu)) Project Report :: Cyber Café Management System .Count) lCounter = 1 For Looper = PanelData.Count Then ReDim newMyPanels(1 To PanelData. CStr(newMyPanels(Looper).ID) Next 'Debug.Item(Looper)) lCounter = lCounter + 1 End If Next If lCounter .1) Set menuIDs = Nothing Set menuIDs = New Collection For Looper = 1 To lCounter .1 MyMI(Looper) = newMyMI(Looper) menuIDs.Item(Looper)).

Count pIDcurrent = Looper If SideBarIsText = True Then DeleteObject MyPanels(PanelData.SBarIcon Next Set PanelData = Nothing Set MDIchildren = Nothing Set ImageLister = Nothing MainMenuID = 0 OldWinProc = 0 Set menuIDs = Nothing Erase MyMI End Sub Private Sub Class_Initialize() Set menuIDs = New Collection Set PanelData = New Collection End Sub Project Report :: Cyber Café Management System .If Looper Then MDIchildren.Remove Looper ExitSub: End Sub Private Sub Class_Terminate() On Error Resume Next Dim Looper As Long For Looper = 1 To PanelData.Item(Looper)).

Sign up to vote on this title
UsefulNot useful

Master Your Semester with Scribd & The New York Times

Special offer: Get 4 months of Scribd and The New York Times for just $1.87 per week!

Master Your Semester with a Special Offer from Scribd & The New York Times