# HG changeset patch # User StephaneLenclud # Date 1365972046 -7200 # Node ID 3031cd3ebd1eb3d50508a7d1a0038abd9b552054 # Parent ad71cf47d037545f34e9774226de930fae9ede04 Fixing character conversion upon receiving text. Adding our modified FrontView API sample allowing us to display every character supported by our VFD. diff -r ad71cf47d037 -r 3031cd3ebd1e SoundGraphAccess.cpp --- a/SoundGraphAccess.cpp Sat Apr 13 00:45:13 2013 +0200 +++ b/SoundGraphAccess.cpp Sun Apr 14 22:40:46 2013 +0200 @@ -193,12 +193,23 @@ //Convert first line OutputDebugStringA(gTextFirstLine); - int convertedChars = MultiByteToWideChar(CP_UTF8, 0, gTextFirstLine, -1, gTextFirstLine16, sizeof(gTextFirstLine16)); - OutputDebugString(gTextFirstLine16); + //int convertedChars = MultiByteToWideChar(CP_UTF8, 0, gTextFirstLine, -1, gTextFirstLine16, sizeof(gTextFirstLine16)); + for (int i=0;i<=strlen(gTextFirstLine);i++) + { + unsigned char myChar=(unsigned char)gTextFirstLine[i]; + gTextFirstLine16[i]=myChar; + } + OutputDebugStringW(gTextFirstLine16); //Convert second line OutputDebugStringA(gTextSecondLine); - convertedChars = MultiByteToWideChar(CP_UTF8, 0, gTextSecondLine, -1, gTextSecondLine16, sizeof(gTextSecondLine16)); - OutputDebugString(gTextSecondLine16); + //convertedChars = MultiByteToWideChar(CP_UTF8, 0, gTextSecondLine, -1, gTextSecondLine16, sizeof(gTextSecondLine16)); + for (int i=0;i<=strlen(gTextSecondLine);i++) + { + unsigned char myChar=(unsigned char)gTextSecondLine[i]; + gTextSecondLine16[i]=myChar; + } + + OutputDebugStringW(gTextSecondLine16); //IMON API call need to be done from window thread for some reason SendMessageToServer(KRspPending); @@ -555,7 +566,11 @@ break; // case WM_IMON_DISPLAY_SET_VFD_TEXT: +#ifdef _UNICODE if (DSP_SUCCEEDED==IMON_Display_SetVfdText(gTextFirstLine16,gTextSecondLine16)) +#else + if (DSP_SUCCEEDED==IMON_Display_SetVfdText(gTextFirstLine,gTextSecondLine)) +#endif { SendMessageToServer(KRspDone); } diff -r ad71cf47d037 -r 3031cd3ebd1e iMONDisplayApiSample/DisplayTest.sln --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/iMONDisplayApiSample/DisplayTest.sln Sun Apr 14 22:40:46 2013 +0200 @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DisplayTest", "DisplayTest\DisplayTest.vcproj", "{FE6179B9-6E3E-4157-BE52-C4A6B202306F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {FE6179B9-6E3E-4157-BE52-C4A6B202306F}.Debug|Win32.ActiveCfg = Debug|Win32 + {FE6179B9-6E3E-4157-BE52-C4A6B202306F}.Debug|Win32.Build.0 = Debug|Win32 + {FE6179B9-6E3E-4157-BE52-C4A6B202306F}.Release|Win32.ActiveCfg = Release|Win32 + {FE6179B9-6E3E-4157-BE52-C4A6B202306F}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff -r ad71cf47d037 -r 3031cd3ebd1e iMONDisplayApiSample/DisplayTest.suo Binary file iMONDisplayApiSample/DisplayTest.suo has changed diff -r ad71cf47d037 -r 3031cd3ebd1e iMONDisplayApiSample/DisplayTest.v11.suo Binary file iMONDisplayApiSample/DisplayTest.v11.suo has changed diff -r ad71cf47d037 -r 3031cd3ebd1e iMONDisplayApiSample/DisplayTest/DisplayTest.aps Binary file iMONDisplayApiSample/DisplayTest/DisplayTest.aps has changed diff -r ad71cf47d037 -r 3031cd3ebd1e iMONDisplayApiSample/DisplayTest/DisplayTest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/iMONDisplayApiSample/DisplayTest/DisplayTest.cpp Sun Apr 14 22:40:46 2013 +0200 @@ -0,0 +1,78 @@ +// DisplayTest.cpp : Defines the class behaviors for the application. +// + +#include "stdafx.h" +#include "DisplayTest.h" +#include "DisplayTestDlg.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#endif + + +// CDisplayTestApp + +BEGIN_MESSAGE_MAP(CDisplayTestApp, CWinApp) + ON_COMMAND(ID_HELP, &CWinApp::OnHelp) +END_MESSAGE_MAP() + + +// CDisplayTestApp construction + +CDisplayTestApp::CDisplayTestApp() +{ + // TODO: add construction code here, + // Place all significant initialization in InitInstance +} + + +// The one and only CDisplayTestApp object + +CDisplayTestApp theApp; + + +// CDisplayTestApp initialization + +BOOL CDisplayTestApp::InitInstance() +{ + // InitCommonControlsEx() is required on Windows XP if an application + // manifest specifies use of ComCtl32.dll version 6 or later to enable + // visual styles. Otherwise, any window creation will fail. + INITCOMMONCONTROLSEX InitCtrls; + InitCtrls.dwSize = sizeof(InitCtrls); + // Set this to include all the common control classes you want to use + // in your application. + InitCtrls.dwICC = ICC_WIN95_CLASSES; + InitCommonControlsEx(&InitCtrls); + + CWinApp::InitInstance(); + + AfxEnableControlContainer(); + + // Standard initialization + // If you are not using these features and wish to reduce the size + // of your final executable, you should remove from the following + // the specific initialization routines you do not need + // Change the registry key under which our settings are stored + // TODO: You should modify this string to be something appropriate + // such as the name of your company or organization + SetRegistryKey(_T("Local AppWizard-Generated Applications")); + + CDisplayTestDlg dlg; + m_pMainWnd = &dlg; + INT_PTR nResponse = dlg.DoModal(); + if (nResponse == IDOK) + { + // TODO: Place code here to handle when the dialog is + // dismissed with OK + } + else if (nResponse == IDCANCEL) + { + // TODO: Place code here to handle when the dialog is + // dismissed with Cancel + } + + // Since the dialog has been closed, return FALSE so that we exit the + // application, rather than start the application's message pump. + return FALSE; +} diff -r ad71cf47d037 -r 3031cd3ebd1e iMONDisplayApiSample/DisplayTest/DisplayTest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/iMONDisplayApiSample/DisplayTest/DisplayTest.h Sun Apr 14 22:40:46 2013 +0200 @@ -0,0 +1,31 @@ +// DisplayTest.h : main header file for the PROJECT_NAME application +// + +#pragma once + +#ifndef __AFXWIN_H__ + #error "include 'stdafx.h' before including this file for PCH" +#endif + +#include "resource.h" // main symbols + + +// CDisplayTestApp: +// See DisplayTest.cpp for the implementation of this class +// + +class CDisplayTestApp : public CWinApp +{ +public: + CDisplayTestApp(); + +// Overrides + public: + virtual BOOL InitInstance(); + +// Implementation + + DECLARE_MESSAGE_MAP() +}; + +extern CDisplayTestApp theApp; \ No newline at end of file diff -r ad71cf47d037 -r 3031cd3ebd1e iMONDisplayApiSample/DisplayTest/DisplayTest.rc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/iMONDisplayApiSample/DisplayTest/DisplayTest.rc Sun Apr 14 22:40:46 2013 +0200 @@ -0,0 +1,261 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// Korean resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_KOR) +#ifdef _WIN32 +LANGUAGE LANG_KOREAN, SUBLANG_DEFAULT +#pragma code_page(949) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""afxres.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_KOR)\r\n" + "LANGUAGE 18, 1\r\n" + "#pragma code_page(949)\r\n" + "#include ""res\\DisplayTest.rc2"" // non-Microsoft Visual C++ edited resources\r\n" + "#include ""afxres.rc"" // Standard components\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\\DisplayTest.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_ABOUTBOX DIALOGEX 0, 0, 235, 55 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "About DisplayTest" +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + ICON IDR_MAINFRAME,IDC_STATIC,11,17,20,20 + LTEXT "DisplayTest Version 1.0",IDC_STATIC,40,10,119,8,SS_NOPREFIX + LTEXT "Copyright (C) 2010",IDC_STATIC,40,25,119,8 + DEFPUSHBUTTON "OK",IDOK,178,7,50,16,WS_GROUP +END + +IDD_DISPLAYTEST_DIALOG DIALOGEX 0, 0, 403, 269 +STYLE DS_SETFONT | DS_MODALFRAME | WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +EXSTYLE WS_EX_APPWINDOW +CAPTION "DisplayTest" +FONT 9, "Tahoma", 400, 0, 0x0 +BEGIN + PUSHBUTTON "Init Plug-in",IDC_BUTTON1,7,7,62,16 + GROUPBOX "VFD Display",IDC_STATIC,7,32,189,102 + GROUPBOX "LCD Display",IDC_STATIC,207,32,189,66 + EDITTEXT IDC_EDIT1,49,44,131,12,ES_AUTOHSCROLL + EDITTEXT IDC_EDIT2,49,59,131,12,ES_AUTOHSCROLL + LTEXT "1st Line",IDC_STATIC,15,46,28,8 + LTEXT "2nd Line",IDC_STATIC,15,61,28,8 + PUSHBUTTON "Send Text",IDC_BUTTON2,33,74,62,16 + PUSHBUTTON "Start Random EQ",IDC_BUTTON3,100,74,62,16 + LTEXT "Static",IDC_STATIC_INFO,78,11,318,10 + EDITTEXT IDC_EDIT3,217,51,165,12,ES_AUTOHSCROLL + PUSHBUTTON "Send Text",IDC_BUTTON4,234,74,62,16 + PUSHBUTTON "Start Random EQ",IDC_BUTTON5,302,74,62,16 + CONTROL "1",IDC_ORANGE1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,41,154,20,10 + CONTROL "2",IDC_ORANGE2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,157,20,10 + CONTROL "3",IDC_ORANGE3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,167,20,10 + CONTROL "4",IDC_ORANGE4,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,178,20,10 + CONTROL "5",IDC_ORANGE5,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,41,182,20,10 + CONTROL "6",IDC_ORANGE6,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,64,177,20,10 + CONTROL "7",IDC_ORANGE7,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,64,167,20,10 + CONTROL "8",IDC_ORANGE8,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,64,157,20,10 + CONTROL "0",IDC_ORANGE0,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,78,187,20,10 + CONTROL "MUSIC",IDC_MUSIC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,115,155,36,10 + CONTROL "MOVIE",IDC_MOVIE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,154,155,37,10 + CONTROL "PHOTO",IDC_PHOTO,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,195,155,39,10 + CONTROL "CD/DVD",IDC_CD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,239,155,41,10 + CONTROL "TV",IDC_TV,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,115,165,25,10 + CONTROL "WEBCASTING",IDC_WEBCASTING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,147,165,59,10 + CONTROL "NEWS/WEATHER",IDC_NEWS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,210,165,71,10 + CONTROL "L",IDC_SPK_L,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,299,156,19,10 + CONTROL "C",IDC_SPK_C,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,327,156,20,10 + CONTROL "R",IDC_SPK_R,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,363,156,20,10 + CONTROL "SL",IDC_SPK_SL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,299,166,23,10 + CONTROL "LFE",IDC_SPK_LFE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,327,166,27,10 + CONTROL "SR",IDC_SPK_SR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,363,166,24,10 + CONTROL "RL",IDC_SPK_RL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,299,176,23,10 + CONTROL "S/PDIF",IDC_SPK_SPDIF,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,327,176,34,10 + CONTROL "RR",IDC_SPK_RR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,363,176,24,10 + CONTROL "SRC",IDC_AR_SRC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,306,200,28,10 + CONTROL "FIT",IDC_AR_FIT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,343,200,26,10 + CONTROL "TV",IDC_AR_TV,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,306,210,25,10 + CONTROL "HDTV",IDC_AR_HDTV,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,343,210,34,10 + CONTROL "SCR1",IDC_AR_SCR1,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,306,220,32,10 + CONTROL "SCR2",IDC_AR_SCR2,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,343,220,32,10 + CONTROL "MPG",IDC_AV_MPG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,199,31,10 + CONTROL "DIVX",IDC_AV_DIVX,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,199,31,10 + CONTROL "XVID",IDC_AV_XVID,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,200,199,31,10 + CONTROL "WMV",IDC_AV_WMV,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,241,199,31,10 + CONTROL "MPG",IDC_AV_MPA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,209,31,10 + CONTROL "AC3",IDC_AV_AC3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,209,33,10 + CONTROL "DTS",IDC_AV_DTS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,200,209,33,10 + CONTROL "WMA",IDC_AV_WMA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,241,209,33,10 + CONTROL "MP3",IDC_A_MP3,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,118,220,40,9 + CONTROL "OGG",IDC_A_OGG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,220,40,9 + CONTROL "WMA",IDC_A_WMA,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,200,220,40,9 + CONTROL "WAV",IDC_A_WAV,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,241,220,40,9 + CONTROL "REP",IDC_REPEAT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,200,35,9 + CONTROL "SFL",IDC_SHUFFLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,57,200,29,9 + CONTROL "ALARM",IDC_ALARM,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,210,35,9 + CONTROL "REC",IDC_REC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,57,210,29,9 + CONTROL "TIME",IDC_TIME,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,57,220,35,9 + CONTROL "VOL",IDC_VOL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,220,29,9 + GROUPBOX "LCD Icon & Progress",IDC_STATIC,7,141,389,121 + CONTROL "",IDC_SLIDER1,"msctls_trackbar32",TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,88,235,227,18 + PUSHBUTTON "Start Char Scroll",IDC_BUTTON6,69,98,62,16 + PUSHBUTTON "Next Char",IDC_BUTTON7,138,98,47,16 + PUSHBUTTON "Previous Char",IDC_BUTTON8,16,98,47,16 +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 0x4L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904e4" + BEGIN + VALUE "CompanyName", "SoundGraph, Inc." + VALUE "FileDescription", "iMON Display Plug-in Test Program" + VALUE "FileVersion", "1.0.0.1" + VALUE "InternalName", "DisplayTest.exe" + VALUE "LegalCopyright", "Copyright (C) 2010 SoundGraph, Inc." + VALUE "OriginalFilename", "DisplayTest.exe" + VALUE "ProductName", "iMON Display Plug-in Test Program" + VALUE "ProductVersion", "1.0.0.1" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1252 + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO +BEGIN + IDD_ABOUTBOX, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 228 + TOPMARGIN, 7 + BOTTOMMARGIN, 48 + END + + IDD_DISPLAYTEST_DIALOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 396 + TOPMARGIN, 7 + BOTTOMMARGIN, 262 + END +END +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE +BEGIN + IDS_ABOUTBOX "&About DisplayTest..." +END + +#endif // Korean 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_KOR) +LANGUAGE 18, 1 +#pragma code_page(949) +#include "res\DisplayTest.rc2" // non-Microsoft Visual C++ edited resources +#include "afxres.rc" // Standard components +#endif + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff -r ad71cf47d037 -r 3031cd3ebd1e iMONDisplayApiSample/DisplayTest/DisplayTest.vcproj --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/iMONDisplayApiSample/DisplayTest/DisplayTest.vcproj Sun Apr 14 22:40:46 2013 +0200 @@ -0,0 +1,272 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r ad71cf47d037 -r 3031cd3ebd1e iMONDisplayApiSample/DisplayTest/DisplayTest.vcproj.SLION-HTPC.sl.user --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/iMONDisplayApiSample/DisplayTest/DisplayTest.vcproj.SLION-HTPC.sl.user Sun Apr 14 22:40:46 2013 +0200 @@ -0,0 +1,65 @@ + + + + + + + + + + + diff -r ad71cf47d037 -r 3031cd3ebd1e iMONDisplayApiSample/DisplayTest/DisplayTestDlg.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/iMONDisplayApiSample/DisplayTest/DisplayTestDlg.cpp Sun Apr 14 22:40:46 2013 +0200 @@ -0,0 +1,614 @@ +// DisplayTestDlg.cpp : implementation file +// + +#include "stdafx.h" +#include "DisplayTest.h" +#include "DisplayTestDlg.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#endif + +static WCHAR staticCh=1; + +// CAboutDlg dialog used for App About + +class CAboutDlg : public CDialog +{ +public: + CAboutDlg(); + +// Dialog Data + enum { IDD = IDD_ABOUTBOX }; + + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + +// Implementation +protected: + DECLARE_MESSAGE_MAP() +}; + +CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD) +{ +} + +void CAboutDlg::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); +} + +BEGIN_MESSAGE_MAP(CAboutDlg, CDialog) +END_MESSAGE_MAP() + + +// CDisplayTestDlg dialog + +CDisplayTestDlg::CDisplayTestDlg(CWnd* pParent /*=NULL*/) + : CDialog(CDisplayTestDlg::IDD, pParent) +{ + m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); + + m_strLine1 = _T(""); + m_strLine2 = _T(""); + m_strLine3 = _T(""); + + m_uEqTimer = 0; + m_uEqTimer2 = 0; + m_bVfdConnected = FALSE; + m_bLcdConnected = FALSE; +} + +void CDisplayTestDlg::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + + DDX_Text(pDX, IDC_EDIT1, m_strLine1); + DDX_Text(pDX, IDC_EDIT2, m_strLine2); + DDX_Text(pDX, IDC_EDIT3, m_strLine3); +} + +BEGIN_MESSAGE_MAP(CDisplayTestDlg, CDialog) + ON_WM_SYSCOMMAND() + ON_WM_PAINT() + ON_WM_QUERYDRAGICON() + ON_WM_DESTROY() + ON_WM_TIMER() + //}}AFX_MSG_MAP + ON_BN_CLICKED(IDC_BUTTON1, OnBnClickedButtonInit) + ON_BN_CLICKED(IDC_BUTTON2, OnBnClickedButtonVfdSendText) + ON_BN_CLICKED(IDC_BUTTON3, OnBnClickedButtonVfdRandomEq) + ON_BN_CLICKED(IDC_BUTTON4, OnBnClickedButtonLcdSendText) + ON_BN_CLICKED(IDC_BUTTON5, OnBnClickedButtonLcdRandomEq) + + ON_BN_CLICKED(IDC_ORANGE1, OnLcdOrangeIcon) + ON_BN_CLICKED(IDC_ORANGE2, OnLcdOrangeIcon) + ON_BN_CLICKED(IDC_ORANGE3, OnLcdOrangeIcon) + ON_BN_CLICKED(IDC_ORANGE4, OnLcdOrangeIcon) + ON_BN_CLICKED(IDC_ORANGE5, OnLcdOrangeIcon) + ON_BN_CLICKED(IDC_ORANGE6, OnLcdOrangeIcon) + ON_BN_CLICKED(IDC_ORANGE7, OnLcdOrangeIcon) + ON_BN_CLICKED(IDC_ORANGE8, OnLcdOrangeIcon) + ON_BN_CLICKED(IDC_ORANGE0, OnLcdOrangeIcon) + ON_BN_CLICKED(IDC_MUSIC, OnLcdMediaTypeIcon) + ON_BN_CLICKED(IDC_MOVIE, OnLcdMediaTypeIcon) + ON_BN_CLICKED(IDC_PHOTO, OnLcdMediaTypeIcon) + ON_BN_CLICKED(IDC_CD, OnLcdMediaTypeIcon) + ON_BN_CLICKED(IDC_TV, OnLcdMediaTypeIcon) + ON_BN_CLICKED(IDC_WEBCASTING, OnLcdMediaTypeIcon) + ON_BN_CLICKED(IDC_NEWS, OnLcdMediaTypeIcon) + ON_BN_CLICKED(IDC_SPK_L, OnLcdSpeakerIcon) + ON_BN_CLICKED(IDC_SPK_C, OnLcdSpeakerIcon) + ON_BN_CLICKED(IDC_SPK_R, OnLcdSpeakerIcon) + ON_BN_CLICKED(IDC_SPK_SL, OnLcdSpeakerIcon) + ON_BN_CLICKED(IDC_SPK_LFE, OnLcdSpeakerIcon) + ON_BN_CLICKED(IDC_SPK_SR, OnLcdSpeakerIcon) + ON_BN_CLICKED(IDC_SPK_RL, OnLcdSpeakerIcon) + ON_BN_CLICKED(IDC_SPK_SPDIF, OnLcdSpeakerIcon) + ON_BN_CLICKED(IDC_SPK_RR, OnLcdSpeakerIcon) + ON_BN_CLICKED(IDC_AV_MPG, OnLcdVideoCodecIcon) + ON_BN_CLICKED(IDC_AV_DIVX, OnLcdVideoCodecIcon) + ON_BN_CLICKED(IDC_AV_XVID, OnLcdVideoCodecIcon) + ON_BN_CLICKED(IDC_AV_WMV, OnLcdVideoCodecIcon) + ON_BN_CLICKED(IDC_AV_MPA, OnLcdVideoCodecIcon) + ON_BN_CLICKED(IDC_AV_AC3, OnLcdVideoCodecIcon) + ON_BN_CLICKED(IDC_AV_DTS, OnLcdVideoCodecIcon) + ON_BN_CLICKED(IDC_AV_WMA, OnLcdVideoCodecIcon) + ON_BN_CLICKED(IDC_A_MP3, OnLcdAudioCodecIcon) + ON_BN_CLICKED(IDC_A_OGG, OnLcdAudioCodecIcon) + ON_BN_CLICKED(IDC_A_WMA, OnLcdAudioCodecIcon) + ON_BN_CLICKED(IDC_A_WAV, OnLcdAudioCodecIcon) + ON_BN_CLICKED(IDC_AR_SRC, OnLcdAspectRatioIcon) + ON_BN_CLICKED(IDC_AR_FIT, OnLcdAspectRatioIcon) + ON_BN_CLICKED(IDC_AR_TV, OnLcdAspectRatioIcon) + ON_BN_CLICKED(IDC_AR_HDTV, OnLcdAspectRatioIcon) + ON_BN_CLICKED(IDC_AR_SCR1, OnLcdAspectRatioIcon) + ON_BN_CLICKED(IDC_AR_SCR2, OnLcdAspectRatioIcon) + ON_BN_CLICKED(IDC_REPEAT, OnLcdEtcIcon) + ON_BN_CLICKED(IDC_SHUFFLE, OnLcdEtcIcon) + ON_BN_CLICKED(IDC_ALARM, OnLcdEtcIcon) + ON_BN_CLICKED(IDC_REC, OnLcdEtcIcon) + ON_BN_CLICKED(IDC_VOL, OnLcdEtcIcon) + ON_BN_CLICKED(IDC_TIME, OnLcdEtcIcon) + ON_WM_HSCROLL() + + ON_MESSAGE(WM_DSP_PLUGIN_NOTIFY, OnDisplayPluginNotify) + ON_BN_CLICKED(IDC_BUTTON6, &CDisplayTestDlg::OnBnClickedScrollChar) + ON_BN_CLICKED(IDC_BUTTON7, &CDisplayTestDlg::OnBnClickedNextChar) + ON_BN_CLICKED(IDC_BUTTON8, &CDisplayTestDlg::OnBnClickedPreviousChar) +END_MESSAGE_MAP() + + + + +// CDisplayTestDlg message handlers + +BOOL CDisplayTestDlg::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 + m_strLine1 = _T("SoundGraph, Inc."); + m_strLine2 = _T("iMON Display API"); + m_strLine3 = _T("SoundGraph, Inc. iMON Display API"); + + UpdateControlUI(); + + CSliderCtrl* pSliderCtrl = (CSliderCtrl*)GetDlgItem(IDC_SLIDER1); + if(pSliderCtrl) + { + pSliderCtrl->SetRange(0, 100); + pSliderCtrl->SetPos(0); + } + + UpdateData(FALSE); + + return TRUE; // return TRUE unless you set the focus to a control +} + +void CDisplayTestDlg::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 CDisplayTestDlg::OnPaint() +{ + if (IsIconic()) + { + CPaintDC dc(this); // device context for painting + + SendMessage(WM_ICONERASEBKGND, reinterpret_cast(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 function to obtain the cursor to display while the user drags +// the minimized window. +HCURSOR CDisplayTestDlg::OnQueryDragIcon() +{ + return static_cast(m_hIcon); +} + +void CDisplayTestDlg::OnDestroy() +{ + CDialog::OnDestroy(); + + IMON_Display_Uninit(); +} + +void CDisplayTestDlg::OnTimer(UINT nIDEvent) +{ + if(nIDEvent == 101) + { + + DSPEQDATA eqData; + for(int i=0; i<16;i++) + { + eqData.BandData[i] = rand()%100; + } + IMON_Display_SetVfdEqData(&eqData); + } + else if(nIDEvent == 102) + { + DSPEQDATA eqDataL; + DSPEQDATA eqDataR; + for(int i=0; i<16;i++) + { + eqDataL.BandData[i] = rand()%100; + eqDataR.BandData[i] = rand()%100; + } + IMON_Display_SetLcdEqData(&eqDataL, &eqDataR); + } + else if (nIDEvent == 103) + { + //Char scroll + WCHAR myStr[17]; + + WCHAR myCh=staticCh; + + for (int i=0;i<16;i++) + { + myStr[i]=myCh; + myCh++; + } + + staticCh++; + myStr[16]=0; + // + //myCh--; + + CString counter; + counter.Format(TEXT("%d - %d"),myStr[0],myStr[15]); + + IMON_Display_SetVfdText(myStr, (LPCTSTR)counter); + + } + + CDialog::OnTimer(nIDEvent); +} + + +void CDisplayTestDlg::OnBnClickedButtonInit() +{ + if(IMON_Display_IsInited() != DSP_S_INITED) Init(); + else Uninit(); +} + +void CDisplayTestDlg::OnBnClickedButtonVfdSendText() +{ + UpdateData(TRUE); + IMON_Display_SetVfdText((LPCTSTR)m_strLine1, (LPCTSTR)m_strLine2); +} + +void CDisplayTestDlg::OnBnClickedButtonVfdRandomEq() +{ + if(m_uEqTimer) + { + KillTimer(101); m_uEqTimer = 0; + GetDlgItem(IDC_BUTTON3)->SetWindowText(_T("Start Random EQ")); + } + else + { + m_uEqTimer = SetTimer(101, 100, NULL); + GetDlgItem(IDC_BUTTON3)->SetWindowText(_T("Stop Random EQ")); + } +} + +void CDisplayTestDlg::OnBnClickedScrollChar() +{ + if(m_uEqTimer) + { + KillTimer(103); m_uEqTimer = 0; + GetDlgItem(IDC_BUTTON6)->SetWindowText(_T("Start Scroll Char")); + } + else + { + m_uEqTimer = SetTimer(103, 500, NULL); + GetDlgItem(IDC_BUTTON6)->SetWindowText(_T("Stop Scroll Char")); + } +} + +void CDisplayTestDlg::OnBnClickedNextChar() +{ + //staticCh++; + OnTimer(103); +} + +void CDisplayTestDlg::OnBnClickedPreviousChar() +{ + staticCh-=2; + OnTimer(103); +} + + + +void CDisplayTestDlg::OnBnClickedButtonLcdSendText() +{ + UpdateData(TRUE); + IMON_Display_SetLcdText((LPCTSTR)m_strLine3); +} + +void CDisplayTestDlg::OnBnClickedButtonLcdRandomEq() +{ + if(m_uEqTimer2) + { + KillTimer(102); m_uEqTimer2 = 0; + GetDlgItem(IDC_BUTTON5)->SetWindowText(_T("Start Random EQ")); + } + else + { + m_uEqTimer2 = SetTimer(102, 40, NULL); + GetDlgItem(IDC_BUTTON5)->SetWindowText(_T("Stop Random EQ")); + } +} + +void CDisplayTestDlg::OnLcdOrangeIcon() +{ + BYTE data[2]; + memset(data, 0, sizeof(BYTE)*2); + + if(((CButton*)GetDlgItem(IDC_ORANGE1))->GetCheck()) data[0] |= 0x80; + if(((CButton*)GetDlgItem(IDC_ORANGE2))->GetCheck()) data[0] |= 0x40; + if(((CButton*)GetDlgItem(IDC_ORANGE3))->GetCheck()) data[0] |= 0x20; + if(((CButton*)GetDlgItem(IDC_ORANGE4))->GetCheck()) data[0] |= 0x10; + if(((CButton*)GetDlgItem(IDC_ORANGE5))->GetCheck()) data[0] |= 0x08; + if(((CButton*)GetDlgItem(IDC_ORANGE6))->GetCheck()) data[0] |= 0x04; + if(((CButton*)GetDlgItem(IDC_ORANGE7))->GetCheck()) data[0] |= 0x02; + if(((CButton*)GetDlgItem(IDC_ORANGE8))->GetCheck()) data[0] |= 0x01; + if(((CButton*)GetDlgItem(IDC_ORANGE0))->GetCheck()) data[1] |= 0x80; + + IMON_Display_SetLcdOrangeIcon(data[0], data[1]); +} + +void CDisplayTestDlg::OnLcdMediaTypeIcon() +{ + BYTE data = 0; + + if(((CButton*)GetDlgItem(IDC_MUSIC))->GetCheck()) data |= 0x80; + if(((CButton*)GetDlgItem(IDC_MOVIE))->GetCheck()) data |= 0x40; + if(((CButton*)GetDlgItem(IDC_PHOTO))->GetCheck()) data |= 0x20; + if(((CButton*)GetDlgItem(IDC_CD))->GetCheck()) data |= 0x10; + if(((CButton*)GetDlgItem(IDC_TV))->GetCheck()) data |= 0x08; + if(((CButton*)GetDlgItem(IDC_WEBCASTING))->GetCheck()) data |= 0x04; + if(((CButton*)GetDlgItem(IDC_NEWS))->GetCheck()) data |= 0x02; + + IMON_Display_SetLcdMediaTypeIcon(data); +} + +void CDisplayTestDlg::OnLcdSpeakerIcon() +{ + BYTE data[2]; + memset(data, 0, sizeof(BYTE)*2); + + if(((CButton*)GetDlgItem(IDC_SPK_L))->GetCheck()) data[0] |= 0x80; + if(((CButton*)GetDlgItem(IDC_SPK_C))->GetCheck()) data[0] |= 0x40; + if(((CButton*)GetDlgItem(IDC_SPK_R))->GetCheck()) data[0] |= 0x20; + if(((CButton*)GetDlgItem(IDC_SPK_SL))->GetCheck()) data[0] |= 0x10; + if(((CButton*)GetDlgItem(IDC_SPK_LFE))->GetCheck()) data[0] |= 0x08; + if(((CButton*)GetDlgItem(IDC_SPK_SR))->GetCheck()) data[0] |= 0x04; + if(((CButton*)GetDlgItem(IDC_SPK_RL))->GetCheck()) data[0] |= 0x02; + if(((CButton*)GetDlgItem(IDC_SPK_SPDIF))->GetCheck()) data[0] |= 0x01; + if(((CButton*)GetDlgItem(IDC_SPK_RR))->GetCheck()) data[1] |= 0x80; + + IMON_Display_SetLcdSpeakerIcon(data[0], data[1]); +} + +void CDisplayTestDlg::OnLcdVideoCodecIcon() +{ + BYTE data = 0; + + if(((CButton*)GetDlgItem(IDC_AV_MPG))->GetCheck()) data |= 0x80; + if(((CButton*)GetDlgItem(IDC_AV_DIVX))->GetCheck()) data |= 0x40; + if(((CButton*)GetDlgItem(IDC_AV_XVID))->GetCheck()) data |= 0x20; + if(((CButton*)GetDlgItem(IDC_AV_WMV))->GetCheck()) data |= 0x10; + if(((CButton*)GetDlgItem(IDC_AV_MPA))->GetCheck()) data |= 0x08; + if(((CButton*)GetDlgItem(IDC_AV_AC3))->GetCheck()) data |= 0x04; + if(((CButton*)GetDlgItem(IDC_AV_DTS))->GetCheck()) data |= 0x02; + if(((CButton*)GetDlgItem(IDC_AV_WMA))->GetCheck()) data |= 0x01; + + IMON_Display_SetLcdVideoCodecIcon(data); +} + +void CDisplayTestDlg::OnLcdAudioCodecIcon() +{ + BYTE data = 0; + + if(((CButton*)GetDlgItem(IDC_A_MP3))->GetCheck()) data |= 0x80; + if(((CButton*)GetDlgItem(IDC_A_OGG))->GetCheck()) data |= 0x40; + if(((CButton*)GetDlgItem(IDC_A_WMA))->GetCheck()) data |= 0x20; + if(((CButton*)GetDlgItem(IDC_A_WAV))->GetCheck()) data |= 0x10; + + IMON_Display_SetLcdAudioCodecIcon(data); +} + +void CDisplayTestDlg::OnLcdAspectRatioIcon() +{ + BYTE data = 0; + + if(((CButton*)GetDlgItem(IDC_AR_SRC))->GetCheck()) data |= 0x80; + if(((CButton*)GetDlgItem(IDC_AR_FIT))->GetCheck()) data |= 0x40; + if(((CButton*)GetDlgItem(IDC_AR_TV))->GetCheck()) data |= 0x20; + if(((CButton*)GetDlgItem(IDC_AR_HDTV))->GetCheck()) data |= 0x10; + if(((CButton*)GetDlgItem(IDC_AR_SCR1))->GetCheck()) data |= 0x08; + if(((CButton*)GetDlgItem(IDC_AR_SCR2))->GetCheck()) data |= 0x04; + + IMON_Display_SetLcdAspectRatioIcon(data); +} + +void CDisplayTestDlg::OnLcdEtcIcon() +{ + BYTE data = 0; + + if(((CButton*)GetDlgItem(IDC_REPEAT))->GetCheck()) data |= 0x80; + if(((CButton*)GetDlgItem(IDC_SHUFFLE))->GetCheck()) data |= 0x40; + if(((CButton*)GetDlgItem(IDC_ALARM))->GetCheck()) data |= 0x20; + if(((CButton*)GetDlgItem(IDC_REC))->GetCheck()) data |= 0x10; + if(((CButton*)GetDlgItem(IDC_VOL))->GetCheck()) data |= 0x08; + if(((CButton*)GetDlgItem(IDC_TIME))->GetCheck()) data |= 0x04; + + IMON_Display_SetLcdEtcIcon(data); +} + +void CDisplayTestDlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) +{ + CSliderCtrl* pSliderCtrl = (CSliderCtrl*)GetDlgItem(IDC_SLIDER1); + if( pSliderCtrl && pSliderCtrl->GetSafeHwnd() && + pScrollBar && pScrollBar->GetSafeHwnd() == pSliderCtrl->GetSafeHwnd() ) + { + IMON_Display_SetLcdProgress(pSliderCtrl->GetPos(), 100); + } + CDialog::OnHScroll(nSBCode, nPos, pScrollBar); +} + +LRESULT CDisplayTestDlg::OnDisplayPluginNotify(WPARAM wParam, LPARAM lParam) +{ + if(!GetSafeHwnd() || !IsWindow(GetSafeHwnd())) return 0; + + switch(wParam) + { + case DSPNM_PLUGIN_SUCCEED: + case DSPNM_IMON_RESTARTED: + case DSPNM_HW_CONNECTED: + { + GetDlgItem(IDC_BUTTON1)->EnableWindow(TRUE); + m_bVfdConnected = FALSE; + m_bLcdConnected = FALSE; + if((lParam & DSPN_DSP_VFD) == DSPN_DSP_VFD) m_bVfdConnected = TRUE; + if((lParam & DSPN_DSP_LCD) == DSPN_DSP_LCD) m_bLcdConnected = TRUE; + UpdateControlUI(); + + DisplayPluginMessage(wParam, FALSE); + } + break; + + case DSPNM_PLUGIN_FAILED: + case DSPNM_HW_DISCONNECTED: + case DSPNM_IMON_CLOSED: + { + GetDlgItem(IDC_BUTTON1)->EnableWindow(TRUE); + m_bVfdConnected = FALSE; + m_bLcdConnected = FALSE; + UpdateControlUI(); + + DisplayPluginMessage(lParam, TRUE); + } + break; + + case DSPNM_LCD_TEXT_SCROLL_DONE: + { + TRACE(_T("LCD Text Scroll Finished.\n")); + } + break; + } + return 0; +} + +void CDisplayTestDlg::Init() +{ + Uninit(); + + IMON_Display_Init(this->GetSafeHwnd(), WM_DSP_PLUGIN_NOTIFY); + GetDlgItem(IDC_BUTTON1)->EnableWindow(FALSE); +} + +void CDisplayTestDlg::Uninit() +{ + IMON_Display_Uninit(); + + m_bVfdConnected = FALSE; + m_bLcdConnected = FALSE; + + for(int i=IDC_ORANGE1;i<=IDC_AR_SCR2;i++) + { + if(GetDlgItem(i)) + ((CButton*)GetDlgItem(i))->SetCheck(FALSE); + } + CSliderCtrl* pSliderCtrl = (CSliderCtrl*)GetDlgItem(IDC_SLIDER1); + if(pSliderCtrl) pSliderCtrl->SetPos(0); + + UpdateControlUI(); +} + +void CDisplayTestDlg::DisplayPluginMessage(UINT uErrCode, BOOL bError) +{ + CString strErrMsg = _T(""); + + if(bError) + { + switch(uErrCode) + { + case DSPN_ERR_IN_USED: strErrMsg = _T("Display Plug-in is Already Used by Other Application."); break; + case DSPN_ERR_HW_DISCONNECTED: strErrMsg = _T("iMON HW is Not Connected."); break; + case DSPN_ERR_NOT_SUPPORTED_HW: strErrMsg = _T("The Connected iMON HW doesn't Support Display Plug-in."); break; + case DSPN_ERR_PLUGIN_DISABLED: strErrMsg = _T("Display Plug-in Mode Option is Disabled."); break; + case DSPN_ERR_IMON_NO_REPLY: strErrMsg = _T("The Latest iMON is Not Installed or iMON Not Running."); break; + case DSPN_ERR_UNKNOWN: strErrMsg = _T("Unknown Failure."); break; + } + } + else + { + switch(uErrCode) + { + case DSPNM_PLUGIN_SUCCEED: strErrMsg = _T("Plug-in Mode Inited Successfully."); break; + case DSPNM_IMON_RESTARTED: strErrMsg = _T("iMON Started and Plug-in Mode Inited."); break; + case DSPNM_HW_CONNECTED: strErrMsg = _T("iMON HW Connected and Plug-in Mode Inited."); break; + } + } + GetDlgItem(IDC_STATIC_INFO)->SetWindowText((LPCTSTR)strErrMsg); +} + +void CDisplayTestDlg::UpdateControlUI() +{ + GetDlgItem(IDC_STATIC_INFO)->SetWindowText(_T("")); + + if(IMON_Display_IsInited() != DSP_S_INITED) GetDlgItem(IDC_BUTTON1)->SetWindowText(_T("Init Plug-in")); + else GetDlgItem(IDC_BUTTON1)->SetWindowText(_T("Uninit Plug-in")); + + for(int i=IDC_EDIT1;i<=IDC_BUTTON3;i++) + { + if(GetDlgItem(i)) + GetDlgItem(i)->EnableWindow(m_bVfdConnected); + } + for(int i=IDC_BUTTON6;i<=IDC_BUTTON8;i++) + { + if(GetDlgItem(i)) + GetDlgItem(i)->EnableWindow(m_bVfdConnected); + } + for(int i=IDC_EDIT3;i<=IDC_SLIDER1;i++) + { + if(GetDlgItem(i)) + GetDlgItem(i)->EnableWindow(m_bLcdConnected); + } +} + + + diff -r ad71cf47d037 -r 3031cd3ebd1e iMONDisplayApiSample/DisplayTest/DisplayTestDlg.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/iMONDisplayApiSample/DisplayTest/DisplayTestDlg.h Sun Apr 14 22:40:46 2013 +0200 @@ -0,0 +1,67 @@ +// DisplayTestDlg.h : header file +// + +#pragma once + +#define WM_DSP_PLUGIN_NOTIFY WM_APP + 1001 + +// CDisplayTestDlg dialog +class CDisplayTestDlg : public CDialog +{ +// Construction +public: + CDisplayTestDlg(CWnd* pParent = NULL); // standard constructor + +// Dialog Data + enum { IDD = IDD_DISPLAYTEST_DIALOG }; + CString m_strLine1; + CString m_strLine2; + CString m_strLine3; + + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + + +// Implementation +protected: + HICON m_hIcon; + + UINT m_uEqTimer; + UINT m_uEqTimer2; + BOOL m_bVfdConnected; + BOOL m_bLcdConnected; + + void Init(); + void Uninit(); + void DisplayPluginMessage(UINT uErrCode, BOOL bError); + void UpdateControlUI(); + + // Generated message map functions + virtual BOOL OnInitDialog(); + afx_msg void OnSysCommand(UINT nID, LPARAM lParam); + afx_msg void OnPaint(); + afx_msg HCURSOR OnQueryDragIcon(); + afx_msg void OnDestroy(); + afx_msg void OnTimer(UINT nIDEvent); + DECLARE_MESSAGE_MAP() + + afx_msg void OnBnClickedButtonInit(); + afx_msg void OnBnClickedButtonVfdSendText(); + afx_msg void OnBnClickedButtonVfdRandomEq(); + afx_msg void OnBnClickedButtonLcdSendText(); + afx_msg void OnBnClickedButtonLcdRandomEq(); + afx_msg void OnLcdOrangeIcon(); + afx_msg void OnLcdMediaTypeIcon(); + afx_msg void OnLcdSpeakerIcon(); + afx_msg void OnLcdVideoCodecIcon(); + afx_msg void OnLcdAudioCodecIcon(); + afx_msg void OnLcdAspectRatioIcon(); + afx_msg void OnLcdEtcIcon(); + afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar); + + afx_msg LRESULT OnDisplayPluginNotify(WPARAM, LPARAM); +public: + afx_msg void OnBnClickedScrollChar(); + afx_msg void OnBnClickedNextChar(); + afx_msg void OnBnClickedPreviousChar(); +}; diff -r ad71cf47d037 -r 3031cd3ebd1e iMONDisplayApiSample/DisplayTest/ReadMe.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/iMONDisplayApiSample/DisplayTest/ReadMe.txt Sun Apr 14 22:40:46 2013 +0200 @@ -0,0 +1,93 @@ +================================================================================ + MICROSOFT FOUNDATION CLASS LIBRARY : DisplayTest Project Overview +=============================================================================== + +The application wizard has created this DisplayTest application for +you. This application not only demonstrates the basics of using the Microsoft +Foundation Classes but is also a starting point for writing your application. + +This file contains a summary of what you will find in each of the files that +make up your DisplayTest application. + +DisplayTest.vcproj + This is the main project file for VC++ projects generated using an application wizard. + It contains information about the version of Visual C++ that generated the file, and + information about the platforms, configurations, and project features selected with the + application wizard. + +DisplayTest.h + This is the main header file for the application. It includes other + project specific headers (including Resource.h) and declares the + CDisplayTestApp application class. + +DisplayTest.cpp + This is the main application source file that contains the application + class CDisplayTestApp. + +DisplayTest.rc + This is a listing of all of the Microsoft Windows resources that the + program uses. It includes the icons, bitmaps, and cursors that are stored + in the RES subdirectory. This file can be directly edited in Microsoft + Visual C++. Your project resources are in 1033. + +res\DisplayTest.ico + This is an icon file, which is used as the application's icon. This + icon is included by the main resource file DisplayTest.rc. + +res\DisplayTest.rc2 + This file contains resources that are not edited by Microsoft + Visual C++. You should place all resources not editable by + the resource editor in this file. + + +///////////////////////////////////////////////////////////////////////////// + +The application wizard creates one dialog class: + +DisplayTestDlg.h, DisplayTestDlg.cpp - the dialog + These files contain your CDisplayTestDlg class. This class defines + the behavior of your application's main dialog. The dialog's template is + in DisplayTest.rc, which can be edited in Microsoft Visual C++. + + +///////////////////////////////////////////////////////////////////////////// + +Other Features: + +ActiveX Controls + The application includes support to use ActiveX controls. + +///////////////////////////////////////////////////////////////////////////// + +Other standard files: + +StdAfx.h, StdAfx.cpp + These files are used to build a precompiled header (PCH) file + named DisplayTest.pch and a precompiled types file named StdAfx.obj. + +Resource.h + This is the standard header file, which defines new resource IDs. + Microsoft Visual C++ reads and updates this file. + +DisplayTest.manifest + Application manifest files are used by Windows XP to describe an applications + dependency on specific versions of Side-by-Side assemblies. The loader uses this + information to load the appropriate assembly from the assembly cache or private + from the application. The Application manifest maybe included for redistribution + as an external .manifest file that is installed in the same folder as the application + executable or it may be included in the executable in the form of a resource. +///////////////////////////////////////////////////////////////////////////// + +Other notes: + +The application wizard uses "TODO:" to indicate parts of the source code you +should add to or customize. + +If your application uses MFC in a shared DLL, you will need +to redistribute the MFC DLLs. If your application is in a language +other than the operating system's locale, you will also have to +redistribute the corresponding localized resources MFC80XXX.DLL. +For more information on both of these topics, please see the section on +redistributing Visual C++ applications in MSDN documentation. + +///////////////////////////////////////////////////////////////////////////// diff -r ad71cf47d037 -r 3031cd3ebd1e iMONDisplayApiSample/DisplayTest/iMONDisplay.dll Binary file iMONDisplayApiSample/DisplayTest/iMONDisplay.dll has changed diff -r ad71cf47d037 -r 3031cd3ebd1e iMONDisplayApiSample/DisplayTest/res/DisplayTest.ico Binary file iMONDisplayApiSample/DisplayTest/res/DisplayTest.ico has changed diff -r ad71cf47d037 -r 3031cd3ebd1e iMONDisplayApiSample/DisplayTest/res/DisplayTest.rc2 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/iMONDisplayApiSample/DisplayTest/res/DisplayTest.rc2 Sun Apr 14 22:40:46 2013 +0200 @@ -0,0 +1,13 @@ +// +// DisplayTest.RC2 - resources Microsoft Visual C++ does not edit directly +// + +#ifdef APSTUDIO_INVOKED +#error this file is not editable by Microsoft Visual C++ +#endif //APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// Add manually edited resources here... + +///////////////////////////////////////////////////////////////////////////// diff -r ad71cf47d037 -r 3031cd3ebd1e iMONDisplayApiSample/DisplayTest/resource.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/iMONDisplayApiSample/DisplayTest/resource.h Sun Apr 14 22:40:46 2013 +0200 @@ -0,0 +1,82 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by DisplayTest.rc +// +#define IDM_ABOUTBOX 0x0010 +#define IDD_ABOUTBOX 100 +#define IDS_ABOUTBOX 101 +#define IDD_DISPLAYTEST_DIALOG 102 +#define IDR_MAINFRAME 128 +#define IDC_BUTTON1 1000 +#define IDC_EDIT1 1001 +#define IDC_EDIT2 1002 +#define IDC_BUTTON2 1003 +#define IDC_BUTTON3 1004 +#define IDC_STATIC_INFO 1005 +#define IDC_EDIT3 1006 +#define IDC_BUTTON4 1007 +#define IDC_BUTTON5 1008 +#define IDC_ORANGE1 1009 +#define IDC_ORANGE2 1010 +#define IDC_ORANGE3 1011 +#define IDC_ORANGE4 1012 +#define IDC_ORANGE5 1013 +#define IDC_ORANGE6 1014 +#define IDC_ORANGE7 1015 +#define IDC_ORANGE8 1016 +#define IDC_ORANGE0 1017 +#define IDC_MUSIC 1018 +#define IDC_MOVIE 1019 +#define IDC_PHOTO 1020 +#define IDC_CD 1021 +#define IDC_TV 1022 +#define IDC_WEBCASTING 1023 +#define IDC_NEWS 1024 +#define IDC_SPK_L 1025 +#define IDC_SPK_C 1026 +#define IDC_SPK_R 1027 +#define IDC_SPK_SL 1028 +#define IDC_SPK_LFE 1029 +#define IDC_SPK_SR 1030 +#define IDC_SPK_RL 1031 +#define IDC_SPK_SPDIF 1032 +#define IDC_SPK_RR 1033 +#define IDC_REPEAT 1034 +#define IDC_SHUFFLE 1035 +#define IDC_ALARM 1036 +#define IDC_REC 1037 +#define IDC_VOL 1038 +#define IDC_TIME 1039 +#define IDC_AV_MPG 1040 +#define IDC_AV_DIVX 1041 +#define IDC_AV_XVID 1042 +#define IDC_AV_WMV 1043 +#define IDC_AV_MPA 1044 +#define IDC_AV_AC3 1045 +#define IDC_AV_DTS 1046 +#define IDC_AV_WMA 1047 +#define IDC_A_MP3 1048 +#define IDC_A_OGG 1049 +#define IDC_A_WMA 1050 +#define IDC_A_WAV 1051 +#define IDC_AR_SRC 1052 +#define IDC_AR_FIT 1053 +#define IDC_AR_TV 1054 +#define IDC_AR_HDTV 1055 +#define IDC_AR_SCR1 1056 +#define IDC_AR_SCR2 1057 +#define IDC_SLIDER1 1058 +#define IDC_BUTTON6 1059 +#define IDC_BUTTON7 1060 +#define IDC_BUTTON8 1062 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 129 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1059 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff -r ad71cf47d037 -r 3031cd3ebd1e iMONDisplayApiSample/DisplayTest/stdafx.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/iMONDisplayApiSample/DisplayTest/stdafx.cpp Sun Apr 14 22:40:46 2013 +0200 @@ -0,0 +1,7 @@ +// stdafx.cpp : source file that includes just the standard includes +// DisplayTest.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + + diff -r ad71cf47d037 -r 3031cd3ebd1e iMONDisplayApiSample/DisplayTest/stdafx.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/iMONDisplayApiSample/DisplayTest/stdafx.h Sun Apr 14 22:40:46 2013 +0200 @@ -0,0 +1,72 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, +// but are changed infrequently + +#pragma once + +#ifndef _SECURE_ATL +#define _SECURE_ATL 1 +#endif + +#ifndef VC_EXTRALEAN +#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers +#endif + +// Modify the following defines if you have to target a platform prior to the ones specified below. +// Refer to MSDN for the latest info on corresponding values for different platforms. +#ifndef WINVER // Allow use of features specific to Windows XP or later. +#define WINVER 0x0501 // Change this to the appropriate value to target other versions of Windows. +#endif + +#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later. +#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows. +#endif + +#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later. +#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later. +#endif + +#ifndef _WIN32_IE // Allow use of features specific to IE 6.0 or later. +#define _WIN32_IE 0x0600 // Change this to the appropriate value to target other versions of IE. +#endif + +#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit + +// turns off MFC's hiding of some common and often safely ignored warning messages +#define _AFX_ALL_WARNINGS + +#include // MFC core and standard components +#include // MFC extensions + + +#include // MFC Automation classes + + + +#ifndef _AFX_NO_OLE_SUPPORT +#include // MFC support for Internet Explorer 4 Common Controls +#endif +#ifndef _AFX_NO_AFXCMN_SUPPORT +#include // MFC support for Windows Common Controls +#endif // _AFX_NO_AFXCMN_SUPPORT + +#include "..\\..\\API\\iMONDisplayAPI.h" +#pragma comment(lib, "..\\..\\API\\iMONDisplay.lib") + + + + + +#ifdef _UNICODE +#if defined _M_IX86 +#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"") +#elif defined _M_IA64 +#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"") +#elif defined _M_X64 +#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"") +#else +#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") +#endif +#endif + +