Tried deleting your .ini and .cfg files? (or at least renaming/moving them)
Start with a clean installation, even try placing mameui in a new, empty folder.
If everything fails, then you might:
a)Have a corrupted OS, missing Dlls and/or required runtimes.
b)Bad RAM. use memtest
c)Bad HD. test it.