Comparing files V3105\Mainfrm.cpp and V3032\MAINFRM.CPP
***** V3105\Mainfrm.cpp

#include <windowsx.h> 

***** V3032\MAINFRM.CPP

#include <windows.h>
#include <windowsx.h> 
#include <mmsystem.h>
#include <mmreg.h>

*****

***** V3105\Mainfrm.cpp
#include "Dib.h"
#include <windows.h>
#include <mmsystem.h>
#include <mmreg.h>
#include "Eztwain.h"
***** V3032\MAINFRM.CPP
#include "Dib.h"
#include "Eztwain.h"
*****

***** V3105\Mainfrm.cpp

#include <afxdisp.h>

***** V3032\MAINFRM.CPP


*****

***** V3105\Mainfrm.cpp

// Belkin:      {4D36E96C-E325-11CE-BFC1-08002BE10318}
// {17CCA71B-ECD7-11D0-B908-00A0C9223196}
***** V3032\MAINFRM.CPP

// Belkin:  {4D36E96C-E325-11CE-BFC1-08002BE10318}
// {17CCA71B-ECD7-11D0-B908-00A0C9223196}
*****

***** V3105\Mainfrm.cpp
/*Multimedia
        Class = Media
        ClassGuid = {4d36e96c-e325-11ce-bfc1-08002be10318}

        This class includes Audio and DVD multimedia devices, joystick ports, and full-motion video capture devices. 
*/
***** V3032\MAINFRM.CPP
/*Multimedia
    Class = Media
    ClassGuid = {4d36e96c-e325-11ce-bfc1-08002be10318}

    This class includes Audio and DVD multimedia devices, joystick ports, and full-motion video capture devices. 
*/
*****

***** V3105\Mainfrm.cpp
#include <initguid.h>
//DEFINE_GUID(GUID_BELKINAUDIO, 0x4D36E96C, 0xE325, 0x11CE, 0xBF, 0xC1, 0x08,
                        //0x00, 0x2B, 0xE1, 0x03, 0x18);
//DEFINE_GUID(GUID_BELKINAUDIO1, 0x17CCA71B, 0xECD7, 0x11D0, 0xB9, 0x08, 0x00,
                        //0xA0, 0xC9, 0x22, 0x31, 0x96);

***** V3032\MAINFRM.CPP
#include <initguid.h>
DEFINE_GUID(GUID_BELKINAUDIO, 0x4D36E96C, 0xE325, 0x11CE, 0xBF, 0xC1, 0x08,
            0x00, 0x2B, 0xE1, 0x03, 0x18);
DEFINE_GUID(GUID_BELKINAUDIO1, 0x17CCA71B, 0xECD7, 0x11D0, 0xB9, 0x08, 0x00,
            0xA0, 0xC9, 0x22, 0x31, 0x96);

*****

***** V3105\Mainfrm.cpp

#define MMCAPS_DEVTYPE_WAVEIN           7


double Flecksgain = .0014;
double PARgain=0.00055;

***** V3032\MAINFRM.CPP

#define MMCAPS_DEVTYPE_WAVEIN       7

*****

***** V3105\Mainfrm.cpp

UINT PARThreadProc(LPVOID pParam);

typedef struct{
        double PAR;
        double Flecks;
        int measure;
        int count;
        bool bTESTOUT;
} PARFlecks;

   PARFlecks * pPARFlecks;
   PARFlecks PARFlecksValue;

   double PAR,Flecks;

CMainFrame* mainFrame;
***** V3032\MAINFRM.CPP

CMainFrame* mainFrame;
*****

***** V3105\Mainfrm.cpp
        ON_COMMAND(ID_ACQUIRE, OnAcquire)
//      ON_UPDATE_COMMAND_UI(ID_SUNFLECKS, OnUpdateAcquire)
        ON_COMMAND(ID_SUNFLECKS, OnSunflecks)
        ON_UPDATE_COMMAND_UI(ID_SELECT_SOURCE, OnUpdateSelectSource)
