0 Members and 1 Guest are viewing this topic.
CMG4 *GetCMG4(HWND hDlg){ // retrieve DG interface from scenario editor OBJHANDLE hVessel;// SendMessage(hDlg, WM_SCNEDITOR, SE_GETVESSEL, (LPARAM)&hVessel); return (CMG4*)oapiGetVesselInterface(hVessel);}BOOL CALLBACK CMG4_DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam){ CMG4 *sts = (uMsg == WM_INITDIALOG ? (CMG4*)lParam : (CMG4*)oapiGetDialogContext(hWnd)); // pointer to vessel instance was passed as dialog context switch (uMsg) { case WM_COMMAND: switch (LOWORD(wParam)) { case IDCANCEL: oapiCloseDialog(hWnd); return TRUE; //case IDC_PLBAYOP: // sts->plop->OpenDialog(); // break; case IDC_RMSOP1: oapiOpenDialogEx(g_Param.hDLL, IDD_DISPLAY, Damage_DlgProc, DLG_CAPTIONCLOSE, sts); break; } break; } return oapiDefDialogProc(hWnd, uMsg, wParam, lParam);}// ==============================================================// Message callback function for RMS control dialog box// ==============================================================BOOL CALLBACK EdPg3Proc(HWND hTab, UINT uMsg, WPARAM wParam, LPARAM lParam){ CMG4 *CM; switch (uMsg) { case WM_INITDIALOG: { CM = (CMG4*)oapiGetVesselInterface((OBJHANDLE)lParam); CM = GetCMG4(hTab); UpdateDamage(hTab, CM); case WM_COMMAND: break; } } return FALSE;}BOOL CALLBACK Damage_DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam){ CMG4 *CM = (uMsg == WM_INITDIALOG ? (CMG4*)lParam : (CMG4*)oapiGetDialogContext(hWnd)); // pointer to vessel instance was passed as dialog context switch (uMsg) { case WM_INITDIALOG: return FALSE; case WM_COMMAND: switch (LOWORD(wParam)) { case IDCANCEL: oapiCloseDialog(hWnd); return TRUE; } break; } return oapiDefDialogProc(hWnd, uMsg, wParam, lParam);}void UpdateDamage(HWND hTab, CMG4 *CM){ int i; char cbuf[256]; CM->NEWHEADING = 10; i = (int)(CM->NEWHEADING); sprintf(cbuf, "%d %%", i); SetWindowText(GetDlgItem(hTab, IDC_HEADING), cbuf); }
sprintf(oapiDebugString(), "%s", cbuf);
void UpdateDamage(HWND hTab, CMG4 *CM){ int i; char cbuf[256]; CM->NEWHEADING = 10; i = (int)(CM->NEWHEADING); sprintf(cbuf, "%d %%", i); SetWindowText(GetDlgItem(hTab, IDC_HEADING), cbuf); sprintf(oapiDebugString(), "%s", cbuf);}CMG4 *GetCMG4(HWND hDlg){ // retrieve DG interface from scenario editor OBJHANDLE hVessel; // SendMessage(hDlg, WM_SCNEDITOR, SE_GETVESSEL, (LPARAM)&hVessel); return (CMG4*)oapiGetVesselInterface(hVessel);}BOOL CALLBACK CMG4_DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam){ CMG4 *sts = (uMsg == WM_INITDIALOG ? (CMG4*)lParam : (CMG4*)oapiGetDialogContext(hWnd)); // pointer to vessel instance was passed as dialog context switch (uMsg) { case WM_COMMAND: switch (LOWORD(wParam)) { case IDCANCEL: oapiCloseDialog(hWnd); return TRUE; //case IDC_PLBAYOP: // sts->plop->OpenDialog(); // break; case IDC_RMSOP1: oapiOpenDialogEx(g_Param.hDLL, IDD_DISPLAY, Damage_DlgProc, DLG_CAPTIONCLOSE, sts); break; } break; } return oapiDefDialogProc(hWnd, uMsg, wParam, lParam);}// ==============================================================// Message callback function for RMS control dialog box// ==============================================================BOOL CALLBACK EdPg3Proc(HWND hTab, UINT uMsg, WPARAM wParam, LPARAM lParam){ CMG4 *CM; switch (uMsg) { case WM_INITDIALOG: { CM = (CMG4*)oapiGetVesselInterface((OBJHANDLE)lParam); CM = GetCMG4(hTab); UpdateDamage(hTab, CM); case WM_COMMAND: break; } } return FALSE;}BOOL CALLBACK Damage_DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam){ CMG4 *CM = (uMsg == WM_INITDIALOG ? (CMG4*)lParam : (CMG4*)oapiGetDialogContext(hWnd)); // pointer to vessel instance was passed as dialog context switch (uMsg) { case WM_INITDIALOG: return FALSE; case WM_COMMAND: switch (LOWORD(wParam)) { case IDCANCEL: oapiCloseDialog(hWnd); return TRUE; } break; } return oapiDefDialogProc(hWnd, uMsg, wParam, lParam);}
BOOL CALLBACK CMG4_DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam){ CMG4 *sts = (uMsg == WM_INITDIALOG ? (CMG4*)lParam : (CMG4*)oapiGetDialogContext(hWnd)); // pointer to vessel instance was passed as dialog context switch (uMsg) { case WM_COMMAND: switch (LOWORD(wParam)) { case IDCANCEL: oapiCloseDialog(hWnd); return TRUE; //case IDC_PLBAYOP: // sts->plop->OpenDialog(); // break; case IDC_RMSOP1: oapiOpenDialogEx(g_Param.hDLL, IDD_DISPLAY, Damage_DlgProc, DLG_CAPTIONCLOSE, sts); break; } break; } return oapiDefDialogProc(hWnd, uMsg, wParam, lParam);}