I assume you are using an event handler, something like:
protected void imgMyMedia_OnClicked(object sender, EventArgs e) { your code }
In that case, you can cast the sender object to your control type, and read any parameter set there. I recon it would be something like this:
MediaControl myMedia = (MediaControl)sender;
int ID = myMedia.MediaId;
or something similar. I am not familiar with the umbraco code and can not be as precise, but this should be about right.