Test against App

Hi,
further to this thread

http://www.experts-exchange.com/Programming/System/Q_28674259.html

which file should I run/test, to MFCApp, to see if it is working as expected?
LVL 12
HuaMin ChenProblem resolverAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

sarabandeCommented:
first, test the current program whether the paths created are all valid.

you also can do that programmitically by using

std::wifstream binfile((const TCHAR*)m_strFilePath, std::ios::binary | std::ios::in);
if (!binfile) 
{
      CString strMsg = "<";
      strMsg += m_strFilePath; 
      strMsg += ">, file does not exist!\n";
    
      AfxMessageBox(const TCHAR*)strMsg);
} 

Open in new window


in the BuildFileName member function.

note, currently the MfcApplication is based on unicode strings. therefore you would use wifstream and not ifstream. however, the functions of binaryfile are based on ansi strings. so we always would need to convert from wide strings to ansi strings and reverse. if you don't need the unicode in the mfc application, you simply could change the characterset from unicode to multi-byte in the general properties. i already prepared the current code for this switch. so the project should compile without changes if you alter the settings.

Sara
HuaMin ChenProblem resolverAuthor Commented:
do you mean to adjust this event? if yes, what to adjust?
void CMfcApplication9Dlg::BuildFileName(const CString & strFileName)
{
	UpdateData(TRUE);
	CString strFileExt = _T(".idx");

	CString strFileNum;
	if (m_radSelection == nameSelected)
	{
		if (m_strNameFileNum.IsEmpty() == false)
		{
			strFileNum = _T("_");
			strFileNum += m_strNameFileNum;
		}
	}
	else if (m_radSelection == numberSelected)
	{
		if (m_strNumberFileNum.IsEmpty() == false)
		{
			strFileNum = _T("_");
			strFileNum += m_strNumberFileNum;
		}
	}
	else
	{
		strFileExt = _T(".dat");
	}
	CString strFilePath = m_strFilePath;
	int pos = strFilePath.Find(_T("\\fl"));
	if (pos > 0)
	{
		strFilePath = strFilePath.Left(pos + 1);
	}
	strFilePath += strFileName;
	strFilePath += strFileNum;
	strFilePath += strFileExt;
	m_strFilePath = strFilePath;

	UpdateData(FALSE);
}

Open in new window

sarabandeCommented:
add the code i posted before UpdateData(FALSE) and after assignment of m_strFilePath.

did you think about the UNICODE - ANSI switch?

Sara
Learn Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

HuaMin ChenProblem resolverAuthor Commented:
do you mean to relace the following part with your codes?
	CString strFileNum;
	if (m_radSelection == nameSelected)
	{
		if (m_strNameFileNum.IsEmpty() == false)
		{
			strFileNum = _T("_");
			strFileNum += m_strNameFileNum;
		}
	}
	else if (m_radSelection == numberSelected)
	{
		if (m_strNumberFileNum.IsEmpty() == false)
		{
			strFileNum = _T("_");
			strFileNum += m_strNumberFileNum;
		}
	}
	else
	{
		strFileExt = _T(".dat");
	}
	CString strFilePath = m_strFilePath;
	int pos = strFilePath.Find(_T("\\fl"));
	if (pos > 0)
	{
		strFilePath = strFilePath.Left(pos + 1);
	}
	strFilePath += strFileName;
	strFilePath += strFileNum;
	strFilePath += strFileExt;
	m_strFilePath = strFilePath;

Open in new window

sarabandeCommented:
no, of course not. i said 'add' the code between line 30 and line 31 of your code snippet. it simply would check whether the file exists on your disk.

Hua, we won't proceed if you don't try to understand the code.

Sara
HuaMin ChenProblem resolverAuthor Commented:
Very sorry Sara. To the snippet below, I do not see the codes handling "binfile".
void CMfcApplication9Dlg::BuildFileName(const CString & strFileName)
{
	UpdateData(TRUE);
	CString strFileExt = _T(".idx");

	CString strFileNum;
	if (m_radSelection == nameSelected)
	{
		if (m_strNameFileNum.IsEmpty() == false)
		{
			strFileNum = _T("_");
			strFileNum += m_strNameFileNum;
		}
	}
	else if (m_radSelection == numberSelected)
	{
		if (m_strNumberFileNum.IsEmpty() == false)
		{
			strFileNum = _T("_");
			strFileNum += m_strNumberFileNum;
		}
	}
	else
	{
		strFileExt = _T(".dat");
	}
	CString strFilePath = m_strFilePath;
	int pos = strFilePath.Find(_T("\\fl"));
	if (pos > 0)
	{
		strFilePath = strFilePath.Left(pos + 1);
	}
	strFilePath += strFileName;
	strFilePath += strFileNum;
	strFilePath += strFileExt;
	m_strFilePath = strFilePath;

	UpdateData(FALSE);
}

Open in new window

sarabandeCommented:
there is no code handling binfile in the moment, since the dialog is not finished yet.

the current dialog only handles user selection which type of binary file to use and which file - if there are multiple ones - to choose.

if you add a check whether the selected file really exists we are done with that part and can add functionality where you can choose what to show from the file and how to present the data.

for example, we could show how many records are in the file. then let the user enter a record number and show that record both in binary format (hex) and text format. or we could search for a key in the index files and display the corresponding data record.

but you need to go on and not only wait for me to post the final codes.

there are still some questions open:
do you have a working dialog so far?
can you build the mfc app and run it from the ide?
does it work as expected?
did you change from unicode to multi-byte character set? it would make it much easier to call into the binaryfile if you do so, cause we wouldn't to convert from ansi text to unicode and vice versa?

Sara
HuaMin ChenProblem resolverAuthor Commented:
Many thanks Sara.
I can see the relevant Dialog below
1
and how to ensure my previous codes of the Dialog of my previous project, is also existing within the current project.

Regarding Multi-byte character set, should I ensure I'm using wchar_t for the character set of the proejct?
sarabandeCommented:
how to ensure my previous codes of the Dialog of my previous project, is also existing within the current project.
which code (functionality) do you want to overtake to the new dialog?

should I ensure I'm using wchar_t for the character set of the proejct?
it depends on whether the struct item has 'char' or 'wchar_t' for description member, and if it is wchar_t whether you actually have stored unicode characters in these fields. in the latter case we would need to show unicode strings in the gui as well and therefore the gui project should (must) use the unicode character set.

however, if the savebinaryfile has stored char buffers and not wchar_t, or the wchar_t texts only contain ansi or ascii characters, it makes not so much sense to always convert from char to wchar_t and reverse.

