#include #include #include #include #include #include #include #include #include #include #include #include "../../../include/l_bitmap.h" /* LEADTOOLS main header file. */ #include "../../../include/l_error.h" /* LEADTOOLS error definition header file. */ #include "NetCmd.h" #include "Status.h" // --- dialog procs ----------------------------------------------------- // // AboutProc: About Dialog Box Procedure // int FAR PASCAL AboutProc(HWND hDlg, UINT Message, UINT wParam, LONG lParam) { switch (Message) { case WM_INITDIALOG : return TRUE ; case WM_COMMAND : switch (GET_WM_COMMAND_ID(wParam, lParam)) { case IDOK : EndDialog(hDlg, TRUE) ; return TRUE ; case IDCANCEL : EndDialog(hDlg, FALSE) ; return TRUE ; } break ; } return FALSE ; } int FAR PASCAL EditProc(HWND hDlg, UINT Message, UINT wParam, LONG lParam) { pEDITDATA pEditData; switch (Message) { case WM_INITDIALOG: if(!(pEditData = (pEDITDATA)lParam)) EndDialog(hDlg, FALSE); SetWindowLong(hDlg, GWL_USERDATA, lParam); SendDlgItemMessage(hDlg, IDC_URL, EM_SETLIMITTEXT, pEditData->nStringLen - (1*sizeof(L_TCHAR)), 0); SetDlgItemText(hDlg, IDC_URL, pEditData->pszString); return TRUE; case WM_COMMAND : switch (GET_WM_COMMAND_ID(wParam, lParam)) { case IDOK : pEditData = (pEDITDATA)GetWindowLong(hDlg, GWL_USERDATA); GetDlgItemText(hDlg, IDC_URL, pEditData->pszString, pEditData->nStringLen - 1); // make sure the string is NULL-terminated pEditData->pszString[pEditData->nStringLen - 1] = 0; EndDialog(hDlg, TRUE); return TRUE; case IDCANCEL : EndDialog(hDlg, FALSE) ; return TRUE ; } } return(FALSE); } int FAR PASCAL ImageListDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { RECT rcWin; L_INT nRet; /* selection options structure */ LILITEMSEL L_FAR *pSel=NULL; L_INT nID; int iIdx = 0; static LILSELOPTION Opt; static LILITEMOPTION MOpt; static L_INT iSortMethod; switch(message) { case WM_PALETTECHANGED: /* forward the message to the ImageList Control */ if(hCtl) SendMessage(hCtl, WM_PALETTECHANGED, wParam, lParam); break; case WM_INITDIALOG: /* create the LEAD ImageList Control */ L_UseImageListControl(); GetClientRect(hDlg, &rcWin); hCtl = L_CreateImageListControl(WS_CHILD|WS_VISIBLE|WS_BORDER, 0, /* x location */ 0, /* y location */ RECTWIDTH(rcWin), /* width */ RECTHEIGHT(rcWin), /* height */ hDlg, /* parent window */ IDC_LEADIMAGELIST, /* control ID */ RGB(128,128,128)); /* background color */ if(!IsWindow(hCtl)) { MessageBox(hDlg, TEXT("Error creating control"), TEXT("Error"), MB_OK); DestroyWindow(hDlg); } // Set LEADTOOLS icon to the dialog SendMessage(hDlg, WM_SETICON, (WPARAM)ICON_SMALL, (LPARAM)LoadIcon(ghInstApp, (LPTSTR)"LEAD")); // Enable / Disable selection style & method according to the flag at preferences Opt.uStructSize = sizeof(Opt); L_ImgListGetSelOptions(hCtl, &Opt); Opt.uAllowSelection = ALLOWSELECTION_SINGLE; Opt.uSelectionStyle = SELECTIONSTYLE_SELECTCOLOR; L_ImgListSetSelOptions(hCtl, &Opt); // Enable / Disable display text according to the flag at preferences memset(&MOpt, 0, sizeof(MOpt)); MOpt.uStructSize = sizeof(MOpt); L_ImgListGetItemOptions(hCtl, &MOpt); MOpt.bDisplayItemText = TRUE; L_ImgListSetItemOptions(hCtl, &MOpt); // Enable / Disable keyboard according to the flag at preferences L_ImgListEnableKeyboard(hCtl, TRUE); // Set scroll style Vert. / Horz according to the flags at preferences L_ImgListSetScrollStyle(hCtl, SCROLLSTYLE_VERTICAL); SetFocus(hCtl); return(FALSE); case WM_DESTROY: if(IsWindow(hCtl)) { L_ImgListClear(hCtl); DestroyWindow(hCtl); hCtl = NULL; } EnableWindow(ghWndMain, TRUE); break; case WM_COMMAND: nID = CTLID(wParam, lParam); switch (CTLID(wParam, lParam)) { case IDOK: case IDCANCEL: DestroyWindow(hDlg); ghImageListDlg = NULL; return(TRUE); } case IDC_LEADIMAGELIST: if(HIWORD(wParam) == L_ILN_ITEMSEL) { LILITEM Item; L_COMP hComputer; memset(&Item,0,sizeof(Item)); Item.uStructSize = sizeof(Item); Item.uBitmapStructSize = sizeof(BITMAPHANDLE); L_ImgListGetSelItems(hCtl, &Item); hComputer = GetRemoteComputer(); if(hComputer != SOCKET_ERROR) { nRet = L_InetSendLoadCmd(hComputer, guCommandID++, Item.pText, 0, ORDER_BGR, LOADFILE_ALLOCATE | LOADFILE_STORE); if(nRet != SUCCESS && nRet != ERROR_DATA_QUEUED) statusUpdate(TEXT("ERROR %d calling L_InetSendLoadCmd"), nRet); } DestroyWindow(hCtl); DestroyWindow(hDlg); ghImageListDlg = NULL; } break; break; } return(FALSE); } /* MyGetStrings brings up an edit dialog box that will get a string. pszTitle is the title of the dialog box pszString is pointer to the buffer that will be filled with the string. nStringLen is the size of the pszString buffer. */ L_BOOL MyGetString(HWND hWnd, L_TCHAR L_FAR*pszTitle, L_TCHAR L_FAR* pszString, L_INT nStringLen) { EDITDATA editData; editData.pszTitle = pszTitle; editData.pszString = pszString; editData.nStringLen = nStringLen; return DialogBoxParam(ghInstApp, MAKEINTRESOURCE(IDD_CONNECT), hWnd, (DLGPROC) EditProc, (LPARAM)&editData) == IDOK; }