***** V3032\MAINFRM.CPP
        ON_COMMAND(ID_ACQUIRE, OnAcquire)
        ON_UPDATE_COMMAND_UI(ID_SELECT_SOURCE, OnUpdateSelectSource)
*****

***** V3105\Mainfrm.cpp
        ON_UPDATE_COMMAND_UI(ID_ACQUIRE_CLIPBOARD, OnUpdateAcquireClipboard)
        ON_MESSAGE(WM_USERAPPLY, OnUserApply)
        ON_COMMAND(IDC_IMAGE_MEASURE, OnImageMeasure)
***** V3032\MAINFRM.CPP
        ON_UPDATE_COMMAND_UI(ID_ACQUIRE_CLIPBOARD, OnUpdateAcquireClipboard)
    ON_MESSAGE(WM_USERAPPLY, OnUserApply)
        ON_COMMAND(IDC_IMAGE_MEASURE, OnImageMeasure)
*****

***** V3105\Mainfrm.cpp
{
        ID_SEPARATOR,                   // status line indicator
};
***** V3032\MAINFRM.CPP
{
        ID_SEPARATOR,           // status line indicator
};
*****

***** V3105\Mainfrm.cpp
{
        CWinThread * PAR_Thread;

        mainFrame = this;
***** V3032\MAINFRM.CPP
{
        mainFrame = this;
*****

***** V3105\Mainfrm.cpp
        ReadConfigFile();
        pPARFlecks=     (PARFlecks*)&PARFlecksValue;
        PARFlecksValue.measure=0;      // OnAquire sets this to 1 to start the PAR measurement
        PARFlecksValue.count=0;
        PARFlecksValue.bTESTOUT=FALSE; //set to true if you want to save a .wav file for the first buffer of audio
        PAR_Thread = AfxBeginThread( PARThreadProc,(LPVOID) pPARFlecks,THREAD_PRIORITY_TIME_CRITICAL);

}
***** V3032\MAINFRM.CPP
        ReadConfigFile();
}
*****

