for e.g, if my HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run has no entries, it will just lag me right down, its like its in an endless loop or something.
Erm... No. The problem lies in the bas module, because there's little to no error checking in it. In this case the call has failed because of an empty subkey. If you look at the module's code:-
VB Code:
If RegEnumKeyEx(hKey, Cnt, sSave, 255, 0, vbNullString, ByVal 0&, ByVal 0&) <> 0 Then
Exit Do
Else
it's saying "if it fails, exit". So the form's code never gets anything returned to it, so that in turn fails - with a different error. Either way you have to find out why RegEnumKeyEx failed and compensate for it.
Due to Hack already telling me off for daring to suggest it in another post, I can't recommend it. But for testing purposes... . What the bas module lacks is an error function to handle all the errors raised in all the subs/functions, i.e, the call might fail because of a corrupted keyname rather than the subkey being empty. (It happens - I remember when I'd installed a faulty memory stick in a PC...)
EDIT:- Remember though, all OERN does is hide a problem, not remove it.
Last edited by schoolbusdriver; Jul 2nd, 2006 at 03:41 AM.