--- np2/win9x/dialog/dialogs.cpp 2007/12/16 14:58:25 1.14 +++ np2/win9x/dialog/dialogs.cpp 2011/03/07 09:54:11 1.18 @@ -1,19 +1,27 @@ -#include "compiler.h" -#include "resource.h" -#include "strres.h" -#include "bmpdata.h" -#include "oemtext.h" -#include "dosio.h" -#include "commng.h" -#include "dialogs.h" -#include "np2.h" +/** + * @file dialogs.cpp + * @brief Dialog subroutines + * + * @author $Author: yui $ + * @date $Date: 2011/03/07 09:54:11 $ + */ + +#include "compiler.h" +#include "resource.h" +#include "strres.h" +#include "bmpdata.h" +#include "oemtext.h" +#include "dosio.h" +#include "commng.h" +#include "dialogs.h" +#include "np2.h" #if defined(MT32SOUND_DLL) -#include "mt32snd.h" +#include "mt32snd.h" #endif - -const TCHAR str_nc[] = _T("N/C"); - +#if !defined(__GNUC__) +#pragma comment(lib, "winmm.lib") +#endif // !defined(__GNUC__) // ---- enable @@ -37,7 +45,6 @@ static BOOL openFileParam(LPOPENFILENAME OEMCHAR *pszPath, UINT uSize, BOOL (WINAPI * fnAPI)(LPOPENFILENAME lpofn)) { - HINSTANCE hInstance; LPTSTR lpszTitle; LPTSTR lpszFilter; LPTSTR lpszDefExt; @@ -53,11 +60,9 @@ static BOOL openFileParam(LPOPENFILENAME return FALSE; } - hInstance = g_hInstance; - if (!HIWORD(pcParam->lpszTitle)) { - lpszTitle = lockstringresource(hInstance, pcParam->lpszTitle); + lpszTitle = lockstringresource(pcParam->lpszTitle); lpOFN->lpstrTitle = lpszTitle; } else @@ -68,7 +73,7 @@ static BOOL openFileParam(LPOPENFILENAME if (!HIWORD(pcParam->lpszFilter)) { - lpszFilter = lockstringresource(hInstance, pcParam->lpszFilter); + lpszFilter = lockstringresource(pcParam->lpszFilter); lpOFN->lpstrFilter = lpszFilter; } else @@ -79,7 +84,7 @@ static BOOL openFileParam(LPOPENFILENAME if (!HIWORD(pcParam->lpszDefExt)) { - lpszDefExt = lockstringresource(hInstance, pcParam->lpszDefExt); + lpszDefExt = lockstringresource(pcParam->lpszDefExt); lpOFN->lpstrDefExt = lpszDefExt; } else @@ -302,14 +307,14 @@ void dlgs_setcbitem(HWND hWnd, UINT uID, lpcszStr = pcItem[i].lpcszString; if (!HIWORD(lpcszStr)) { - if (!loadstringresource(g_hInstance, LOWORD(lpcszStr), + if (!loadstringresource(LOWORD(lpcszStr), szString, NELEMENTS(szString))) { continue; } lpcszStr = szString; } - nIndex = SendMessage(hItem, CB_ADDSTRING, 0, (LPARAM)lpcszStr); + nIndex = (int)SendMessage(hItem, CB_ADDSTRING, 0, (LPARAM)lpcszStr); if (nIndex >= 0) { SendMessage(hItem, CB_SETITEMDATA, @@ -329,7 +334,7 @@ void dlgs_setcbnumber(HWND hWnd, UINT uI for (i=0; i= 0) { SendMessage(hItem, CB_SETITEMDATA, @@ -345,7 +350,7 @@ void dlgs_setcbcur(HWND hWnd, UINT uID, int i; hItem = GetDlgItem(hWnd, uID); - nItems = SendMessage(hItem, CB_GETCOUNT, 0, 0); + nItems = (int)SendMessage(hItem, CB_GETCOUNT, 0, 0); for (i=0; i= 0) { - return SendMessage(hItem, CB_GETITEMDATA, (WPARAM)nPos, 0); + return (int)SendMessage(hItem, CB_GETITEMDATA, (WPARAM)nPos, 0); } return nDefault; } @@ -373,6 +378,14 @@ int dlgs_getcbcur(HWND hWnd, UINT uID, i // ---- MIDIデバイスのリスト +static void insertnc(HWND hWnd, int nPos) +{ + TCHAR szNC[128]; + + loadstringresource(LOWORD(IDS_NONCONNECT), szNC, NELEMENTS(szNC)); + SendMessage(hWnd, CB_INSERTSTRING, (WPARAM)nPos, (LPARAM)szNC); +} + void dlgs_setlistmidiout(HWND hWnd, UINT16 res, const OEMCHAR *defname) { HWND wnd; @@ -385,7 +398,7 @@ void dlgs_setlistmidiout(HWND hWnd, UINT wnd = GetDlgItem(hWnd, res); defcur = 0; devs = midiOutGetNumDevs(); - SendMessage(wnd, CB_INSERTSTRING, (WPARAM)0, (LPARAM)str_nc); + insertnc(wnd, 0); SendMessage(wnd, CB_INSERTSTRING, (WPARAM)1, (LPARAM)cmmidi_midimapper); if (!milstr_cmp(defname, cmmidi_midimapper)) { defcur = 1; @@ -432,7 +445,7 @@ void dlgs_setlistmidiin(HWND hWnd, UINT1 wnd = GetDlgItem(hWnd, res); defcur = 0; num = midiInGetNumDevs(); - SendMessage(wnd, CB_INSERTSTRING, (WPARAM)0, (LPARAM)str_nc); + insertnc(wnd, 0); for (i=0; i