General Musharraf seized power in a bloodless coup in October , 1999 , appointed himself president in June , 2001 , and won a heavily criticized referendum in April , 2002 .