开发者

Why the following c++ snippet gives exception?

VIDEOINFOHEADER *pVih = (VIDEOINFOHEADER*)pmtConfig->pbFormat;;
...
WriteFile( hHand开发者_运维技巧le, pVih, sizeof(VIDEOINFOHEADER), NULL, NULL );

Through debugging I found WriteFile reports exception, how to solve it?


Probably, pmtConfig->pbFormat is NULL or invalid. Give us more details on exception, please.


Is pVih initialized? If not, that's your problem.

follow up

Since pVih is initialized, I looked at the documentation. The fourth parameter, lpNumberOfBytesWritten, cannot be NULL if the fifth parameter, lpOverlapped, is NULL. Provide a pointer to a variable to accept the number of bytes written.

second follow up

Is pmtConfig->pbFormat properly pointing to a VIDEOINFOHEADER?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