I am not sure where you want to display bitmap.. if you want to display bitmap on dialog then you dont need to retrieve handle of parent window.....

From your code you are calling ShowBitmap from OnPaint.. but your OnPaint handler is never invoked from OnBnClickedBopen().. to execute OnPaint() you need to call Invalidate() function from OnBnClickedBopen().