note the mfc project uses CString and TCHAR. when unicode character set was used, TCHAR was mapped as wchar_t and CString to CStringT<wchar_t>. if multi-byte character set is chosen in the settings, TCHAR is char type and CStringT<char> was mapped to CString. your current code is switchable to both. but when we use the binaryfile we have to make adaptions.

Sara
HuaMin ChenProblem resolverAuthor Commented:
Good day Sara,
is there a way to copy the dialog highlighted below
3
from previous project to current one? is there any quick way to copy the whole Dialog including its codes?
sarabandeCommented:
yes. you can select all controls in the dialog (for example with the mouse and pressed ctrl key), then copy to clipboard (ctrl+c), open the other project, add a new dialog in the resource tree and use ctrl+v to copy the old old dialog.

note, you should not copy into the current working dialog resource IDD_MFCAPPLICATION9_DIALOG since the controls would not fit to the code. but you could add mfcapplication8dlg.cpp and mfcapplication8dlg.h to the project and if you were using macro IDD_MFCAPPLICATION8_DIALOG for the second dialog resource (rename the new IDD_...  in resource tree) the dialog should compile.

Sara
HuaMin ChenProblem resolverAuthor Commented:
I did previously copy both files to current project and do not know why now current project is having such appearance to the dialog

current project
while the previous project is fine like
previous
sarabandeCommented:
i don't know what you did and what you intend to do.

since you did not achieve the get the mfcapplication8 dialog working, i created a new dialog with a similar look and add the handling of controls such that a valid file path (string) was created. i made a step-by-step instruction how you could build the new project. as far as i understood you were able to get the program working.

i now understand that based on the working code you would like to get your old dialog working as well. you best would do that by looking at the working code and move parts of that to the old project and change ID numbers and variable names such that the (old) program compiles.

the other direction doesn't make so much sense. if you copy non-working code to the new project or change the resource you must not wonder that your results are strange. i don't see a way to help with that.

Sara
HuaMin ChenProblem resolverAuthor Commented:
Good day Sara,
I'm to recreate the Dialog, that is highlighted, within Resource View below,
4
while on the previous project, that is one Dialog Form, being highlighted below. Could you please advise how to make that a "Dialog Form", as to the previous project?
4b
sarabandeCommented:
no i can't. why you would want to recreate a form that was not working?

and why did you drop or spoil the dialog resource which i posted as a resource snippet?

IDD_MFCAPPLICATION8_DIALOG DIALOGEX 0, 0, 320, 200
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_APPWINDOW
CAPTION "MfcApplication8"
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
    DEFPUSHBUTTON   "OK",IDOK,209,179,50,14
    PUSHBUTTON      "Cancel",IDCANCEL,263,179,50,14
    GROUPBOX        "Binary File Selection",IDC_GRP_RAD,20,18,261,97
    CONTROL         "Name Index",IDC_RAD_NAME,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,33,35,61,10
    CONTROL         "Number Index",IDC_RAD_NUMBER,"Button",BS_AUTORADIOBUTTON,33,55,61,10
    CONTROL         "Data Record",IDC_RAD_DATARECORD,"Button",BS_AUTORADIOBUTTON,33,75,61,10
    LTEXT           "File Number",IDC_STAT_NAME_FILENUM,122,37,39,8
    EDITTEXT        IDC_EDIT_NAME_FILENUM,165,34,29,14,ES_AUTOHSCROLL
    LTEXT           "File Number",IDC_STAT_NUMBER_FILENUM,121,56,39,8
    EDITTEXT        IDC_EDIT_NUMBER_FILENUM,165,52,29,14,ES_AUTOHSCROLL
    LTEXT           "File Path",IDC_STAT_FILE_PATH,32,96,28,8
    EDITTEXT        IDC_EDIT_FILE_PATH,72,94,199,14,ES_AUTOHSCROLL
END

Open in new window


and where i explained more than once how to replace that snippet in the .rc file?

Sara
HuaMin ChenProblem resolverAuthor Commented:
Thanks Sara.

I do have the backup to the project.

Can I have the details to create the dialog based on such snippet?
sarabandeCommented:
the replacement of the dialog resource is described in detail from step 6 to step 10b in the previous question at http://www.experts-exchange.com/Programming/System/Q_28674259.html#a40847972

after doing all steps you can build the solution by f7 and run it in the debugger by f5.

if there are errors you would post them here.

Sara
HuaMin ChenProblem resolverAuthor Commented:
Many thanks Sara.
Can I have the details to run it from IDE?
sarabandeCommented:
you need to have a successful build (see output window) which you may have issued with f7 (or right-click on project in solution explorer and 'build' or right-click on solution in solution explorer and 'build solution' or using 'build' menu and 'build solution').

the active configuration probably should be 'Debug' (though it should work with 'Release' as well)

then press f5 (or debug menu and 'start debugging') and the dialog shows up. you can end it with clicking on cancel button (or esc or alt+f4).

Sara

p. s. if you never have done that before, it is really a pity, since each tutorial on using the visual studio would have told you those basics at the first page.
HuaMin ChenProblem resolverAuthor Commented:
Good day Sara,
Any advice to the problem attached below

8
when running the app?
HuaMin ChenProblem resolverAuthor Commented:
And the last line below is where the break happens.

#pragma warning(suppress: 4985)
{
	// call shared/exported WinMain
	return AfxWinMain(hInstance, hPrevInstance, lpCmdLine, nCmdShow);
}

Open in new window

sarabandeCommented:
you may also post the stack window which can be found via 'Debug - Windows' if not already seen as a tab together with 'Output', 'Break', ...

