Disassemble ea. Returns the length of the instruction in bytes and fills the global cmd structure with information about the instruction. If ea doesn't contain an instruction, 0 is returned. This is a read-only function and doesn't modify the IDA database.
#include <kernwin.hpp> // For get_screen_ea() definition
ea_t ea = get_screen_ea();
if (ua_ana0(ea) > 0)
msg("Instruction size: %d bytes\n", cmd.size);
msg("Not at an instruction.\n");