INTERNAL COMPILER ERROR

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: kalaichris (kalaichris_at_discussions.microsoft.com)
Date: 02/16/05


Date: Wed, 16 Feb 2005 10:53:04 -0800

these are my codes for image processing...im not sure why im getting this "
INTERNAL COMPILER ERROR". pls help me...and pls do tell me whether if i
continue with this codes, will i be able to perform thinning and edge
detection..i have problems in developing the codes..pls do help me and i
sincerely appreciate all the helps..thank you...

#include "stdafx.h"
#include "fvas.h"
#include "fvasDlg.h"
#include <math.h>

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About

class CAboutDlg : public CDialog
{
public:
        CAboutDlg();

// Dialog Data
        //{{AFX_DATA(CAboutDlg)
        enum { IDD = IDD_ABOUTBOX };
        //}}AFX_DATA

        // ClassWizard generated virtual function overrides
        //{{AFX_VIRTUAL(CAboutDlg)
        protected:
        virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
        //}}AFX_VIRTUAL

// Implementation
protected:
        //{{AFX_MSG(CAboutDlg)
        //}}AFX_MSG
        DECLARE_MESSAGE_MAP()
};

CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
        //{{AFX_DATA_INIT(CAboutDlg)
        //}}AFX_DATA_INIT
}

void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
        CDialog::DoDataExchange(pDX);
        //{{AFX_DATA_MAP(CAboutDlg)
        //}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
        //{{AFX_MSG_MAP(CAboutDlg)
                // No message handlers
        //}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CFvasDlg dialog

CFvasDlg::CFvasDlg(CWnd* pParent /*=NULL*/)
        : CDialog(CFvasDlg::IDD, pParent)
{
        //{{AFX_DATA_INIT(CFvasDlg)
                // NOTE: the ClassWizard will add member initialization here
        //}}AFX_DATA_INIT
        // Note that LoadIcon does not require a subsequent DestroyIcon in Win32
        m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

void CFvasDlg::DoDataExchange(CDataExchange* pDX)
{
        CDialog::DoDataExchange(pDX);
        //{{AFX_DATA_MAP(CFvasDlg)
                // NOTE: the ClassWizard will add DDX and DDV calls here
        //}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CFvasDlg, CDialog)
        //{{AFX_MSG_MAP(CFvasDlg)
        ON_WM_SYSCOMMAND()
        ON_WM_PAINT()
        ON_WM_QUERYDRAGICON()
        ON_BN_CLICKED(IDC_BUTTON1_DISPLAY, OnDisplay)
        ON_BN_CLICKED(IDC_STATIC_BITMAP, OnStaticBitmap)
        //}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CFvasDlg message handlers

BOOL CFvasDlg::OnInitDialog()
{
        CDialog::OnInitDialog();

        // Add "About..." menu item to system menu.

        // IDM_ABOUTBOX must be in the system command range.
        ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
        ASSERT(IDM_ABOUTBOX < 0xF000);

        CMenu* pSysMenu = GetSystemMenu(FALSE);
        if (pSysMenu != NULL)
        {
                CString strAboutMenu;
                strAboutMenu.LoadString(IDS_ABOUTBOX);
                if (!strAboutMenu.IsEmpty())
                {
                        pSysMenu->AppendMenu(MF_SEPARATOR);
                        pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
                }
        }

        // Set the icon for this dialog. The framework does this automatically
        // when the application's main window is not a dialog
        SetIcon(m_hIcon, TRUE); // Set big icon
        SetIcon(m_hIcon, FALSE); // Set small icon
        
        // TODO: Add extra initialization here
        
        return TRUE; // return TRUE unless you set the focus to a control
}

void CFvasDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
        if ((nID & 0xFFF0) == IDM_ABOUTBOX)
        {
                CAboutDlg dlgAbout;
                dlgAbout.DoModal();
        }
        else
        {
                CDialog::OnSysCommand(nID, lParam);
        }
}

// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.

void CFvasDlg::OnPaint()
{
        if (IsIconic())
        {
                CPaintDC dc(this); // device context for painting

                SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);

                // Center icon in client rectangle
                int cxIcon = GetSystemMetrics(SM_CXICON);
                int cyIcon = GetSystemMetrics(SM_CYICON);
                CRect rect;
                GetClientRect(&rect);
                int x = (rect.Width() - cxIcon + 1) / 2;
                int y = (rect.Height() - cyIcon + 1) / 2;

                // Draw the icon
                dc.DrawIcon(x, y, m_hIcon);
        }
        else
        {
                CDialog::OnPaint();
        }
}

// The system calls this to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CFvasDlg::OnQueryDragIcon()
{
        return (HCURSOR) m_hIcon;
}

