# Editing the Source Code (Part 1)

In the file <Project name>.cpp, perform the following steps:

1. Add #include <vision/core/Implementation/VisionInit.hpp> below the existing #include section.

2. Add Cognex::Vision::VisionInit::Init(); before the dialog DoModal method is called in InitInstance.

3. Add Cognex::Vision::VisionInit::Shutdown(); after the dialog DoModal method returns in InitInstance

   For example:

   Copy

       BOOL CMFCApplication1App::InitInstance()
       {
       ...
       Cognex::Vision::VisionInit::Init();

       CMFCApplication1Dlg dlg;
       m_pMainWnd = &dlg;
       INT_PTR nResponse = dlg.DoModal();
       ...
       Cognex::Vision::VisionInit::Shutdown();

In the dialog header file <Project name>Dlg.h, add #include <vision/Display/RecordCollectionDisplay.hpp> below the #pragma once at the top of the file.

In the header file framework.h:

1. Add the following lines at the top below #pragma once:

   Copy

       #ifndef min
       #define min(x,y) ((x) < (y) ? (x) : (y))
       #endif

       #ifndef max
       #define max(x,y) ((x) > (y) ? (x) : (y))
       #endif

2. Add the following lines at the end of the file:

   Copy

       #undef min
       #undef max

In the precompiled header file pch.h, add the following lines below #include "framework.h":

Copy

    #include <vision/core/Circle.hpp>
    #include <vision/core/CircularArc.hpp>
    #include <vision/core/CircularAnnulusSection.hpp>
    #include <vision/core/CompositeShape.hpp>
    #include <vision/core/CoordinateAxes.hpp>
    #include <vision/core/Ellipse.hpp>
    #include <vision/core/EllipticalAnnulusSection.hpp>
    #include <vision/core/EllipticalArc.hpp>
    #include <vision/core/Font.hpp>
    #include <vision/core/GeneralContour.hpp>
    #include <vision/core/GeneralContourSegmentIterator.hpp>
    #include <vision/core/GraphicCollection.hpp>
    #include <vision/core/GraphicInteractiveCollection.hpp>
    #include <vision/core/GraphicLabel.hpp>
    #include <vision/core/IGraphic.hpp>
    #include <vision/core/IGraphicInteractive.hpp>
    #include <vision/core/IImage.hpp>
    #include <vision/core/IImage16PixelMemory.hpp>
    #include <vision/core/IImage8PixelMemory.hpp>
    #include <vision/core/Image16Grey.hpp>
    #include <vision/core/Image24PlanarColor.hpp>
    #include <vision/core/Image8Grey.hpp>
    #include <vision/core/ImageDataModeConstants.hpp>
    #include <vision/core/Line.hpp>
    #include <vision/core/LineSegment.hpp>
    #include <vision/core/MaskGraphic.hpp>
    #include <vision/core/VisionInit.hpp>
    #include <vision/core/PointMarker.hpp>
    #include <vision/core/Polygon.hpp>
    #include <vision/core/Rectangle.hpp>
    #include <vision/core/RectangleAffine.hpp>
    #include <vision/core/Serializer.hpp>
    #include <vision/core/StringCollection.hpp>
    #include <vision/core/Transform2DComposed.hpp>
    #include <vision/core/Transform2DRigid.hpp>
    #include <vision/ImageFile/ImageFile.hpp>
    #include <vision/ImageFile/ImageFileTool.hpp>
    #include <vision/Implementation/Record.hpp>