I only know from http://phpforms.net/tutorial/tutorial.html that when a Wordpress plugin becomes active, it might be interesting to do some processing (such as database creation, options filling, and so on…). To do so, Wordpress is providing a very usefull function that will enable you to call your own initialisation function. It’s called register_activation_hook($file,$function);
This function takes these two parameters:
•$file : the file where is located the function to call
•$function: the name of the function to call
So you will only need to declare previous line with corresponding parameters and, of course, to have your function ready. Anything present inside this function will be executed by Wordpress engine at plugin activation time, and only at this moment. Of course, counterpart function exists, and is called register_deactivation_hook($file, $function);.
When calling register_activation_hook, you can use the __FILE__ constant value which describes current file.