Start with the project you created in Implementing Vector Automation
Take the following steps to implement an Edit menu in the application:
Select the File->New menu option. In the dialog box, select Resource Script and press Enter.
Right-click the script you just created. Select Insert and then Menu from the dialog box that appears and click OK.
Create the following Menu structure:
IDR_MENU1
&File
&Undo with ID = IDM_EDIT_UNDO
&Redo with ID = IDM_EDIT_REDO
Cu&t with ID = IDM_EDIT_CUT
&Copy with ID = IDM_EDIT_COPY
&Paste with ID = IDM_EDIT_PASTE
&Delete with ID = IDM_EDIT_DELETE
Select &All with ID = IDM_EDIT_SELECTALL
&Unselect All with ID = IDM_EDIT_UNSELECTALL
P&rint with ID = IDM_EDIT_PRINT
&Reset with ID = IDM_EDIT_RESET
Select File->Save from the menu. Enter vecaut.rc in the Save As box and click Save.
Select Insert->Files into Project, browse to the vecaut.rc file just created and click Add.
Add the following line right under #include "C:\LEADTOOLS21\Include\ltaut.h"
.
#include "resource.h"
Change the line
WndClass.lpszMenuName = NULL;
In the WinMain function to
WndClass.lpszMenuName = MAKEINTRESOURCE( IDR_MENU1 );
Add the following lines of code right after the return 0L;
statement of case WM_CREATE
:
case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDM_EDIT_UNDO:
L_AutUndo(pAutomation, 0L);
InvalidateRect(hWnd, NULL, FALSE);
return 0L;
case IDM_EDIT_REDO:
L_AutUndo(pAutomation, 0L);
InvalidateRect(hWnd, NULL, FALSE);
return 0L;
case IDM_EDIT_CUT:
L_AutCut(pAutomation, 0L);
InvalidateRect(hWnd, NULL, FALSE);
return 0L;
case IDM_EDIT_COPY:
L_AutCopy(pAutomation, 0L);
InvalidateRect(hWnd, NULL, FALSE);
return 0L;
case IDM_EDIT_PASTE:
L_AutPaste(pAutomation, 0L);
InvalidateRect(hWnd, NULL, FALSE);
return 0L;
case IDM_EDIT_DELETE:
L_AutDelete(pAutomation, 0L);
InvalidateRect(hWnd, NULL, FALSE);
return 0L;
case IDM_EDIT_SELECTALL:
L_AutSelect(pAutomation, AUTOMATION_SELECT_ALL, 0L);
InvalidateRect(hWnd, NULL, FALSE);
return 0L;
case IDM_EDIT_UNSELECTALL:
L_AutSelect(pAutomation, AUTOMATION_SELECT_NONE, 0L);
InvalidateRect(hWnd, NULL, FALSE);
return 0L;
case IDM_EDIT_PRINT:
L_AutPrint(pAutomation, 0L);
return 0L;
case IDM_EDIT_RESET:
ResetView(hWnd, &Vector, pAutomation);
return 0L;
default:
break;
}
break;
Compile and run the demo. You should be able to perform common operations found in most Windows programs on your vector image.