nIGHTmAYOR
Registered User.
- Local time
- Today, 13:42
- Joined
- Sep 2, 2008
- Messages
- 240
As I got to see that this forum is really trying to help access programmers , I decided to use it to post my article in here to benefit its seekers .
Please do note the following :
Methods applied are unconventional and rely on my experimentation of the situation since I got to realize that there were minimal documentations for our subject of discussion J
Also please pardon my English , I've did my best yet it’s a fact that English is my third language.
Quick Introduction
Why wouldn't Microsoft make it easy to compile an MS Access Project into a distributed executable?
1 – Microsoft has managed to create a monster by creating MS Access , and by realizing the risk and the fact that they would have to put many applications (such as Axapta , Great Plains , mind you Visual Studio .net) to sleep , they had to cripple it a little from being a developers platform and tam it into becoming a small business solution.
2 – For a peculiar reason programmers through-out time have always been valued based on complexity and not on achievement (So an Oracle programmer would get paid for developing a phone book application yet an Access Programmer gets a tap on the back which leads elite programmers to refrain from such beast called Microsoft Access.
Now , Now enough chit chat and let's get to work:
Step 1 : Make sure that your application security is not reliant on Microsoft Security file .mdw (for many reasons 1st its unsecured , 2nd it would still give away that this is an MS Access application, 3rd it would conflict with users who have other access applications installed on their own PCs who are about to use yours) you will have to script your own security modal which isn’t so difficult , all you need is to script a login form , an administration form , and every form and report on your application to check if authorized to run or edit (On_Open event) and thus leading the Form/Report to close "DoCmd.Close Form.Name" Or denying data manipulation through "Form.AllowEdits = False" / "Form.AllowDeletions = False" (I am trying to make it look simple so you wouldn’t cry).
Step2: Make sure you have scripted your own menus and tool bars (it's easy and fun so don't you get lazy).
Step3: Make sure your Startup Form is selected , your databse window is set to hide and that you have your own icon installed as project and form icon (Insert icon in your project folder , use string ".\youriconname.ico" instead of full path because usually paths vary PC to Another
Step4: Implement Microsoft Script disabling "Startup Form Over-ride by using Shift Key"
Create New Model :
……………………………
Now Create a label named bDisableBypassKey and add the following code to its Click event :
……………………………
(above script is a raw and dangerous script , if not handled with care you might end up losing designer's access to your project also do note that I have managed to disable its back door since you shouldn’t be leaving such an advantage in the hands of end users) .
Also do not click your disable label until final stage of operation.
Step5: Cover all your form errors with proper addressing messages or procedures (Unlike MS Access , programs shouldn’t generate run time errors , and usually a program with a runtime error will crash and exit), now for an easy solution for those who are lazy enough use the general Form Error section and add the following (On Error Resume Next) or maybe add a message box or two stating that an error has occurred and user should be more careful (You lazy you!).
Step6: Create a .mde file (Save your VB scripts from being stolen until someone comes up with a proper tool to decode it , you can also skip this stage if you like , or if for a peculiar reason Microsoft Access denied it -Happens with huge projects).
Step7: Create a photo dimensioned 362x290 pixel (Smart developers tried 1x1 pixel image which worked up fine on their platforms but generated errors and crashes on other users' platforms so stick to the standard , oh and darken the area where Microsoft overlays its version details ) in BMP format as your splash screen (This will replace Microsoft Access splash screen on running), give it the same name as your database/project (i.e if your database/project is named myproject.mdb etc. name your photo myproject.bmp ) and place it in your project's folder.
Step8: Rename your database / project file extension (The neat trick) into dll (i.e if your database / project is named myproject.mdb etc. name it myproject.dll ), Also move security workgroup file (system.mdw usualy) used while database creation to project's folder and rename its extension into ocx (i.e if your security workgroup file is named myproject.mdw etc. name it myproject.ocx ).
while making sure Form Parameter "Make Visible in Taskbar" is set to False , Startup Form is invisible and then compile it to the same Project Folder (Adding up an icon file wouldn’t hurt).
(Now attached to this article you will find the source code to such project and a compiled example of its EXE)
Step10 : Keep a copy of file MSACCESS.EXE usually found in Microsoft Office folder in Program Files to your project folder (Saves Junior programmers the hassle of searching registry for Microsoft Office or Microsoft Access Runtime installation folder , also note that this doesn’t work with MS Office 2007 in which case you have to make your executable file created on Step9 lookup MS Office 2007 installation path in registry key "HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Office \ 12.0 \ Access \ InstallRoot : Path" value and add it to your shell command).
Et Voila !
Important Notices:
1 - Now do note the following , your project is still reliant on Microsoft Office Access and while I do know how to make it un-reliant , the technique to it is still illegal as it requires certain tampering to Microsoft Access Runtime files installation and registration technique which Microsoft denies.
2 – It is better to include Microsoft Access Runtime environment 2000 / 2002 and not 2003 or 2007 to your installation as you will be faced upon first start by MS Access confirm security level of application which is a confusing dialogue to end user.
3 – You can always use command line switches to stealthily install Microsoft Access Runtime during installation of your application which I recommend setup factory as an installation packager of choice (A bit techy here).
4 – Finally do note that Command Line switches of Microsoft Access malfunctions if paths include spaces so do try to restrict/deny installation paths that is not compliant with old dos fundamentals of naming (A bit techy here).
Best Regards,
nIGHTmAYOR
Please do note the following :
Methods applied are unconventional and rely on my experimentation of the situation since I got to realize that there were minimal documentations for our subject of discussion J
Also please pardon my English , I've did my best yet it’s a fact that English is my third language.
Quick Introduction
Why wouldn't Microsoft make it easy to compile an MS Access Project into a distributed executable?
1 – Microsoft has managed to create a monster by creating MS Access , and by realizing the risk and the fact that they would have to put many applications (such as Axapta , Great Plains , mind you Visual Studio .net) to sleep , they had to cripple it a little from being a developers platform and tam it into becoming a small business solution.
2 – For a peculiar reason programmers through-out time have always been valued based on complexity and not on achievement (So an Oracle programmer would get paid for developing a phone book application yet an Access Programmer gets a tap on the back which leads elite programmers to refrain from such beast called Microsoft Access.
Now , Now enough chit chat and let's get to work:
Step 1 : Make sure that your application security is not reliant on Microsoft Security file .mdw (for many reasons 1st its unsecured , 2nd it would still give away that this is an MS Access application, 3rd it would conflict with users who have other access applications installed on their own PCs who are about to use yours) you will have to script your own security modal which isn’t so difficult , all you need is to script a login form , an administration form , and every form and report on your application to check if authorized to run or edit (On_Open event) and thus leading the Form/Report to close "DoCmd.Close Form.Name" Or denying data manipulation through "Form.AllowEdits = False" / "Form.AllowDeletions = False" (I am trying to make it look simple so you wouldn’t cry).
Step2: Make sure you have scripted your own menus and tool bars (it's easy and fun so don't you get lazy).
Step3: Make sure your Startup Form is selected , your databse window is set to hide and that you have your own icon installed as project and form icon (Insert icon in your project folder , use string ".\youriconname.ico" instead of full path because usually paths vary PC to Another
Step4: Implement Microsoft Script disabling "Startup Form Over-ride by using Shift Key"
Create New Model :
Code:
[COLOR=black][FONT=Arial]Public Function SetProperties(strPropName As String, varPropType As Variant, varPropValue As Variant) As Integer[/FONT][/COLOR]
[COLOR=black][FONT=Arial]On Error GoTo Err_SetProperties[/FONT][/COLOR]
[COLOR=black][FONT=Arial]Dim db As DAO.Database, prp As DAO.Property[/FONT][/COLOR]
[COLOR=black][FONT=Arial]Set db = CurrentDb[/FONT][/COLOR]
[COLOR=black][FONT=Arial]db.Properties(strPropName) = varPropValue[/FONT][/COLOR]
[COLOR=black][FONT=Arial]SetProperties = True[/FONT][/COLOR]
[COLOR=black][FONT=Arial]Set db = Nothing[/FONT][/COLOR]
[COLOR=black][FONT=Arial]Exit_SetProperties:[/FONT][/COLOR]
[COLOR=black][FONT=Arial]Exit Function[/FONT][/COLOR]
[COLOR=black][FONT=Arial]Err_SetProperties:[/FONT][/COLOR]
[COLOR=black][FONT=Arial]If Err = 3270 Then 'Property not found[/FONT][/COLOR]
[COLOR=black][FONT=Arial]Set prp = db.CreateProperty(strPropName, varPropType, varPropValue)[/FONT][/COLOR]
[COLOR=black][FONT=Arial]db.Properties.Append prp[/FONT][/COLOR]
[COLOR=black][FONT=Arial]Resume Next[/FONT][/COLOR]
[COLOR=black][FONT=Arial]Else[/FONT][/COLOR]
[COLOR=black][FONT=Arial]SetProperties = False[/FONT][/COLOR]
[COLOR=black][FONT=Arial]MsgBox "Runtime Error # " & Err.Number & vbCrLf & vbLf & Err.Description[/FONT][/COLOR]
[COLOR=black][FONT=Arial]Resume Exit_SetProperties[/FONT][/COLOR]
[COLOR=black][FONT=Arial]End If[/FONT][/COLOR]
[COLOR=black][FONT=Arial]End Function[/FONT][/COLOR]
Now Create a label named bDisableBypassKey and add the following code to its Click event :
Code:
[FONT=Arial]Private Sub bDisableBypassKey_Click()[/FONT]
[FONT=Arial]On Error GoTo Err_bDisableBypassKey_Click[/FONT]
[FONT=Arial]'Dim strInput As String[/FONT]
[FONT=Arial]'Dim strMsg As String[/FONT]
[FONT=Arial]'Beep[/FONT]
[FONT=Arial]'strMsg = "Do you want to enable the Bypass Key?" & vbCrLf & vbLf & "Please key the [/FONT]
[FONT=Arial]'programmer's password to enable the Bypass Key."[/FONT]
[FONT=Arial]'strInput = InputBox(Prompt:=strMsg, Title:="Disable Bypass Key Password")[/FONT]
[FONT=Arial]'If strInput = "TypeYourPasswordHere" Then[/FONT]
[FONT=Arial]' SetProperties "AllowBypassKey", dbBoolean, True[/FONT]
[FONT=Arial]' Beep[/FONT]
[FONT=Arial]' MsgBox "The Bypass Key has been enabled." & vbCrLf & vbLf & "The Shift key will allow the users to bypass the startup options the next time the database is opened.", vbInformation, "Set Startup Properties"[/FONT]
[FONT=Arial]'Else[/FONT]
[FONT=Arial]Beep[/FONT]
[FONT=Arial]SetProperties "AllowBypassKey", dbBoolean, False[/FONT]
[FONT=Arial]' MsgBox "Incorrect ''AllowBypassKey'' Password!" & vbCrLf & vbLf & "The Bypass Key was disabled." & vbCrLf & vbLf & "The Shift key will NOT allow the users to bypass the startup options the next time the database is opened.", vbCritical, "Invalid Password"[/FONT]
[FONT=Arial]'Exit Sub[/FONT]
[FONT=Arial]' End If[/FONT]
[FONT=Arial]Exit_bDisableBypassKey_Click:[/FONT]
[FONT=Arial]Exit Sub[/FONT]
[FONT=Arial]Err_bDisableBypassKey_Click:[/FONT]
[FONT=Arial]MsgBox "Runtime Error # " & Err.Number & vbCrLf & vbLf & Err.Description[/FONT]
[FONT=Arial]Resume Exit_bDisableBypassKey_Click[/FONT]
[FONT=Arial]End Sub[/FONT]
(above script is a raw and dangerous script , if not handled with care you might end up losing designer's access to your project also do note that I have managed to disable its back door since you shouldn’t be leaving such an advantage in the hands of end users) .
Also do not click your disable label until final stage of operation.
Step5: Cover all your form errors with proper addressing messages or procedures (Unlike MS Access , programs shouldn’t generate run time errors , and usually a program with a runtime error will crash and exit), now for an easy solution for those who are lazy enough use the general Form Error section and add the following (On Error Resume Next) or maybe add a message box or two stating that an error has occurred and user should be more careful (You lazy you!).
Step6: Create a .mde file (Save your VB scripts from being stolen until someone comes up with a proper tool to decode it , you can also skip this stage if you like , or if for a peculiar reason Microsoft Access denied it -Happens with huge projects).
Step7: Create a photo dimensioned 362x290 pixel (Smart developers tried 1x1 pixel image which worked up fine on their platforms but generated errors and crashes on other users' platforms so stick to the standard , oh and darken the area where Microsoft overlays its version details ) in BMP format as your splash screen (This will replace Microsoft Access splash screen on running), give it the same name as your database/project (i.e if your database/project is named myproject.mdb etc. name your photo myproject.bmp ) and place it in your project's folder.
Step8: Rename your database / project file extension (The neat trick) into dll (i.e if your database / project is named myproject.mdb etc. name it myproject.dll ), Also move security workgroup file (system.mdw usualy) used while database creation to project's folder and rename its extension into ocx (i.e if your security workgroup file is named myproject.mdw etc. name it myproject.ocx ).
Step9 : Create a Visual Basic 5 or higher project (Lets get down and dirty for a minute) that all to be done is to run a shell command (Batch file like executable) running the following code in Open event of its Startup Form:
Code:
[LEFT][COLOR=black][FONT=Arial]Dim strPathToProgram As String[/FONT][/COLOR]
[FONT=Arial][COLOR=black]strPathToProgram = App.Path & "\MSACCESS.EXE " & App.Path & "\myproject.dll /wrkgrp " & [/COLOR][/FONT][COLOR=#333333][FONT=Arial]Chr(34) & App.path & "\[/FONT][/COLOR][COLOR=black][FONT=Arial]myproject.[/FONT][/COLOR][COLOR=#333333][FONT=Arial]ocx"[/FONT][/COLOR][COLOR=black][FONT=Arial] & Chr(34)[/FONT][/COLOR]
[FONT=Arial][COLOR=black]Shell ("" & strPathToProgram & "")[/COLOR][/FONT]
[COLOR=black][FONT=Arial]End[/FONT][/COLOR][/LEFT]
while making sure Form Parameter "Make Visible in Taskbar" is set to False , Startup Form is invisible and then compile it to the same Project Folder (Adding up an icon file wouldn’t hurt).
(Now attached to this article you will find the source code to such project and a compiled example of its EXE)
Step10 : Keep a copy of file MSACCESS.EXE usually found in Microsoft Office folder in Program Files to your project folder (Saves Junior programmers the hassle of searching registry for Microsoft Office or Microsoft Access Runtime installation folder , also note that this doesn’t work with MS Office 2007 in which case you have to make your executable file created on Step9 lookup MS Office 2007 installation path in registry key "HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Office \ 12.0 \ Access \ InstallRoot : Path" value and add it to your shell command).
Et Voila !
Important Notices:
1 - Now do note the following , your project is still reliant on Microsoft Office Access and while I do know how to make it un-reliant , the technique to it is still illegal as it requires certain tampering to Microsoft Access Runtime files installation and registration technique which Microsoft denies.
2 – It is better to include Microsoft Access Runtime environment 2000 / 2002 and not 2003 or 2007 to your installation as you will be faced upon first start by MS Access confirm security level of application which is a confusing dialogue to end user.
Download Link to Access Runtime environment 2000 :
http://www.microsoft.com/downloads/details.aspx?FamilyID=0c8f40ca-9ecc-426a-ac5f-e1f98a6acd73&DisplayLang=en
http://www.microsoft.com/downloads/details.aspx?FamilyID=0c8f40ca-9ecc-426a-ac5f-e1f98a6acd73&DisplayLang=en
3 – You can always use command line switches to stealthily install Microsoft Access Runtime during installation of your application which I recommend setup factory as an installation packager of choice (A bit techy here).
4 – Finally do note that Command Line switches of Microsoft Access malfunctions if paths include spaces so do try to restrict/deny installation paths that is not compliant with old dos fundamentals of naming (A bit techy here).
Best Regards,
nIGHTmAYOR
Attachments
Last edited: