OCC 5.2 to OCC 6.3.0

Hello.

I use Visual C++ 2003, with MFC application and OCC 5.2, and I want to upgrade to OCC 6.3 but I can't compile this source with OCC 6.3.
Here is the source:

void draw_solidblock_3d(Handle_V3d_View view,
Standard_Real *points,
unsigned long color,
unsigned int width,
Standard_Integer m_drawingMode)
{
HPEN m_drawingPen, hPenOld;

if (!view)
return;

Handle(WNT_Window) NTWindow = Handle(WNT_Window)::DownCast(view->Window());
HWND hWindow = ( HWND )NTWindow -> HWindow();
HDC hDC = GetDC (hWindow);

int oldDrawingMode = SetROP2(hDC, m_drawingMode);
m_drawingPen = CreatePen(PS_SOLID, width, color);
hPenOld = (HPEN) SelectObject(hDC, m_drawingPen);

SelectObject(hDC, hPenOld);
SetROP2(hDC, oldDrawingMode);
DeleteObject(m_drawingPen);

ReleaseDC(hWindow, hDC);
}

I don't know what is the problem because if I change the CASROOT from OCC5.2 to OCC6.3 I can't compile this fragment, it came with the following errors:

drawers\3Dsolid.cpp(32) : error C3861: 'GetDC': identifier not found, even with argument-dependent lookup
drawers\3Dsolid.cpp(34) : error C3861: 'SetROP2': identifier not found, even with argument-dependent lookup
drawers\3Dsolid.cpp(35) : error C2065: 'PS_SOLID' : undeclared identifier
drawers\3Dsolid.cpp(35) : error C3861: 'CreatePen': identifier not found, even with argument-dependent lookup
drawers\3Dsolid.cpp(36) : error C3861: 'SelectObject': identifier not found, even with argument-dependent lookup
drawers\3Dsolid.cpp(39) : error C3861: 'SelectObject': identifier not found, even with argument-dependent lookup
drawers\3Dsolid.cpp(40) : error C3861: 'SetROP2': identifier not found, even with argument-dependent lookup
drawers\3Dsolid.cpp(41) : error C3861: 'DeleteObject': identifier not found, even with argument-dependent lookup
drawers\3Dsolid.cpp(43) : error C3861: 'ReleaseDC': identifier not found, even with argument-dependent lookup

Best regards. Sandor.

Roman Lygin's picture

Hi Sandor,

All these are part of Win32 API, so unless you make any others changes (e.g. switched to another Visual Studio version), this may attributed to how is included. Once I had some collisions with windows.h and how it gets included through Standard_Macro.hxx and as far as I remember I ended up using the /E compiler option (if it's that) which outputs a preprocessor result before submitting to compiler. Parsing its output you can see where those functions are defined in context of 6.3 and 5.2.

Good luck !
Roman
---
opencascade.blogspot.com - the Open CASCADE blog
www.cadexchanger.com - CAD Exchanger, your 3D data translator

Biro Sandor's picture

Thank you very much for your help. It's working what are you described, now I must figure out what is the problem.

Best regards! Sandor.