Problem with Devices
Solved ^^ i have never Declared the device for that functions xD
in your second picture- where is pDevice specified?
Its telling you you're using pDevice, but it's never declared/created, so since you mention this is based on some other code i'd compare the original to yours - you probably deleted a line by accident where pDevice is declared