Download the source package
You should get the source package of the module you want to modify. For DNN official module, source package shipped with PA package in the sometime, for third part module, if it's open source, you can find a source package on it's website.
For example, DNN official Announcement module:

Install the source package
There is no different between PA installation and Source package installation, just go to the Module Definition page and upload the ZIP file. If it's a standard DNN official source package, all source file will be upload an put in appropriate location. If it's a third party module, please make sure all source files have been uploaded, if not, you can manually unzip the source package and overwrite the module's folder under DesktopModules folder.
The picture below is the DesktopModules/Announcement folder after installing the Announcement module source package:

Add the project to Visual Studio
At first, you should build up you DNN development environment, then, right click at your DNN Solution and select "Add->Existing Project"

Browse to Announcement folder,select the DotNetNuke.Announcements.vbproj and add it.

After that,DesktopModules\Announcement project will be added:

For most module, there will be a DataProvider project. you must add this DAL (Data Access Layer) project too. Browse to DesktopModules\Announcement\Providers\DataProviders\SqlDataProvider folder, add SqlDataProvider project:

It's time to build your project
After add this project to your solution, it's time to build it. Right click at DotNetNuke.Announcements project and select “Rebuild”, soon, you get the "Rebuild All succeeded" message:

Opss.. I get a compiling error
If you download the source package of DNN official module, compiling error most time is caused by the low DNN version of you DNN development environment. Please recheck all the references in your added project (such as Announcement module) .
If you use the third part module, please try to debug based one compiling error message, if you find it's not a simple error, such a wrong reference to a old DNN version, etc. you'd better contact author of this module at first.