void CFvasDlg::OnDisplay()
{
        // TODO: Add your control notification handler code here
        static char BASED_CODE szFilter[] = "Bitmap Files (*.bmp) |*.bmp||";
        
        CString m_sBitmap;
        CFileDialog m_ldFile(TRUE, ".bmp", m_sBitmap, OFN_HIDEREADONLY |
OFN_OVERWRITEPROMPT, szFilter);

        if (m_ldFile.DoModal() == IDOK)
        {
                m_sBitmap = m_ldFile.GetPathName();

                HBITMAP hBitmap = (HBITMAP) ::LoadImage(AfxGetInstanceHandle(), m_sBitmap,
IMAGE_BITMAP, 100,140, LR_LOADFROMFILE | LR_CREATEDIBSECTION);

                HBITMAP hGrayBitmap = (HBITMAP) ::LoadImage(AfxGetInstanceHandle(),
m_sBitmap, IMAGE_BITMAP, 100,140, LR_LOADFROMFILE | LR_CREATEDIBSECTION);

                HBITMAP hGrayBitmap1 = (HBITMAP) ::LoadImage(AfxGetInstanceHandle(),
m_sBitmap, IMAGE_BITMAP, 100,140, LR_LOADFROMFILE | LR_CREATEDIBSECTION);

                BITMAP bm;
                BITMAP bm1;

                GetObject(hGrayBitmap, sizeof(BITMAP), (LPSTR)&bm);

                typedef struct tagBITMAP
                                {
                                        LONG bmType;
                                        LONG bmWidth;
                                        LONG bmHeight;
                                        LONG bmWidthBytes;
                                        WORD bmPlanes;
                                        WORD bmBitsPixel;
                                        LPVOID bmBits;
                                }
                        BITMAP, *PBITMAP;

                if (hGrayBitmap)
                {
                        CStatic *pImgPicture = (CStatic*)GetDlgItem(IDC_STATIC_BITMAP);
                        BYTE * pImgByte = (BYTE *) bm.bmBits;
                        
                        
                        if(pImgPicture==NULL)
                        {
                                AfxMessageBox("Fail to get Picture Control");
                        }
                        else
                        {

                                INT iWidthBytes = bm.bmWidth * 3;

                                for ( int y = 0; y < bm.bmHeight; y++)
                                {
                                        for ( int x = 0; x < bm.bmWidth*3; x++)
                                        {

                                                unsigned char R = pImgByte[y*iWidthBytes+x+2];
                                                unsigned char G = pImgByte[y*iWidthBytes+x+1];
                                                unsigned char B = pImgByte[y*iWidthBytes+x];;

                                                INT gray = ceil(0.3*R + 0.59*G + 0.11*B);

                                                pImgByte[y*iWidthBytes+x+2] = gray;
                                                pImgByte[y*iWidthBytes+x+1] = gray;
                                                pImgByte[y*iWidthBytes+x] = gray;
                                        }

                                }

                                void threshold (struct Image *bm, struct Image *bm1, int THRES)
                                {
                                        int X, Y, GO, GB;
                                        GO= 225;
                                        GB= 0;

                                        for (Y=0; Y<=bm.bmHeight; Y++)
                                        {
                                                for (X=0; X<=bm.bmWidth*3; X++)
                                                {
                                                        if (*(bm.bmBitsPixel + X + (long) Y * bm.bmWidth*3) > THRES)
                                                                *(bm1.bmBitsPixel + X + (long) Y * bm.bmWidth*3) = GO;
                                                        else
                                                                *(bm1.bmBitsPixel + X + (long) Y * bm.bmWidth*3) = GB;
                                                }
                                        }
                                }

                                pImgPicture->SetBitmap(hGrayBitmap);
                        }
                                
                }
        }
        

}



Relevant Pages

  • Just a simple tree view
    ... // treeviewDlg.cpp: implementation file ... BEGIN_MESSAGE_MAP(CAboutDlg, CDialog) ... void CTreeviewDlg::DoDataExchange ... void CTreeviewDlg::OnSysCommand(UINT nID, LPARAM lParam) ...
    (comp.lang.cpp)
  • Re: how to avoid to size the dialog when soft-keyboard is on
    ... CWnd parent methods instead of CDialog one's. ... void CMyDialog::OnSettingChange(UINT uFlags, LPCTSTR lpszSection) ... CWnd::OnSettingChange(uFlags, lpszSection); ... void CMyDialog::OnActivate ...
    (microsoft.public.pocketpc.developer)
  • Re: how to avoid to size the dialog when soft-keyboard is on
    ... basic CWnd parent methods instead of CDialog one's. ... CWnd::OnSettingChange(uFlags, lpszSection); ... void CMyDialog::OnActivate ...
    (microsoft.public.pocketpc.developer)
  • how to explain the thread3 from the Bengining Linux Programming 3rd edition.
    ... that, he changes some about the thread3.c, below is the codes after ... can semaphore get increased since work_area value has changed, ... void *thread_function; ...
    (comp.os.linux.development.apps)
  • Re: how to implement IBindingList
    ... But problem is no sample codes. ... Just don't know how to start coding for ... >> void IBindingList.ApplySort(PropertyDescriptor property, ListSortDirection ...
    (microsoft.public.dotnet.languages.csharp)