First, get the patch that allows d3d9.dll to work in SA-MP 

 You can get it from MadMax's old post, here: 
[link]Next (important 

), if you currently have your GTA at max resolution please lower it down 'cause if you will run windowed mode in your max resolution a big window will just fill your screen 

 (800x600 is recommended for people who run it at 1280x1024 at max 

)
Lastly, download this: 
[link]Place the custom d3d9.dll in your SA-MP dir and your done! 

 (If you want to revert back to fullscreen just remove/rename the d3d9.dll from your dir 

)