Hello I put your function in wapi_commcgtrl.c and compiled it with MSVC 2008 and got only this warning:
c:\harbour\contrib\hbwin\wapi_commctrl.c(820) : warning C4701: potentially uninitialized local variable 'hOldPen' used Rest it got compiled properly. Are you saying that you receive run/time error ? And what is C2440 error ? So to refine your code: HB_FUNC( BOXEX ) { HDC hDC = (HDC) hb_parnl( 1 ); RECT rc; HBRUSH hOldBrush = NULL; HPEN hPen = NULL; HPEN hOldPen = NULL; rc.top = hb_parni( 2, 1); rc.left = hb_parni( 2, 2); rc.bottom = hb_parni( 2, 3); rc.right = hb_parni( 2, 4); if( hb_pcount() > 2 ) { hPen = CreatePen( PS_SOLID, 1, hb_parnl( 3 ) ); hOldPen = SelectObject( hDC, (HPEN) hPen ); // Here in this line, occurs a C2440 error } hOldBrush = SelectObject( hDC, (HBRUSH) GetStockObject( NULL_BRUSH ) ); Rectangle( hDC, rc.left, rc.top, rc.right, rc.bottom ); SelectObject( hDC, (HBRUSH) hOldBrush ); if( hPen != NULL ) { SelectObject( hDC, (HPEN) hOldPen ); DeleteObject( hPen ); } hb_ret(); } Try above and please report back the results. You are using uniitialized variables which are not acceptable to MSVC. Regards Pritpal Bedi -- View this message in context: http://www.nabble.com/Compiling-C-sources-tp22338265p22360095.html Sent from the Harbour - Dev mailing list archive at Nabble.com. _______________________________________________ Harbour mailing list Harbour@harbour-project.org http://lists.harbour-project.org/mailman/listinfo/harbour