Take the following steps to add code, to the existing project, that will let you display annotations in run mode and activate a button annotation.
Start with the program you created in Implementing an Automated Annotation Program.
Add a User Mode menu item.
MENU_MAIN MENU
BEGIN
MENUITEM "&Open...", IDM_OPEN
MENUITEM "&Save...", IDM_SAVE
POPUP "User Mode"
BEGIN
MENUITEM "Design", IDM_DESIGN, CHECKED
MENUITEM "Run", IDM_RUN
END
MENUITEM "E&xit", IDM_EXIT
END
In the Loadsave.h file, add the following defines after the define for IDM_EXIT.
#define IDM_RUN 400
#define IDM_DESIGN 500
In the Window_OnCommand procedure, add the following code to the switch statement:
case IDM_RUN:
L_AnnSetUserMode(hContainer, ANNUSER_RUN);
CheckMenuItem(GetMenu(hWnd), IDM_DESIGN, MF_UNCHECKED);
CheckMenuItem(GetMenu(hWnd), IDM_RUN, MF_CHECKED);
break;
case IDM_DESIGN:
L_AnnSetUserMode(hContainer, ANNUSER_DESIGN);
CheckMenuItem(GetMenu(hWnd), IDM_RUN, MF_UNCHECKED);
CheckMenuItem(GetMenu(hWnd), IDM_DESIGN, MF_CHECKED);
break;
Add the following case to the Window_AnnEvent procedure:
case LTANNEVENT_AUTOCLICKED:
{
L_UINT uType = 0;
L_AnnGetType((HANNOBJECT)lParam, &uType);
if (uType == ANNOBJECT_BUTTON)
_wsystem(TEXT("Calc"));
}
break;
Build LoadSave.exe.
Run LoadSave.exe. Create an audio annotation. Right click on the annotation and set the file to any .wav file available on your system. Create a button annotation. Right click on the annotation and change any of the button properties you wish. On the User Mode menu, select Run Mode. As you move the cursor over the audio annotation and the button annotation, the cursor changes to a hand. Click on the audio annotation to hear the .wav file. Click on the button annotation to call the program listed under WM_LTANNEVENT.
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document