Your function should compile, but won't link if you haven't linked to dxguid.lib. What version of the DX sdk do you have ? The code below compiles and links -
Code:
#pragma comment(lib,"ddraw.lib")
#pragma comment(lib,"dxguid.lib")
#include <ddraw.h>
LPDIRECTDRAW lpDD;
LPDIRECTDRAW4 lpDD4;
int main(){
DirectDrawCreate(0,&lpDD,NULL);
lpDD->QueryInterface(IID_IDirectDraw4,(LPVOID*)&lpDD4);
lpDD->Release();
//Do stuff
lpDD4->Release();
return 0;
}
Also, you may want ditch whatever you're learning this from for something more up to date, as the later versions of Direct X provide an easier method to obtain the correct interface (even though this way should still work).