in the exception settings you may set check box right of '0xc0000005 access violation' that the debugger stops immediately (next time) when the exception 'access violation' was thrown. if you click 'Break' button next time, the debugger would show exactly the line where the access violation happened (and not the line where the debugger found out that the exception wasn't handled as it is now).

then post your current file contents of resource.h, mfcapplication9.rc, mfcapplication9dlg.h and mfcapplication9dlg.cpp and mfcapplication9.cpp.

Sara
HuaMin ChenProblem resolverAuthor Commented:
Here is what I can see to Call stack
8
when I am to get

mfcapplication9.rc

I have got this
8b
sarabandeCommented:
Here is what I can see to Call stack
you first have to change exception settings for 'access violation' to stop immediately when the exception was thrown in order to get a meaningful stack contents. in the moment the stack is shown after the exception was not handled what is just before the application is quitting.

when I am to get mfcapplication9.rc
if you get this error the .rc file already was opened in a text window. you can search for it by using the dropdown button right to the file tab titles or by menu Window - Windows ...
in the text window select all contents and post it in a code block here.

Sara
HuaMin ChenProblem resolverAuthor Commented:
you first have to change exception settings for 'access violation' to stop immediately when the exception was thrown in order to get a meaningful stack contents.

Open in new window


Good day Sara,
where is the setting of this?
sarabandeCommented:
either click on 'Open Exception Settings' if you still have the exception message.

or you find it at menu

Debug - Exceptions... - Win32 exceptions

where you have to check the checkbox right of 0xc0000005 access violation

note, if you still have the exception, you may check whether the mfcapplication9.exe in debug folder is new. if not, the build still was not successful and you should have got an error when building with f7 in the visual studio. can you make a screenshot of the output window after build?

Sara
HuaMin ChenProblem resolverAuthor Commented:
Good day Sara,
within the same machine, I've generated the relevant files, and now try to run the current MFCAPP, like
10but I get nothing returned after having pressed "OK" in above.
HuaMin ChenProblem resolverAuthor Commented:
Even if I've put the parameter like
10b
sarabandeCommented:
ok. no exceptions?

did you play with the radio buttons?  are the file paths generated ok?

then we could go to the next step which is to check whether the file path is valid and points to an existing file.

i will post some code soon.

Sara
HuaMin ChenProblem resolverAuthor Commented:
Many thanks Sara. The relevant files have been generated fine.
sarabandeCommented:
i did some enhancements to the project.

you would need to replace resource.h, mfcapplication9.rc, mfcapplication9dlg.h and mfcapplication9dlg.cpp.

if you look at the code you will see that the unicode settings for the mfc app makes a lot of the coding.

you may think about whether you really need unicode for the mfc app (do you want to show unicode text at the screen)?

Sara
resource.h
MfcApplication9.rc
MfcApplication9Dlg.h
MfcApplication9Dlg.cpp

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
HuaMin ChenProblem resolverAuthor Commented:
Many thanks Sara.
I put all of your codes but I get this

Error	1	error RC1004: unexpected end of file found	C:\MfcApplication9 150702\MfcApplication9\resource.h	49	1	MfcApplication9

Open in new window

sarabandeCommented:
the error is from resource compiler. it sometimes has problems if the last line of a file was not ended with a linefeed. so the first you can try is to open the resource.h, goto last line and add a new line after the last #endif. store the file.

if that doesn't help, you may close the visual studio. then, get the file contents of all 4 files one by one into clipboard. open the old file with a text editor and replace all the contents. store the files. then open the project in visual studio, right-click on rc file in solution explorer (tree) and 'compile'.

tell me if you get the same error again.

Sara
sarabandeCommented:
i merged the new dialog resource snippet into the rc file you posted lastly.

// Microsoft Visual C++ generated resource script.
//
#include "resource.h"

#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#ifndef APSTUDIO_INVOKED
#include "targetver.h"
#endif
#include "afxres.h"
#include "verrsrc.h"

/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS

#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//

1 TEXTINCLUDE
BEGIN
    "resource.h\0"
END

2 TEXTINCLUDE
BEGIN
    "#ifndef APSTUDIO_INVOKED\r\n"
    "#include ""targetver.h""\r\n"
    "#endif\r\n"
    "#include ""afxres.h""\r\n"
    "#include ""verrsrc.h""\r\n"
    "\0"
END

3 TEXTINCLUDE
BEGIN
    "#define _AFX_NO_SPLITTER_RESOURCES\r\n"
    "#define _AFX_NO_OLE_RESOURCES\r\n"
    "#define _AFX_NO_TRACKER_RESOURCES\r\n"
    "#define _AFX_NO_PROPERTY_RESOURCES\r\n"
    "\r\n"
    "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
    "LANGUAGE 9, 1\r\n"    
    "#include ""res\\MfcApplication9.rc2""  // non-Microsoft Visual C++ edited resources\r\n"
    "#include ""afxres.rc""      // Standard components\r\n"
    "#if !defined(_AFXDLL)\r\n"
    "#include ""afxribbon.rc""   // MFC ribbon and control bar resources\r\n"
    "#endif\r\n"
    "#endif\r\n"
    "\0"
END

/////////////////////////////////////////////////////////////////////////////
#endif    // APSTUDIO_INVOKED


/////////////////////////////////////////////////////////////////////////////
//
// Icon
//

// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDR_MAINFRAME           ICON         "res\\MfcApplication9.ico"


#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE 9, 1

/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//

IDD_ABOUTBOX DIALOGEX 0, 0, 170, 62
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "About MfcApplication9"
FONT 8, "MS Shell Dlg"
BEGIN
    ICON            IDR_MAINFRAME,IDC_STATIC,14,14,21,20
    LTEXT           "MfcApplication9, Version 1.0",IDC_STATIC,42,14,114,8,SS_NOPREFIX
    LTEXT           "Copyright (C) 2015",IDC_STATIC,42,26,114,8
    DEFPUSHBUTTON   "OK",IDOK,113,41,50,14,WS_GROUP
END

IDD_MFCAPPLICATION9_DIALOG DIALOGEX 0, 0, 584, 265
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_APPWINDOW
CAPTION "MfcApplication9"
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
    DEFPUSHBUTTON   "OK",IDOK,474,244,50,14,NOT WS_VISIBLE
    PUSHBUTTON      "Cancel",IDCANCEL,527,244,50,14
    GROUPBOX        "Binary File Selection",IDC_GRP_RAD,10,18,261,105
    CONTROL         "Name Index",IDC_RAD_NAME,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,23,35,61,10
    CONTROL         "Number Index",IDC_RAD_NUMBER,"Button",BS_AUTORADIOBUTTON,23,55,61,10
    CONTROL         "Data Record",IDC_RAD_DATARECORD,"Button",BS_AUTORADIOBUTTON,23,75,61,10
    LTEXT           "File Number",IDC_STAT_NAME_FILENUM,112,36,39,8
    EDITTEXT        IDC_EDIT_NAME_FILENUM,155,34,29,14,ES_AUTOHSCROLL
    LTEXT           "File Number",IDC_STAT_NUMBER_FILENUM,111,55,39,8
    EDITTEXT        IDC_EDIT_NUMBER_FILENUM,155,52,29,14,ES_AUTOHSCROLL
    LTEXT           "File Path",IDC_STAT_FILE_PATH,22,96,28,8
    EDITTEXT        IDC_EDIT_FILE_PATH,62,94,199,14,ES_AUTOHSCROLL
    GROUPBOX        "Binary File Info",IDC_GRP_FILEINFO,276,17,301,105
    LTEXT           "Record Size",IDC_STAT_RECSIZE,296,31,52,8
    EDITTEXT        IDC_EDIT_RECSIZE,354,29,48,14,ES_RIGHT | ES_AUTOHSCROLL | ES_READONLY
    LTEXT           "Record Count",IDC_STAT_RECCOUNT,296,47,52,8
    EDITTEXT        IDC_EDIT_RECCOUNT,354,45,48,14,ES_RIGHT | ES_AUTOHSCROLL | ES_READONLY
    LTEXT           "Record Number",IDC_STAT_RECNUM,296,71,52,8,NOT WS_GROUP
    EDITTEXT        IDC_EDIT_RECNUM,354,69,48,14,ES_AUTOHSCROLL
    GROUPBOX        "",IDC_STATIC,295,57,244,9
    LTEXT           "Number Key",IDC_STAT_NUMKEY,296,87,52,8,NOT WS_GROUP
    EDITTEXT        IDC_EDIT_NUMKEY,354,85,62,14,ES_AUTOHSCROLL
    LTEXT           "Name Key",IDC_STAT_NAMEKEY,296,102,52,8,NOT WS_GROUP
    EDITTEXT        IDC_EDIT_NAMEKEY,354,100,91,14,ES_AUTOHSCROLL
    DEFPUSHBUTTON   "Get Record",IDC_BUT_GETRECORD,481,68,50,14
    EDITTEXT        IDC_EDIT_OUTPUT,17,148,188,87,ES_MULTILINE | ES_AUTOHSCROLL | ES_READONLY
    GROUPBOX        "Record Info",IDC_GRP_RECINFO,10,129,567,112
    EDITTEXT        IDC_EDIT_HEXINFO,206,148,371,87,ES_MULTILINE | ES_AUTOHSCROLL | ES_READONLY | WS_VSCROLL
    LTEXT           "Output",IDC_STAT_OUTPUT,99,138,52,8,NOT WS_GROUP
    LTEXT           "Hex Info",IDC_STAT_HEXINFO,340,138,52,8,NOT WS_GROUP
    LTEXT           "Num Items",IDC_STAT_NUMITEMS,424,31,52,8
    EDITTEXT        IDC_EDIT_NUMITEMS,482,29,48,14,ES_RIGHT | ES_AUTOHSCROLL | ES_READONLY
END


/////////////////////////////////////////////////////////////////////////////
//
// Version
//

VS_VERSION_INFO     VERSIONINFO
  FILEVERSION       1,0,0,1
  PRODUCTVERSION    1,0,0,1
 FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
#ifdef _DEBUG
 FILEFLAGS VS_FF_DEBUG
#else
 FILEFLAGS 0x0L
#endif
 FILEOS VOS_NT_WINDOWS32
 FILETYPE VFT_APP
 FILESUBTYPE VFT2_UNKNOWN
BEGIN
    BLOCK "StringFileInfo"
    BEGIN
        BLOCK "040904B0"
        BEGIN
            VALUE "CompanyName", "TODO: <Company name>"
            VALUE "FileDescription", "MfcApplication9"
            VALUE "FileVersion",     "1.0.0.1"
            VALUE "InternalName",    "MfcApplication9.exe"
            VALUE "LegalCopyright", "TODO: (c) <Company name>.  All rights reserved."
            VALUE "OriginalFilename","MfcApplication9.exe"
            VALUE "ProductName", "TODO: <Product name>"
            VALUE "ProductVersion",  "1.0.0.1"
        END
    END
    BLOCK "VarFileInfo"
    BEGIN
        VALUE "Translation", 0x0409, 1200
    END
END

/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//

#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
BEGIN
    IDD_ABOUTBOX, DIALOG
    BEGIN
        LEFTMARGIN, 7
        RIGHTMARGIN, 163
        TOPMARGIN, 7
        BOTTOMMARGIN, 55
    END
    IDD_MFCAPPLICATION9_DIALOG, DIALOG
    BEGIN
        LEFTMARGIN, 7
        RIGHTMARGIN, 313
        TOPMARGIN, 7
        BOTTOMMARGIN, 193
    END
END
#endif    // APSTUDIO_INVOKED



/////////////////////////////////////////////////////////////////////////////
//
// String Table
//

STRINGTABLE
BEGIN
    IDS_ABOUTBOX            "&About MfcApplication9..."
END


#endif

#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
#define _AFX_NO_SPLITTER_RESOURCES
#define _AFX_NO_OLE_RESOURCES
#define _AFX_NO_TRACKER_RESOURCES
#define _AFX_NO_PROPERTY_RESOURCES

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE 9, 1
#include "res\\MfcApplication9.rc2"  // non-Microsoft Visual C++ edited resources
#include "afxres.rc"      // Standard components
#if !defined(_AFXDLL)
#include "afxribbon.rc"   // MFC ribbon and control bar resources
#endif
#endif
/////////////////////////////////////////////////////////////////////////////
#endif    // not APSTUDIO_INVOKED

Open in new window


you may replace the contents by using a text editor (or by using 'Open with..' and choose source editor in visual studio) and it should work.

Sara
HuaMin ChenProblem resolverAuthor Commented:
Many many thanks Sara.
I can run it now and how about the values of "Number key" and "name key" below?
14
sarabandeCommented:
i implemented 'Record Number' input + GetRecord which would try to read the record from file and display it as hex bytes in the Hex Info window.

error messages would be displayed in the Output window.

next step is to display members of the displayed structure also in the output window like:

name_index.recnum = 12345
name_index.name = "AjxY29OzRnnyWpa"

the recnum 12345 then would point to Data Record 12345 with 10 items where one of them has name "AjxY29OzRnnyWpa"


next step is to make it possible to seek for number keys in the flout.dat or fnumber_xx via binary search.

next step is to make it possible to seek for name keys in the flout.dat or fname_xx via binary search.

Sara
sarabandeCommented:
next step:

replace the dialog resource IDD_MFCAPPLICATION9_DIALOG in your .rc file (opened as text file) by

IDD_MFCAPPLICATION9_DIALOG DIALOGEX 0, 0, 584, 265
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_APPWINDOW
CAPTION "MfcApplication9"
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
    DEFPUSHBUTTON   "OK",IDOK,474,244,50,14,NOT WS_VISIBLE
    PUSHBUTTON      "Cancel",IDCANCEL,527,244,50,14
    GROUPBOX        "Binary File Selection",IDC_GRP_RAD,10,18,261,105
    CONTROL         "Name Index",IDC_RAD_NAME,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,23,35,61,10
    CONTROL         "Number Index",IDC_RAD_NUMBER,"Button",BS_AUTORADIOBUTTON,23,55,61,10
    CONTROL         "Data Record",IDC_RAD_DATARECORD,"Button",BS_AUTORADIOBUTTON,23,75,61,10
    LTEXT           "File Number",IDC_STAT_NAME_FILENUM,112,36,39,8
    EDITTEXT        IDC_EDIT_NAME_FILENUM,155,34,29,14,ES_AUTOHSCROLL
    LTEXT           "File Number",IDC_STAT_NUMBER_FILENUM,111,55,39,8
    EDITTEXT        IDC_EDIT_NUMBER_FILENUM,155,52,29,14,ES_AUTOHSCROLL
    LTEXT           "File Path",IDC_STAT_FILE_PATH,22,96,28,8
    EDITTEXT        IDC_EDIT_FILE_PATH,62,94,199,14,ES_AUTOHSCROLL
    GROUPBOX        "Binary File Info",IDC_GRP_FILEINFO,276,17,301,105
    LTEXT           "Record Size",IDC_STAT_RECSIZE,296,31,52,8
    EDITTEXT        IDC_EDIT_RECSIZE,354,29,48,14,ES_RIGHT | ES_AUTOHSCROLL | ES_READONLY
    LTEXT           "Record Count",IDC_STAT_RECCOUNT,296,47,52,8
    EDITTEXT        IDC_EDIT_RECCOUNT,354,45,48,14,ES_RIGHT | ES_AUTOHSCROLL | ES_READONLY
    LTEXT           "Record Number",IDC_STAT_RECNUM,296,71,52,9,NOT WS_GROUP
    EDITTEXT        IDC_EDIT_RECNUM,354,69,48,14,ES_AUTOHSCROLL
    GROUPBOX        "",IDC_STATIC,295,57,244,9
    LTEXT           "Number Key",IDC_STAT_NUMKEY,296,87,52,8,NOT WS_GROUP
    EDITTEXT        IDC_EDIT_NUMKEY,354,85,62,14,ES_AUTOHSCROLL
    LTEXT           "Name Key",IDC_STAT_NAMEKEY,296,102,52,8,NOT WS_GROUP
    EDITTEXT        IDC_EDIT_NAMEKEY,354,100,91,14,ES_AUTOHSCROLL
    DEFPUSHBUTTON   "Get Record",IDC_BUT_GETRECORD,520,68,50,14
    EDITTEXT        IDC_EDIT_OUTPUT,17,148,188,87,ES_MULTILINE | ES_AUTOHSCROLL | ES_READONLY
    GROUPBOX        "Record Info",IDC_GRP_RECINFO,10,129,567,112
    EDITTEXT        IDC_EDIT_HEXINFO,206,148,371,87,ES_MULTILINE | ES_AUTOHSCROLL | ES_READONLY | WS_VSCROLL
    LTEXT           "Output",IDC_STAT_OUTPUT,99,138,52,8,NOT WS_GROUP
    LTEXT           "Hex Info",IDC_STAT_HEXINFO,340,138,52,8,NOT WS_GROUP
    LTEXT           "Num Items",IDC_STAT_NUMITEMS,424,31,43,8
    EDITTEXT        IDC_EDIT_NUMITEMS,469,29,48,14,ES_RIGHT | ES_AUTOHSCROLL | ES_READONLY
    LTEXT           "Item Number",IDC_STAT_ITEMNUM,424,71,43,9,NOT WS_GROUP
    EDITTEXT        IDC_EDIT_ITEMNUM,469,68,24,14,ES_AUTOHSCROLL
END

Open in new window


replace the attached files:

Sara
resource.h
MfcApplication9Dlg.h
MfcApplication9Dlg.cpp
HuaMin ChenProblem resolverAuthor Commented:
Many many thanks Sara to your update!
HuaMin ChenProblem resolverAuthor Commented:
I'll soon update you.
HuaMin ChenProblem resolverAuthor Commented:
Sorry, I get these
Error	1	error CVT1100: duplicate resource.  type:DIALOG, name:102, language:0x0409	C:\MfcApplication9 150703\MfcApplication9\CVTRES	MfcApplication9
Error	2	error LNK1123: failure during conversion to COFF: file invalid or corrupt	C:\MfcApplication9 150703\MfcApplication9\LINK	MfcApplication9

Open in new window


when building it after having applied the codes to the project.
HuaMin ChenProblem resolverAuthor Commented:
Good day Sara,
I see the relevant file does exist within the folder and do you know why I get the following message?
18
Have a great weekend!
sarabandeCommented:
The dialog resource 102 is IDD_MFCAPPLICATION9_DIALOG (what you can see in resource.h)

if the rc compiler complains duplicate resource the rc file has two dialog resources for IDD_MFCAPPLICATION9_DIALOG where you have to remove the one which is not the last one i posted.

File <C:\dp4\flout.dat>, file doesn't exist.

i don't know where the files are located at your computer. i mean the last files written by savebinaryfile and where you read successfully with readbinaryfile. in the mfcapplication9dlg.cpp there is folder "c:\\dp4" used. you have to change that code if you moved your files to a different folder.

Sara
HuaMin ChenProblem resolverAuthor Commented:
Many thanks Sara.
flout.dat does exist within c:\dp4, on the machine. and I do not know why the message does come out.
sarabandeCommented:
check whether you dialog cpp file exactly contains the following sequence:

      strFilePath += strFileName;
      strFilePath += strFileNum;
      strFilePath += strFileExt;
      m_strFilePath = strFilePath;

      struct stat fs = { 0 };
      char szPath[512] = { '\0' };
      if (sizeof(TCHAR) == 2)
      {
          size_t sizConverted = 0;
          wcstombs_s(&sizConverted, szPath, sizeof(szPath), (const wchar_t*)strFilePath, strFilePath.GetLength());
      }
      else
      {
          strcpy_s(szPath, sizeof(szPath), (const char *)(const TCHAR *)strFilePath);
      }
      m_strOutput = _T("");
      if (stat(szPath, &fs) != 0)
      {
          m_strOutput = _T("File <") + m_strFilePath + _T(">, File doesn't exist.");
      }

Open in new window


especially, it must be  if (stat(szPath, &fs) != 0) where i mean to remember that an older code had '== 0' instead of '!= 0'.

if the code is identically, you have to debug the sequence. set a breakpoint to line 'm_strFilePath = strFilePath;' and step with f10 until you come to the message file doesn't exist. check in the 'Auto' debug window which error code was returned by the stat function (1 means file not found, 3 means folder not found, 5 means access denied). the latter could happen if the file was opened in another program or editor. also check the contents of m_strFilePath. it may not contain 'funny' or 'unicode' characters.

Sara
sarabandeCommented:
note, you must have the last files i posted in http://www.experts-exchange.com/questions/28693180/Test-against-App.html#a40882467 

AND

you must have replaced the snippet from line 'IDD_MFCAPPLICATION9_DIALOG DIALOGEX 0, 0, 584, 265' until line with 'END' in YOUR rc file by the snippet i posted in the same post. since you got 'duplicate resource' it seems to me that you did not replace but add ???

Sara
sarabandeCommented:
the resource file you sent by message contains 590 occurrences of the resource snippet IDD_MFCAPPLICATION9_DIALOG. it should have one.

what are you doing?

Sara
HuaMin ChenProblem resolverAuthor Commented:
Sorry, here is the current rc file

// Microsoft Visual C++ generated resource script.
//
#include "resource.h"

#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#ifndef APSTUDIO_INVOKED
#include "targetver.h"
#endif
#include "afxres.h"
#include "verrsrc.h"

/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS

/////////////////////////////////////////////////////////////////////////////
// German (Germany) resources

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU)
LANGUAGE LANG_GERMAN, SUBLANG_GERMAN

