The question mark part is the device you'll be creating - it's an out parameter, so... m_pDInput.CreateDevice(GUID_SysKeyboard, FKeyboardDevice, NIL);

where FKeyboardDevice is a IDirectInputDevice8, or whatever. You'd then use the keyboard device var to access the keyboard. Your input variable should be declared as IDirectInput (maybe a specific version, like IDirectInput8 - can't remember).

As a style note, Hungarian notation ("m_p") is frowned upon in the Delphi community. If possible, avoid it (although I understand that you may well be taking it from C++ example code).