***** V3105\Mainfrm.cpp
{
        FILE    *fp;
        char    version[32];

        if( ( fp = fopen( "ci110.cfg", "r" ) ) == NULL )
        {
***** V3032\MAINFRM.CPP
{
    FILE    *fp;
    char    version[32];

    if( ( fp = fopen( "ci110.cfg", "r" ) ) == NULL )
        {
*****

***** V3105\Mainfrm.cpp
        if(strncmp(version, VERSION, 6)) {
                configChanged = TRUE;   /* Need a new config file                               */
                if(strncmp(version,"V3.0.1", 6)==0) // old version, so load old config file
***** V3032\MAINFRM.CPP
        if(strncmp(version, VERSION, 6)) {
                configChanged = TRUE;   /* Need a new config file               */
                if(strncmp(version,"V3.0.1", 6)==0) // old version, so load old config file
*****

***** V3105\Mainfrm.cpp
                        fscanf(fp, "Threshold level (%%)  : %d\n", &ci_config_geometry->threshhold_level );
                        fscanf(fp, "PARzerocal       : %lf\n", &ci_config_geometry->PARzerocal );

***** V3032\MAINFRM.CPP
                        fscanf(fp, "Threshold level (%%)  : %d\n", &ci_config_geometry->threshhold_level );
                        fscanf(fp, "PARcalibration       : %lf\n", &ci_config_geometry->PARcalibration );

*****

***** V3105\Mainfrm.cpp
                        // as 800x600, the image size is set to 640x480
                        // as of 3040 768x494
                        int tmpx = 0, tmpy = 0;
***** V3032\MAINFRM.CPP
                        // as 800x600, the image size is set to 640x480
                        int tmpx = 0, tmpy = 0;
*****

***** V3105\Mainfrm.cpp
                        fscanf(fp, "Image Height         : %d\n", &tmpy);

                        if (tmpx == 800 && tmpy == 600)
***** V3032\MAINFRM.CPP
                        fscanf(fp, "Image Height         : %d\n", &tmpy);
                        if (tmpx == 800 && tmpy == 600)
*****

***** V3105\Mainfrm.cpp
                        else
                                if(tmpx == 768 && tmpy==494)
                                {
                                   ci_config_image->max_msrbl_image_x = 493;
                                   ci_config_image->max_msrbl_image_y = 493;
                                }
                                else

                        {
***** V3032\MAINFRM.CPP
                        else
                        {
*****

***** V3105\Mainfrm.cpp
                }
                else if(strncmp(version,"V3.0.2", 6)==0) // old version, so load old config file
                {
                        fscanf(fp, "Configuration file for CI110 program.\n");
                        fscanf(fp, "Please do not modify by hand.\n\n");
                        fscanf(fp, "\nOption Setup         :\n" );
                        fscanf(fp, "Zenith divisions     : %d\n",  &ci_config_geometry->num_of_zenith_division );
                        fscanf(fp, "Azimuthal divisions  : %d\n",  &ci_config_geometry->num_of_azmuthal_division );
                        fscanf(fp, "Start Zenith Angle   : %d\n",  &ci_config_geometry->starting_zenith_angle);
                        fscanf(fp, "End Zenith Angle     : %d\n",  &ci_config_geometry->ending_zenith_angle);
                        fscanf(fp, "View range (degree)  : %d\n",  &ci_config_geometry->view_range );
                        fscanf(fp, "Blankout flag        : %d\n",  &ci_config_geometry->blankout_flag );
                        fscanf(fp, "Blankout angle 1     : %d\n", &ci_config_geometry->blankout1 );
                        fscanf(fp, "Blankout angle 2     : %d\n", &ci_config_geometry->blankout2 );
                        fscanf(fp, "Threshold level (%%)  : %d\n", &ci_config_geometry->threshhold_level );
                        fscanf(fp, "PARzerocal       : %lf\n", &ci_config_geometry->PARzerocal );
                        fscanf(fp, "Latitude             : %lf\n", &ci_config_geometry->Latitude );
                        fscanf(fp, "Month1               : %d\n", &ci_config_geometry->Month1 );
                        fscanf(fp, "Day1                 : %d\n", &ci_config_geometry->Day1 );
                        fscanf(fp, "Month2               : %d\n", &ci_config_geometry->Month2 );
                        fscanf(fp, "Day2                 : %d\n", &ci_config_geometry->Day2 );
        
                        fscanf(fp, "\nOutput Setup         :\n" );
                        fscanf(fp, "LAI                  : %d\n", &ci_config_output->bLAI);
                        fscanf(fp, "LD                   : %d\n", &ci_config_output->bLD);
                        fscanf(fp, "MFIA                 : %d\n", &ci_config_output->bMFIA);
                        fscanf(fp, "TR                   : %d\n", &ci_config_output->bTR);
                        fscanf(fp, "TD                   : %d\n", &ci_config_output->bTD);
                        fscanf(fp, "K                    : %d\n", &ci_config_output->bK);
                        fscanf(fp, "PAR                  : %d\n", &ci_config_output->bPAR);
                        fscanf(fp, "SUN TRACK            : %d\n", &ci_config_output->bSUNTRACK);

                        fscanf(fp, "\nImage Setup         :\n" );
                        fscanf(fp, "Maximum Radius       : %d\n", &ci_config_image->radius);
                        fscanf(fp, "Camera Center in X   : %d\n", &ci_config_image->center_x);
                        fscanf(fp, "Camera Center in Y   : %d\n", &ci_config_image->center_y);
                        fscanf(fp, "Image type           : %s\n", &ci_config_image->type);
                        // Handling new image size 800x600. For simplicity, we only handle two
                        // sets of image sizes, 800x600 and 640x480. If the size is not specified
                        // as 800x600, the image size is set to 640x480
                        // as of 3040 768x494 also handled
                        int tmpx = 0, tmpy = 0;
                        fscanf(fp, "Image Width          : %d\n", &tmpx);
                        fscanf(fp, "Image Height         : %d\n", &tmpy);

                        if (tmpx == 800 && tmpy == 600)
                        {
                                ci_config_image->max_msrbl_image_x = 599;
                                ci_config_image->max_msrbl_image_y = 599;
                        }
                        else
                                if(tmpx == 768 && tmpy==494)
                                {
                                   ci_config_image->max_msrbl_image_x = 493;
                                   ci_config_image->max_msrbl_image_y = 493;
                                }
                                else

                        {
                                ci_config_image->max_msrbl_image_x = min(DEFAULT_MAX_IMAGE_X, DEFAULT_MAX_IMAGE_Y);
                                ci_config_image->max_msrbl_image_y = ci_config_image->max_msrbl_image_x;
                        }
        
                }
                fclose(fp);
***** V3032\MAINFRM.CPP
                }
                fclose(fp);
*****

***** V3105\Mainfrm.cpp

        configChanged = FALSE;          /* Load config file                                     */

***** V3032\MAINFRM.CPP

        configChanged = FALSE;      /* Load config file                     */

*****

***** V3105\Mainfrm.cpp
        fscanf(fp, "Threshold level (%%)  : %d\n", &ci_config_geometry->threshhold_level );
        fscanf(fp, "PARzerocal           : %lf\n", &ci_config_geometry->PARzerocal );
        fscanf(fp, "PARspancal           : %lf\n", &ci_config_geometry->PARspancal );
        fscanf(fp, "Fleckszerocal         : %lf\n", &ci_config_geometry->Fleckszerocal );
        fscanf(fp, "Flecksspancal         : %lf\n", &ci_config_geometry->Flecksspancal );
        fscanf(fp, "Latitude             : %lf\n", &ci_config_geometry->Latitude );
***** V3032\MAINFRM.CPP
        fscanf(fp, "Threshold level (%%)  : %d\n", &ci_config_geometry->threshhold_level );
        fscanf(fp, "PARcalibration       : %lf\n", &ci_config_geometry->PARcalibration );
        fscanf(fp, "Latitude             : %lf\n", &ci_config_geometry->Latitude );
*****

***** V3105\Mainfrm.cpp
        // as 800x600, the image size is set to 640x480
        // as of 3040 768x494 also handled
        int tmpx = 0, tmpy = 0;
***** V3032\MAINFRM.CPP
        // as 800x600, the image size is set to 640x480
        int tmpx = 0, tmpy = 0;
*****

***** V3105\Mainfrm.cpp
        else
        if (tmpx == 768 && tmpy == 494)
        {
                ci_config_image->max_msrbl_image_x = 493;
                ci_config_image->max_msrbl_image_y = 493;
        }
        else
        {
***** V3032\MAINFRM.CPP
        else
        {
*****

***** V3105\Mainfrm.cpp
{
        FILE    *fp;

***** V3032\MAINFRM.CPP
{
    FILE    *fp;

*****

***** V3105\Mainfrm.cpp

        if( ( fp = fopen( "ci110.cfg", "w" ) ) == NULL )
        {
***** V3032\MAINFRM.CPP

    if( ( fp = fopen( "ci110.cfg", "w" ) ) == NULL )
        {
*****

***** V3105\Mainfrm.cpp
        fprintf(fp, "\nOption Setup         :\n" );
        fprintf(fp, "Zenith divisions     : %d\n",      ci_config_geometry->num_of_zenith_division );
        fprintf(fp, "Azimuthal divisions  : %d\n",      ci_config_geometry->num_of_azmuthal_division );
        fprintf(fp, "Start Zenith Angle   : %d\n",      ci_config_geometry->starting_zenith_angle);
        fprintf(fp, "End Zenith Angle     : %d\n",      ci_config_geometry->ending_zenith_angle);
        fprintf(fp, "View range (degree)  : %d\n",      ci_config_geometry->view_range );
        fprintf(fp, "Blankout flag        : %d\n",      ci_config_geometry->blankout_flag );
        fprintf(fp, "Blankout angle 1     : %d\n", ci_config_geometry->blankout1 );
***** V3032\MAINFRM.CPP
        fprintf(fp, "\nOption Setup         :\n" );
        fprintf(fp, "Zenith divisions     : %d\n",  ci_config_geometry->num_of_zenith_division );
        fprintf(fp, "Azimuthal divisions  : %d\n",  ci_config_geometry->num_of_azmuthal_division );
        fprintf(fp, "Start Zenith Angle   : %d\n",  ci_config_geometry->starting_zenith_angle);
        fprintf(fp, "End Zenith Angle     : %d\n",  ci_config_geometry->ending_zenith_angle);
        fprintf(fp, "View range (degree)  : %d\n",  ci_config_geometry->view_range );
        fprintf(fp, "Blankout flag        : %d\n",  ci_config_geometry->blankout_flag );
        fprintf(fp, "Blankout angle 1     : %d\n", ci_config_geometry->blankout1 );
*****

***** V3105\Mainfrm.cpp
        fprintf(fp, "Threshold level (%%)  : %d\n", ci_config_geometry->threshhold_level );
        fprintf(fp, "PARzerocal           : %2.6f\n", ci_config_geometry->PARzerocal );
        fprintf(fp, "PARspancal           : %2.6f\n", ci_config_geometry->PARspancal );
        fprintf(fp, "Fleckszerocal         : %2.6f\n", ci_config_geometry->Fleckszerocal );
        fprintf(fp, "Flecksspancal         : %2.6f\n", ci_config_geometry->Flecksspancal );
        fprintf(fp, "Latitude             : %2.6f\n", ci_config_geometry->Latitude );
***** V3032\MAINFRM.CPP
        fprintf(fp, "Threshold level (%%)  : %d\n", ci_config_geometry->threshhold_level );
        fprintf(fp, "PARcalibration       : %2.6f\n", ci_config_geometry->PARcalibration );
        fprintf(fp, "Latitude             : %2.6f\n", ci_config_geometry->Latitude );
*****

***** V3105\Mainfrm.cpp
        else
        if (ci_config_image->max_msrbl_image_x == 493)
        {
                fprintf(fp, "Image Width          : %d\n", 768);
                fprintf(fp, "Image Height         : %d\n", 494);
        }
        else
        {
***** V3032\MAINFRM.CPP
        else
        {
*****

***** V3105\Mainfrm.cpp
                TRACE0("Failed to create toolbar\n");
                return -1;              // fail to create
        }
***** V3032\MAINFRM.CPP
                TRACE0("Failed to create toolbar\n");
                return -1;      // fail to create
        }
*****

***** V3105\Mainfrm.cpp
                TRACE0("Failed to create status bar\n");
                return -1;              // fail to create
        }
***** V3032\MAINFRM.CPP
                TRACE0("Failed to create status bar\n");
                return -1;      // fail to create
        }
*****

***** V3105\Mainfrm.cpp
        // TODO: Delete these three lines if you don't want the toolbar to
        //      be dockable
        m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
***** V3032\MAINFRM.CPP
        // TODO: Delete these three lines if you don't want the toolbar to
        //  be dockable
        m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
*****

Resync Failed.  Files are too different.
***** V3105\Mainfrm.cpp


/////////////////////////////////////////////////////////////////////////////

//PAR Flecks
UINT PARThreadProc(LPVOID pParam)
{
/******************************************************************************************************************/
   UINT uResult=0;
   PARFlecks* pPARFlecksV=(PARFlecks*)pParam;

   FILE *testout=NULL;
   COleDateTime timeStart, timeEnd;
   COleDateTimeSpan spanElapsed;
   TCHAR      ach[128];
   MMRESULT   mmr;
   int        n,whbuffer;
   int        nDevs;
   int        nIndex,itmp;
   LPARAM     lParam;
   UINT       uDevType,ubcnt,uparcnt,uinterval,upar[24],uFlecks[24],un;
   int        ipar[24],iFlecks[24];
   unsigned short int ucnt,uval;
   bool bNoValue;
   HWAVEIN hwi;
   WAVEFORMATEX wfx;

#define MAXWAV 8192
#define MAXAVG 12
   // maxavg must be less than the dimensions above (24)
#define MAXWAVCNT 10

   char *wavebuffer[MAXWAVCNT];
   char MsgBuf[255];

   unsigned char c1,c2;
   WAVEHDR wh[MAXWAVCNT];
   UINT cbwh=sizeof(WAVEHDR);
   while(1)
   {
      if(PARFlecksValue.measure)
      {
         bNoValue=TRUE;
         nDevs = waveInGetNumDevs();
         for (n = -1; n < nDevs; n++)
         {
            WAVEINCAPS    wic;
            mmr = waveInGetDevCaps(n, &wic, sizeof(wic));
            if (MMSYSERR_NOERROR != mmr)
            {
               if (-1 != n)
               {
                  wic.vDriverVersion = 0;
                  lstrcpy(wic.szPname, "No");
               }
               else
               {
                  if (0 == nDevs)
                  break;

                  wic.vDriverVersion = 99;
                  lstrcpy(wic.szPname, "-...No");
               }
            }
            uDevType = MMCAPS_DEVTYPE_WAVEIN;
            lParam = MAKELPARAM((WORD)n, (WORD)uDevType);
            if(strstr(wic.szPname,"USB VideoBus II, Audio"))
            {
                /*if(wic.dwFormats&WAVE_FORMAT_1M08)AfxMessageBox("1M08", MB_ICONINFORMATION | MB_OK);
                if(wic.dwFormats&WAVE_FORMAT_1M16)AfxMessageBox("1M16", MB_ICONINFORMATION | MB_OK);
                if(wic.dwFormats&WAVE_FORMAT_1S08)AfxMessageBox("1S08", MB_ICONINFORMATION | MB_OK);
                if(wic.dwFormats&WAVE_FORMAT_1S16)AfxMessageBox("1S16", MB_ICONINFORMATION | MB_OK);
                if(wic.dwFormats&WAVE_FORMAT_2M08)AfxMessageBox("2M08", MB_ICONINFORMATION | MB_OK);
                if(wic.dwFormats&WAVE_FORMAT_2M16)AfxMessageBox("2M16", MB_ICONINFORMATION | MB_OK);
                if(wic.dwFormats&WAVE_FORMAT_2S08)AfxMessageBox("2S08", MB_ICONINFORMATION | MB_OK);
                if(wic.dwFormats&WAVE_FORMAT_2S16)AfxMessageBox("2S16", MB_ICONINFORMATION | MB_OK);
                if(wic.dwFormats&WAVE_FORMAT_4M08)AfxMessageBox("4M08", MB_ICONINFORMATION | MB_OK);
                if(wic.dwFormats&WAVE_FORMAT_4M16)AfxMessageBox("4M16", MB_ICONINFORMATION | MB_OK);
                if(wic.dwFormats&WAVE_FORMAT_4S08)AfxMessageBox("4S08", MB_ICONINFORMATION | MB_OK);
                if(wic.dwFormats&WAVE_FORMAT_4S16)AfxMessageBox("4S16", MB_ICONINFORMATION | MB_OK);
                if(wic.dwFormats&!WAVE_FORMAT_4S16&!WAVE_FORMAT_4S16&!WAVE_FORMAT_4S08&!WAVE_FORMAT_4M16&!WAVE_FORMAT_4M08&!WAV
_FORMAT_2S16
                  &!WAVE_FORMAT_2S08&!WAVE_FORMAT_2M16&!WAVE_FORMAT_2M08&!WAVE_FORMAT_1S16&!WAVE_FORMAT_1S08
                  &!WAVE_FORMAT_1M16&!WAVE_FORMAT_1M08)AfxMessageBox("+MORE", MB_ICONINFORMATION | MB_OK);
               */
               // AfxMessageBox("USB VideoBus II, Audio", MB_ICONINFORMATION | MB_OK);
               wfx.cbSize=NULL; //ignored in WAVE_FORMAT_PCM
               wfx.wFormatTag = WAVE_FORMAT_PCM;
               wfx.nChannels=2;
               wfx.nSamplesPerSec=16000; 
               wfx.wBitsPerSample=16;
               wfx.nBlockAlign=4;
               wfx.nAvgBytesPerSec=wfx.nBlockAlign*wfx.nSamplesPerSec; 

               mmr=waveInOpen( &hwi,n,&wfx,NULL,NULL,CALLBACK_NULL | WAVE_FORMAT_DIRECT );

/*char MsgBuf[255];
sprintf(MsgBuf,"waveInOpen mmr=%d",(int)mmr);
AfxMessageBox( (LPCTSTR)MsgBuf,  MB_OK | MB_ICONINFORMATION );
 if(mmr==MMSYSERR_ALLOCATED)AfxMessageBox("Specified resource is already allocated.",MB_ICONINFORMATION | MB_OK);
***** V3032\MAINFRM.CPP

/////////////////////////////////////////////////////////////////////////////
// CMainFrame message handlers

BOOL CMainFrame::PreTranslateMessage(MSG* pMsg) 
{
        /*** old code, used CTwain's functions
        return TwainMessageHook(pMsg) ||
                   CFrameWnd::PreTranslateMessage(pMsg);
                   */
        return TWAIN_MessageHook(pMsg) ||
                CFrameWnd::PreTranslateMessage(pMsg);
}

void CMainFrame::OnUpdateAcquire(CCmdUI* pCmdUI) 
{
        // Only allow Acquire if source mgr was brought
        // up successfully, and there is no acquisition
        // already going on.
        /*** old code, used CTwain's functions
        pCmdUI->Enable(State() == SOURCE_MANAGER_OPEN);
        */
        //pCmdUI->Enable(TWAIN_State() == TWAIN_SM_OPEN);
        pCmdUI->Enable(TWAIN_IsAvailable());
}

void CMainFrame::OnAcquire() 
{
        /*** old code, used CTwain's functions
        BeginAcquire();
        */


        //TWAIN_AcquireToClipboard(m_hWnd, TWAIN_ANYTYPE);
        HGLOBAL hdib = TWAIN_AcquireNative(m_hWnd, TWAIN_ANYTYPE);
        if (hdib) {
                DibReceived(hdib);
        }
}

void CMainFrame::OnUpdateSelectSource(CCmdUI* pCmdUI) 
{
        /*** old code, used CTwain's functions
        pCmdUI->Enable(State() == SOURCE_MANAGER_OPEN);
        */
        //pCmdUI->Enable(TWAIN_State() == TWAIN_SM_OPEN);
        pCmdUI->Enable(TWAIN_IsAvailable());

}

void CMainFrame::OnSelectSource() 
{
        /*** old code, used CTwain's functions
        SelectSource();
        */
        TWAIN_SelectImageSource(m_hWnd);
        //AfxMessageBox("TWAIN SelectImageSource here!!", MB_ICONINFORMATION | MB_OK);


// #############################################################################################################
//%%%%%%%%%%%%%%%%%%%%%%%%5%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%





//    HDEVINFO hDevInfo=INVALID_HANDLE_VALUE;

/*
     SP_DEVINFO_DATA DeviceInfoData;
     DWORD i;
     SP_DEVICE_INTERFACE_DATA  DeviceInterfaceData;
     SP_DEVICE_INTERFACE_DETAIL_DATA  DeviceInterfaceDetailData;

     // Create a HDEVINFO for Audio in present devices.
     hDevInfo = SetupDiGetClassDevs((LPGUID) &GUID_BELKINAUDIO, NULL, NULL, 
                                        DIGCF_PRESENT | DIGCF_PROFILE);
       
     if (hDevInfo == INVALID_HANDLE_VALUE)
     {
           // Insert error handling here.
        AfxMessageBox("Invalid_handle_value in setupdigetclassdevs", MB_ICONINFORMATION | MB_OK);
     }
     else
         {

        SP_DEVICE_INTERFACE_DATA  DeviceInterfaceData;
                DeviceInterfaceData.cbSize=sizeof(DeviceInterfaceData);
        DWORD i;

        for(i=0;SetupDiEnumDeviceInterfaces(
                   hDevInfo,
                   NULL, //&DeviceInfoData,
                   (LPGUID) &GUID_BELKINAUDIO,
                   i,
                   &DeviceInterfaceData
                  );i++)
       {
           DWORD DataT;
           LPTSTR buffer = NULL;
*****