#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//

1 TEXTINCLUDE 
BEGIN
    "resource.h\0"
END

2 TEXTINCLUDE 
BEGIN
    "#ifndef APSTUDIO_INVOKED\r\n"
    "#include ""targetver.h""\r\n"
    "#endif\r\n"
    "#include ""afxres.h""\r\n"
    "#include ""verrsrc.h""\r\n"
    "\0"
END

3 TEXTINCLUDE 
BEGIN
    "#define _AFX_NO_SPLITTER_RESOURCES\r\n"
    "#define _AFX_NO_OLE_RESOURCES\r\n"
    "#define _AFX_NO_TRACKER_RESOURCES\r\n"
    "#define _AFX_NO_PROPERTY_RESOURCES\r\n"
    "\r\n"
    "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
    "LANGUAGE 9, 1\r\n"
    "#include ""res\\MfcApplication9.rc2""  // non-Microsoft Visual C++ edited resources\r\n"
    "#include ""afxres.rc""      // Standard components\r\n"
    "#if !defined(_AFXDLL)\r\n"
    "#include ""afxribbon.rc""   // MFC ribbon and control bar resources\r\n"
    "#endif\r\n"
    "#endif\r\n"
    "\0"
END

#endif    // APSTUDIO_INVOKED


/////////////////////////////////////////////////////////////////////////////
//
// Icon
//

// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDR_MAINFRAME           ICON                    "res\\MfcApplication9.ico"
#endif    // German (Germany) resources
/////////////////////////////////////////////////////////////////////////////


/////////////////////////////////////////////////////////////////////////////
// English (United States) resources

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US

/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//

IDD_ABOUTBOX DIALOGEX 0, 0, 170, 62
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "About MfcApplication9"
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
    ICON            IDR_MAINFRAME,IDC_STATIC,14,14,21,20
    LTEXT           "MfcApplication9, Version 1.0",IDC_STATIC,42,14,114,8,SS_NOPREFIX
    LTEXT           "Copyright (C) 2015",IDC_STATIC,42,26,114,8
    DEFPUSHBUTTON   "OK",IDOK,113,41,50,14,WS_GROUP
END

IDD_MFCAPPLICATION9_DIALOG DIALOGEX 0, 0, 584, 265
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_APPWINDOW
CAPTION "MfcApplication9"
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
    DEFPUSHBUTTON   "OK",IDOK,474,244,50,14,NOT WS_VISIBLE
    PUSHBUTTON      "Cancel",IDCANCEL,527,244,50,14
    GROUPBOX        "Binary File Selection",IDC_GRP_RAD,10,18,261,105
    CONTROL         "Name Index",IDC_RAD_NAME,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,23,35,61,10
    CONTROL         "Number Index",IDC_RAD_NUMBER,"Button",BS_AUTORADIOBUTTON,23,55,61,10
    CONTROL         "Data Record",IDC_RAD_DATARECORD,"Button",BS_AUTORADIOBUTTON,23,75,61,10
    LTEXT           "File Number",IDC_STAT_NAME_FILENUM,112,36,39,8
    EDITTEXT        IDC_EDIT_NAME_FILENUM,155,34,29,14,ES_AUTOHSCROLL
    LTEXT           "File Number",IDC_STAT_NUMBER_FILENUM,111,55,39,8
    EDITTEXT        IDC_EDIT_NUMBER_FILENUM,155,52,29,14,ES_AUTOHSCROLL
    LTEXT           "File Path",IDC_STAT_FILE_PATH,22,96,28,8
    EDITTEXT        IDC_EDIT_FILE_PATH,62,94,199,14,ES_AUTOHSCROLL
    GROUPBOX        "Binary File Info",IDC_GRP_FILEINFO,276,17,301,105
    LTEXT           "Record Size",IDC_STAT_RECSIZE,296,31,52,8
    EDITTEXT        IDC_EDIT_RECSIZE,354,29,48,14,ES_RIGHT | ES_AUTOHSCROLL | ES_READONLY
    LTEXT           "Record Count",IDC_STAT_RECCOUNT,296,47,52,8
    EDITTEXT        IDC_EDIT_RECCOUNT,354,45,48,14,ES_RIGHT | ES_AUTOHSCROLL | ES_READONLY
    LTEXT           "Record Number",IDC_STAT_RECNUM,296,71,52,9,NOT WS_GROUP
    EDITTEXT        IDC_EDIT_RECNUM,354,69,48,14,ES_AUTOHSCROLL
    GROUPBOX        "",IDC_STATIC,295,57,244,9
    LTEXT           "Number Key",IDC_STAT_NUMKEY,296,87,52,8,NOT WS_GROUP
    EDITTEXT        IDC_EDIT_NUMKEY,354,85,62,14,ES_AUTOHSCROLL
    LTEXT           "Name Key",IDC_STAT_NAMEKEY,296,102,52,8,NOT WS_GROUP
    EDITTEXT        IDC_EDIT_NAMEKEY,354,100,91,14,ES_AUTOHSCROLL
    DEFPUSHBUTTON   "Get Record",IDC_BUT_GETRECORD,520,68,50,14
    EDITTEXT        IDC_EDIT_OUTPUT,17,148,188,87,ES_MULTILINE | ES_AUTOHSCROLL | ES_READONLY
    GROUPBOX        "Record Info",IDC_GRP_RECINFO,10,129,567,112
    EDITTEXT        IDC_EDIT_HEXINFO,206,148,371,87,ES_MULTILINE | ES_AUTOHSCROLL | ES_READONLY | WS_VSCROLL
    LTEXT           "Output",IDC_STAT_OUTPUT,99,138,52,8,NOT WS_GROUP
    LTEXT           "Hex Info",IDC_STAT_HEXINFO,340,138,52,8,NOT WS_GROUP
    LTEXT           "Num Items",IDC_STAT_NUMITEMS,424,31,43,8
    EDITTEXT        IDC_EDIT_NUMITEMS,469,29,48,14,ES_RIGHT | ES_AUTOHSCROLL | ES_READONLY
    LTEXT           "Item Number",IDC_STAT_ITEMNUM,424,71,43,9,NOT WS_GROUP
    EDITTEXT        IDC_EDIT_ITEMNUM,469,68,24,14,ES_AUTOHSCROLL
