Stuart McLachlan
stuart at lexacorp.com.pg
Mon May 23 14:08:15 CDT 2011
Like I said just now - it's a kludge. It only works under certain conditions, and is certainly not a foolproof technique for setting/unsetting PW protection on code :-( -- Stuart On 23 May 2011 at 10:53, jwcolby wrote: > Using this code I succeeded in opening my two frameworks and setting > the module passwords in those, however doing so in the application > causes the app to open and the startup code to run, which opens a > login form (as it should on opening). > > It's always something! > > John W. Colby > www.ColbyConsulting.com > > On 5/23/2011 9:49 AM, jwcolby wrote: > > What I want to know is how does he figure out the name of the > > objects? for example... > > > > ' Get hWnd for Password Edit control in Project Properties dialog > > hWndPassword = GetDlgItem(hWndProjectProperties, ControlIDPassword) > > > > > > How does he discover that ControlIDPassword is the name of an object > > > > The following is the business end of manipulating the dialog to > > cause it to go to the correct tab, enter data into the password > > boxers and clicking the button. > > > > ' Get hWnd for OK button in Project Properties dialog > > hWndOK = GetDlgItem(hWndProjectProperties, ControlIDOK) > > ' Get hWnd for Tab Control in Project Properties dialog > > hWndSysTabControl32 = GetDlgItem(hWndProjectProperties, > > ControlIDSysTabControl32) > > > > 'Move to Protection tab > > SendMessage hWndSysTabControl32, TCM_SETCURFOCUS, 1, ByVal 0& > > > > ' Must reset hWndProjectProperties probably because tab changed. > > EnumChildWindows ByVal hWndProjectProperties, AddressOf > > EnumChildProc, ByVal 0 > > > > ' Get hWnd for Password Edit control in Project Properties dialog > > hWndPassword = GetDlgItem(hWndProjectProperties, ControlIDPassword) > > ' Get hWnd for Confirm Password Edit control in Project Properties > > dialog hWndConfirmPassword = GetDlgItem(hWndProjectProperties, > > ControlIDConfirmPassword) ' Get hWnd for Lock Project checkbox > > control in Project Properties dialog hWndLockProject = > > GetDlgItem(hWndProjectProperties, ControlIDLockProject) > > > > ' Lock project for &viewing > > SendMessage hWndLockProject, BM_SETCHECK, BST_CHECKED, 0 > > > > ' &Password > > SendMessage hWndPassword, EM_REPLACESEL, vbTrue, ByVal strPassword > > > > ' &Confirm password > > SendMessage hWndConfirmPassword, EM_REPLACESEL, vbTrue, ByVal > > strPassword > > > > > > John W. Colby > > www.ColbyConsulting.com > > > > On 5/23/2011 9:22 AM, jwcolby wrote: > >> I am hot on the trail for code to do this. > >> > >> http://www.standards.com/Office/SetVBAProjectPassword.html > >> > >> It requires manipulating windows to get the dialog as it pops up > >> and then pushing data to that and clicking on things in the dialog. > >> Actually cool stuff to know. > >> > >> John W. Colby > >> www.ColbyConsulting.com > >> > >> On 5/23/2011 12:12 AM, Stuart McLachlan wrote: > >>> I don't think so. I've never come across anything that can do > >>> that, > >>> > >>> The actual Password can be *changed* from an external application. > >>> I have a "cracker" application which does exactly that > >>> > >>> http://www.systoolsgroup.com/vba-password-remover.html. > >>> > >>> It doesn't "remove" VBA passwords, it resets them to a standard > >>> password (possibly just be writing a different hash value > >>> somewhere in the .mdb) so that you can go in and unset it yourself > >>> after entering the new password. Based on the fact that similar > >>> utilities work in the same way, I'd guess that setting/unsetting a > >>> PW is a far more difficult task. > >>> > >>> > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com >