/*[]=====================================================================[]*/ /*[] LeadTools Run Time Library - Version 14 []*/ /*[] []*/ /*[] []*/ /*[] Copyright (c) 1991-2002 LEAD Technologies, Inc. []*/ /*[] All Rights Reserved. []*/ /*[]=====================================================================[]*/ #include "ImgPF.h" static L_BOOL ExtMesgDialog_OnCommand (HWND hWnd, L_INT nID, HWND hWndCtl, L_UINT uCodeNotify); static L_BOOL ExtMesgDialog_OnClose (HWND hWnd); static L_BOOL ExtMesgDialog_OnInitDialog (HWND hWnd, HWND hWndFocus, LPARAM lParam); static L_VOID ExtMesgDialog_OnTimer (HWND hWnd, L_INT nID); #ifdef UNICODE extern HFONT ghDlgFont; #endif// UNICODE L_BOOL CALLBACK ExtMesgDlgProc(HWND hWnd, L_UINT uMessage, WPARAM wParam, LPARAM lParam) { switch(uMessage) { HANDLE_MSG (hWnd, WM_COMMAND, ExtMesgDialog_OnCommand); HANDLE_MSG (hWnd, WM_INITDIALOG, ExtMesgDialog_OnInitDialog); HANDLE_MSG (hWnd, WM_CLOSE, ExtMesgDialog_OnClose); } return FALSE; } static L_BOOL ExtMesgDialog_OnInitDialog (HWND hWnd, HWND hWndFocus, LPARAM lParam) { LPADDMESGDLGDATA pAddMesgData; pCHILDDATA pData; HWND hWndParent; HWND hWndCtrl; pAddMesgData = (LPADDMESGDLGDATA)lParam; SetWindowLong(hWnd,GWL_USERDATA,(LONG)pAddMesgData); MoveDialogToMiddle(hWnd); hWndParent = FORWARD_WM_MDIGETACTIVE(hWndClient, SendMessage); pData = LOCKCHILDDATA (hWndParent); if (!pData) { MessageBox(hWnd, TEXT("Error"), NULL, MB_OK); return TRUE; } hWndCtrl = GetDlgItem(hWnd, IDC_EXMSG_POS_CHK); Button_SetCheck(hWndCtrl, BST_CHECKED); hWndCtrl = GetDlgItem(hWnd, IDC_EXMSG_PSW_CHK); Button_SetCheck(hWndCtrl, BST_CHECKED); hWndCtrl = GetDlgItem(hWnd, IDC_EXMSG_ORG_CHK); Button_SetCheck(hWndCtrl, BST_CHECKED); SetDlgItemInt(hWnd, IDC_EXMSG_XPOS_EDT, 0, FALSE); SetDlgItemInt(hWnd, IDC_EXMSG_YPOS_EDT, 0, FALSE); pData->uTimerID = SetTimer(hWnd, 1, 100, NULL); UNLOCKCHILDDATA(hWndParent); #ifdef UNICODE SetControlFont ( hWnd, ghDlgFont ) ; #endif// UNICODE return TRUE; } static L_VOID ExtMesgDialog_OnTimer(HWND hWnd, L_INT nID) { Dialog_Timer(nID); } static L_BOOL ExtMesgDialog_OnClose (HWND hWnd) { EndDialog(hWnd, 0); return TRUE; } static L_BOOL ExtMesgDialog_OnCommand (HWND hWnd, L_INT nID, HWND hWndCtl, L_UINT uCodeNotify) { LPGETDIRECTORYDLGPARAMS pDlgParams = NULL; LPADDMESGDLGDATA pAddMesgData; pCHILDDATA pData; L_BOOL bEnable; L_INT nByte; L_INT nRet; HWND hWndParent; HWND hWndCtrl; L_CHAR a[20] = "\0"; pAddMesgData = (LPADDMESGDLGDATA) GetWindowLong(hWnd,GWL_USERDATA); hWndParent = FORWARD_WM_MDIGETACTIVE(hWndClient, SendMessage); pData = LOCKCHILDDATA (hWndParent); if (!pData) { MessageBox(hWnd, TEXT("Error"), NULL, MB_OK); return TRUE; } switch(nID) { case IDCANCEL: EndDialog(hWnd, FALSE); return FALSE; case IDOK: hWndCtrl = GetDlgItem(hWnd, IDC_EXMSG_PSW_CHK); if(!Button_GetCheck(hWndCtrl)) { hWndCtrl = GetDlgItem(hWnd, IDC_EXMSG_PSW_EDT); nByte = Edit_GetTextLength(hWndCtrl); if(nByte == 0) { MessageBox(hWnd, TEXT("Enter your password!"),TEXT("Password"),MB_OK); return FALSE; } nByte++; pAddMesgData->pAddMesgInfo->pPassword = (L_UCHAR L_FAR *) GlobalAllocPtr(GHND, sizeof(L_UCHAR) * nByte); if(!pAddMesgData->pAddMesgInfo->pPassword) return FALSE; GetWindowTextA(hWndCtrl, pAddMesgData->pAddMesgInfo->pPassword, nByte); } hWndCtrl = GetDlgItem(hWnd, IDC_EXMSG_POS_CHK); if(!Button_GetCheck(hWndCtrl)) { pAddMesgData->pAddMesgInfo->pStart = (LPPOINT) GlobalAllocPtr(GHND, sizeof(POINT)); if(!pAddMesgData->pAddMesgInfo->pStart) return FALSE; pAddMesgData->pAddMesgInfo->pStart->x = GetDlgItemInt(hWnd, IDC_EXMSG_XPOS_EDT,NULL, TRUE); pAddMesgData->pAddMesgInfo->pStart->y = GetDlgItemInt(hWnd, IDC_EXMSG_YPOS_EDT,NULL, TRUE); } hWndCtrl = GetDlgItem(hWnd, IDC_EXMSG_ORG_CHK); if(!Button_GetCheck(hWndCtrl)) { hWndCtrl = GetDlgItem(hWnd, IDC_EXMSG_EXP_EDT); nByte = Edit_GetTextLength(hWndCtrl) + 1; pAddMesgData->pAddMesgInfo->pDirectory = (L_TCHAR L_FAR *) GlobalAllocPtr(GHND, sizeof(L_TCHAR) * nByte); if(!pAddMesgData->pAddMesgInfo->pDirectory) return FALSE; GetWindowText(hWndCtrl, pAddMesgData->pAddMesgInfo->pDirectory, nByte); if (pAddMesgData->pAddMesgInfo->pDirectory[nByte - 2] == '\\') { pAddMesgData->pAddMesgInfo->pDirectory[nByte - 2] = '\0'; } } UNLOCKCHILDDATA(hWndParent); EndDialog(hWnd, TRUE); return TRUE; case IDC_EXMSG_POS_CHK: bEnable = Button_GetCheck(hWndCtl); hWndCtrl = GetDlgItem(hWnd, IDC_EXMSG_XPOS_EDT); EnableWindow(hWndCtrl, !bEnable); hWndCtrl = GetDlgItem(hWnd, IDC_EXMSG_YPOS_EDT); EnableWindow(hWndCtrl, !bEnable); SetDlgItemInt(hWnd, IDC_EXMSG_XPOS_EDT, 0, FALSE); SetDlgItemInt(hWnd, IDC_EXMSG_YPOS_EDT, 0, FALSE); break; case IDC_EXMSG_PSW_CHK: bEnable = Button_GetCheck(hWndCtl); hWndCtrl = GetDlgItem(hWnd, IDC_EXMSG_PSW_EDT); EnableWindow(hWndCtrl, !bEnable); break; case IDC_EXMSG_ORG_CHK: bEnable = Button_GetCheck(hWndCtl); hWndCtrl = GetDlgItem(hWnd, IDC_EXMSG_EXP_BTN); EnableWindow(hWndCtrl, !bEnable); hWndCtrl = GetDlgItem(hWnd, IDC_EXMSG_EXP_EDT); EnableWindow(hWndCtrl, !bEnable); break; case IDC_EXMSG_EXP_BTN: pDlgParams = (LPGETDIRECTORYDLGPARAMS) GlobalAllocPtr(GHND, sizeof(GETDIRECTORYDLGPARAMS)); if(!pDlgParams) return FALSE; memset(pDlgParams, 0, sizeof(GETDIRECTORYDLGPARAMS)); pDlgParams->uStructSize = sizeof(GETDIRECTORYDLGPARAMS); pDlgParams->pszDirectory = TEXT("Desktop"); pDlgParams->nBuffSize = L_MAXPATH; pDlgParams->pszFilter = NULL; pDlgParams->nFilterIndex = 1; pDlgParams->pszTitle = TEXT("Directory"); nRet = L_DlgGetDirectory(hWnd, pDlgParams); if(nRet == SUCCESS_DLG_OK) { hWndCtrl = GetDlgItem(hWnd, IDC_EXMSG_EXP_EDT); Edit_SetText(hWndCtrl, pDlgParams->pszDirectory); } if(pDlgParams) GlobalFreePtr(pDlgParams); break; } UNLOCKCHILDDATA(hWndParent); return FALSE; }