END

/////////////////////////////////////////////////////////////////////////////
//
// Version
//

VS_VERSION_INFO VERSIONINFO
 FILEVERSION 1,0,0,1
 PRODUCTVERSION 1,0,0,1
 FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
 FILEFLAGS 0x1L
#else
 FILEFLAGS 0x0L
#endif
 FILEOS 0x40004L
 FILETYPE 0x1L
 FILESUBTYPE 0x0L
BEGIN
    BLOCK "StringFileInfo"
    BEGIN
        BLOCK "040904B0"
        BEGIN
            VALUE "CompanyName", "TODO: <Company name>"
            VALUE "FileDescription", "MfcApplication9"
            VALUE "FileVersion", "1.0.0.1"
            VALUE "InternalName", "MfcApplication9.exe"
            VALUE "LegalCopyright", "TODO: (c) <Company name>.  All rights reserved."
            VALUE "OriginalFilename", "MfcApplication9.exe"
            VALUE "ProductName", "TODO: <Product name>"
            VALUE "ProductVersion", "1.0.0.1"
        END
    END
    BLOCK "VarFileInfo"
    BEGIN
        VALUE "Translation", 0x409, 1200
    END
END


/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//

#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
BEGIN
    IDD_ABOUTBOX, DIALOG
    BEGIN
        LEFTMARGIN, 7
        RIGHTMARGIN, 163
        TOPMARGIN, 7
        BOTTOMMARGIN, 55
    END

    IDD_MFCAPPLICATION9_DIALOG, DIALOG
    BEGIN
        LEFTMARGIN, 7
        RIGHTMARGIN, 577
        TOPMARGIN, 7
        BOTTOMMARGIN, 258
    END
