First thing you need to know is User Mode and Kernel Mode execution. Your program is user-mode program, and cannot directly access the hardware. To access the hardware, you program must be executing the instruction in kernel-mode. Device drives, for example run in kernel mode, and they need installation (Driver installation, heard this term?).
See Task Manager 'Show Kernel Times' - find yourself where it is!
Device drives are nothing but services (cannot be seen from services.exe, but can be enumerated using
Service Functions[
^].
Therefore you need to learn (study, read!), about user-mode and kernel-mode, and how they fit in with services. Start writing your own service (not device driver), and then jump to device-driver development if you can.