END
#endif    // APSTUDIO_INVOKED


/////////////////////////////////////////////////////////////////////////////
//
// String Table
//

STRINGTABLE
BEGIN
    IDS_ABOUTBOX            "&About MfcApplication9..."
END

#endif    // English (United States) resources
/////////////////////////////////////////////////////////////////////////////



#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
#define _AFX_NO_SPLITTER_RESOURCES
#define _AFX_NO_OLE_RESOURCES
#define _AFX_NO_TRACKER_RESOURCES
#define _AFX_NO_PROPERTY_RESOURCES

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE 9, 1
#include "res\MfcApplication9.rc2"  // non-Microsoft Visual C++ edited resources
#include "afxres.rc"      // Standard components
#if !defined(_AFXDLL)
#include "afxribbon.rc"   // MFC ribbon and control bar resources
#endif
#endif

/////////////////////////////////////////////////////////////////////////////
#endif    // not APSTUDIO_INVOKED

Open in new window

that is existing on the current project. but when I run it, the same message is still shown there, while the file does exist.
sarabandeCommented:
sorry, the rc file doesn't contain the last dialog resource i sent you with #40882467

here again is the full rc file where you have to replace all contents.

before compiling delete the mfcapplication9.aps which is in the same project folder.

// Microsoft Visual C++ generated resource script.
//
#include "resource.h"

#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#ifndef APSTUDIO_INVOKED
#include "targetver.h"
#endif
#include "afxres.h"
#include "verrsrc.h"

/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS

#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//

1 TEXTINCLUDE
BEGIN
    "resource.h\0"
END

2 TEXTINCLUDE
BEGIN
    "#ifndef APSTUDIO_INVOKED\r\n"
    "#include ""targetver.h""\r\n"
    "#endif\r\n"
    "#include ""afxres.h""\r\n"
    "#include ""verrsrc.h""\r\n"
    "\0"
END

3 TEXTINCLUDE
BEGIN
    "#define _AFX_NO_SPLITTER_RESOURCES\r\n"
    "#define _AFX_NO_OLE_RESOURCES\r\n"
    "#define _AFX_NO_TRACKER_RESOURCES\r\n"
    "#define _AFX_NO_PROPERTY_RESOURCES\r\n"
    "\r\n"
    "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
    "LANGUAGE 9, 1\r\n"    
    "#include ""res\\MfcApplication9.rc2""  // non-Microsoft Visual C++ edited resources\r\n"
    "#include ""afxres.rc""      // Standard components\r\n"
    "#if !defined(_AFXDLL)\r\n"
    "#include ""afxribbon.rc""   // MFC ribbon and control bar resources\r\n"
    "#endif\r\n"
    "#endif\r\n"
    "\0"
END

/////////////////////////////////////////////////////////////////////////////
#endif    // APSTUDIO_INVOKED


/////////////////////////////////////////////////////////////////////////////
//
// Icon
//

// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDR_MAINFRAME           ICON         "res\\MfcApplication9.ico"


#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE 9, 1

/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//

IDD_ABOUTBOX DIALOGEX 0, 0, 170, 62
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "About MfcApplication9"
FONT 8, "MS Shell Dlg"
BEGIN
    ICON            IDR_MAINFRAME,IDC_STATIC,14,14,21,20
    LTEXT           "MfcApplication9, Version 1.0",IDC_STATIC,42,14,114,8,SS_NOPREFIX
    LTEXT           "Copyright (C) 2015",IDC_STATIC,42,26,114,8
    DEFPUSHBUTTON   "OK",IDOK,113,41,50,14,WS_GROUP
END

IDD_MFCAPPLICATION9_DIALOG DIALOGEX 0, 0, 584, 265
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_APPWINDOW
CAPTION "MfcApplication9"
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
    DEFPUSHBUTTON   "OK",IDOK,474,244,50,14,NOT WS_VISIBLE
    PUSHBUTTON      "Cancel",IDCANCEL,527,244,50,14
    GROUPBOX        "Binary File Selection",IDC_GRP_RAD,10,18,261,105
    CONTROL         "Name Index",IDC_RAD_NAME,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,23,35,61,10
    CONTROL         "Number Index",IDC_RAD_NUMBER,"Button",BS_AUTORADIOBUTTON,23,55,61,10
    CONTROL         "Data Record",IDC_RAD_DATARECORD,"Button",BS_AUTORADIOBUTTON,23,75,61,10
    LTEXT           "File Number",IDC_STAT_NAME_FILENUM,112,36,39,8
    EDITTEXT        IDC_EDIT_NAME_FILENUM,155,34,29,14,ES_AUTOHSCROLL
    LTEXT           "File Number",IDC_STAT_NUMBER_FILENUM,111,55,39,8
    EDITTEXT        IDC_EDIT_NUMBER_FILENUM,155,52,29,14,ES_AUTOHSCROLL
    LTEXT           "File Path",IDC_STAT_FILE_PATH,22,96,28,8
    EDITTEXT        IDC_EDIT_FILE_PATH,62,94,199,14,ES_AUTOHSCROLL
    GROUPBOX        "Binary File Info",IDC_GRP_FILEINFO,276,17,301,105
    LTEXT           "Record Size",IDC_STAT_RECSIZE,296,31,52,8
    EDITTEXT        IDC_EDIT_RECSIZE,354,29,48,14,ES_RIGHT | ES_AUTOHSCROLL | ES_READONLY
    LTEXT           "Record Count",IDC_STAT_RECCOUNT,296,47,52,8
    EDITTEXT        IDC_EDIT_RECCOUNT,354,45,48,14,ES_RIGHT | ES_AUTOHSCROLL | ES_READONLY
    LTEXT           "Record Number",IDC_STAT_RECNUM,296,71,52,9,NOT WS_GROUP
    EDITTEXT        IDC_EDIT_RECNUM,354,69,48,14,ES_AUTOHSCROLL
    GROUPBOX        "",IDC_STATIC,295,57,244,9
    LTEXT           "Number Key",IDC_STAT_NUMKEY,296,87,52,8,NOT WS_GROUP
    EDITTEXT        IDC_EDIT_NUMKEY,354,85,62,14,ES_AUTOHSCROLL
    LTEXT           "Name Key",IDC_STAT_NAMEKEY,296,102,52,8,NOT WS_GROUP
    EDITTEXT        IDC_EDIT_NAMEKEY,354,100,91,14,ES_AUTOHSCROLL
    DEFPUSHBUTTON   "Get Record",IDC_BUT_GETRECORD,520,68,50,14
    EDITTEXT        IDC_EDIT_OUTPUT,17,148,188,87,ES_MULTILINE | ES_AUTOHSCROLL | ES_READONLY
    GROUPBOX        "Record Info",IDC_GRP_RECINFO,10,129,567,112
    EDITTEXT        IDC_EDIT_HEXINFO,206,148,371,87,ES_MULTILINE | ES_AUTOHSCROLL | ES_READONLY | WS_VSCROLL
    LTEXT           "Output",IDC_STAT_OUTPUT,99,138,52,8,NOT WS_GROUP
    LTEXT           "Hex Info",IDC_STAT_HEXINFO,340,138,52,8,NOT WS_GROUP
    LTEXT           "Num Items",IDC_STAT_NUMITEMS,424,31,43,8
    EDITTEXT        IDC_EDIT_NUMITEMS,469,29,48,14,ES_RIGHT | ES_AUTOHSCROLL | ES_READONLY
    LTEXT           "Item Number",IDC_STAT_ITEMNUM,424,71,43,9,NOT WS_GROUP
    EDITTEXT        IDC_EDIT_ITEMNUM,469,68,24,14,ES_AUTOHSCROLL
END

                                          

/////////////////////////////////////////////////////////////////////////////
//
// Version
//

VS_VERSION_INFO     VERSIONINFO
  FILEVERSION       1,0,0,1
  PRODUCTVERSION    1,0,0,1
 FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
#ifdef _DEBUG
 FILEFLAGS VS_FF_DEBUG
#else
 FILEFLAGS 0x0L
#endif
 FILEOS VOS_NT_WINDOWS32
 FILETYPE VFT_APP
 FILESUBTYPE VFT2_UNKNOWN
BEGIN
    BLOCK "StringFileInfo"
    BEGIN
        BLOCK "040904B0"
        BEGIN
            VALUE "CompanyName", "TODO: <Company name>"
            VALUE "FileDescription", "MfcApplication9"
            VALUE "FileVersion",     "1.0.0.1"
            VALUE "InternalName",    "MfcApplication9.exe"
            VALUE "LegalCopyright", "TODO: (c) <Company name>.  All rights reserved."
            VALUE "OriginalFilename","MfcApplication9.exe"
            VALUE "ProductName", "TODO: <Product name>"
            VALUE "ProductVersion",  "1.0.0.1"
        END
    END
    BLOCK "VarFileInfo"
    BEGIN
        VALUE "Translation", 0x0409, 1200
    END
END

/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//

#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
BEGIN
    IDD_ABOUTBOX, DIALOG
    BEGIN
        LEFTMARGIN, 7
        RIGHTMARGIN, 163
        TOPMARGIN, 7
        BOTTOMMARGIN, 55
    END
    IDD_MFCAPPLICATION9_DIALOG, DIALOG
    BEGIN
        LEFTMARGIN, 7
        RIGHTMARGIN, 313
        TOPMARGIN, 7
        BOTTOMMARGIN, 193
    END
END
#endif    // APSTUDIO_INVOKED



/////////////////////////////////////////////////////////////////////////////
//
// String Table
//

STRINGTABLE
BEGIN
    IDS_ABOUTBOX            "&About MfcApplication9..."
END


#endif

#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
#define _AFX_NO_SPLITTER_RESOURCES
#define _AFX_NO_OLE_RESOURCES
#define _AFX_NO_TRACKER_RESOURCES
#define _AFX_NO_PROPERTY_RESOURCES

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
LANGUAGE 9, 1
#include "res\\MfcApplication9.rc2"  // non-Microsoft Visual C++ edited resources
#include "afxres.rc"      // Standard components
#if !defined(_AFXDLL)
#include "afxribbon.rc"   // MFC ribbon and control bar resources
#endif
#endif
/////////////////////////////////////////////////////////////////////////////
#endif    // not APSTUDIO_INVOKED

Open in new window


Sara
sarabandeCommented:
i think i know what the problem is. on the dialog program we are using stat function to test whether the file exists. stat only works for files less than 2gb in size. i assume the flout.dat is bigger. so we have to use _stat64 as we did in readbinaryfile.

Sara
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.