Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

172 lines
5.0 KiB

  1. /*************************************************
  2. * sortdlg.c *
  3. * *
  4. * Copyright (C) 1995-1999 Microsoft Inc. *
  5. * *
  6. *************************************************/
  7. #include "prop.h"
  8. /*****************************************************************************
  9. FUNCTION: SortDialogProc(HWND, UINT, WPARAM, LPARAM)
  10. PURPOSE: Processes messages for "Sort" property sheet.
  11. PARAMETERS:
  12. hdlg - window handle of the property sheet
  13. wMessage - type of message
  14. wparam - message-specific information
  15. lparam - message-specific information
  16. RETURN VALUE:
  17. TRUE - message handled
  18. FALSE - message not handled
  19. HISTORY:
  20. 04-18-95 Yehfew Tie Created.
  21. ****************************************************************************/
  22. INT_PTR CALLBACK SortDialogProc(HWND hdlg,
  23. UINT uMessage,
  24. WPARAM wparam,
  25. LPARAM lparam)
  26. {
  27. static TCHAR DestFile[MAX_PATH];
  28. static TCHAR SrcFile [MAX_PATH];
  29. static TCHAR szStr [MAX_PATH];
  30. //FARPROC lpProcInfo;
  31. HANDLE hSrcFile;
  32. LPNMHDR lpnmhdr;
  33. switch (uMessage)
  34. {
  35. case WM_INITDIALOG:
  36. EnableWindow(GetDlgItem(hdlg,IDC_RESULTNAME),FALSE);
  37. EnableWindow(GetDlgItem(hdlg,IDC_SORT),FALSE);
  38. break;
  39. case WM_NOTIFY:
  40. lpnmhdr = (NMHDR FAR *)lparam;
  41. switch (lpnmhdr->code)
  42. {
  43. case PSN_SETACTIVE:
  44. hEncode = GlobalAlloc(GMEM_MOVEABLE|GMEM_ZEROINIT,
  45. NUMENCODEAREA*sizeof(ENCODEAREA));
  46. if(!hRule )
  47. ProcessError(ERR_OUTOFMEMORY,hdlg,ERR);
  48. if ( hEncode )
  49. ConvInitEncode(hEncode);
  50. break;
  51. case PSN_KILLACTIVE:
  52. if(hEncode)
  53. GlobalFree(hEncode);
  54. break;
  55. default:
  56. break;
  57. }
  58. break;
  59. case WM_COMMAND:
  60. switch (LOWORD(wparam))
  61. {
  62. case ID_FILEOPEN:
  63. {
  64. #ifdef UNICODE
  65. static TCHAR szTitle[] = {0x6253, 0x5F00, 0x0000};
  66. #else
  67. TCHAR szTitle[MAX_PATH];
  68. strcpy(szTitle,"����");
  69. #endif
  70. if(!TxtFileOpenDlg(hdlg,szStr,szTitle))
  71. break;
  72. }
  73. lstrcpy(SrcFile, szStr);
  74. hSrcFile = Create_File(hdlg,SrcFile,GENERIC_READ,OPEN_EXISTING);
  75. if (hSrcFile == (HANDLE)-1) {
  76. EnableWindow (GetDlgItem(hdlg,IDC_RESULTNAME), FALSE);
  77. SrcFile[0]=0;
  78. SetDlgItemText (hdlg,IDC_SRCNAME,SrcFile);
  79. lstrcpy(DestFile,SrcFile);
  80. SetDlgItemText (hdlg,IDC_RESULTNAME,DestFile);
  81. break;
  82. }
  83. CloseHandle(hSrcFile);
  84. EnableWindow (GetDlgItem(hdlg,IDC_RESULTNAME), TRUE);
  85. fnsplit(SrcFile, szStr);
  86. SetDlgItemText(hdlg,IDC_SRCNAME,szStr);
  87. lstrcpy(DestFile,SrcFile);
  88. SetDlgItemText(hdlg,IDC_RESULTNAME,DestFile);
  89. SendMessage(GetDlgItem(hdlg,ID_FILEOPEN),BM_SETSTYLE,BS_PUSHBUTTON,0L);
  90. SendMessage(GetDlgItem(hdlg,IDC_SORT),BM_SETSTYLE,BS_DEFPUSHBUTTON,TRUE);
  91. SetFocus(GetDlgItem(hdlg,IDC_SORT));
  92. break;
  93. case IDC_RESULTNAME:
  94. GetDlgItemText(hdlg,IDC_RESULTNAME,DestFile,32);
  95. if(lstrlen(DestFile) == 0)
  96. EnableWindow(GetDlgItem(hdlg,IDC_SORT),FALSE);
  97. else
  98. EnableWindow(GetDlgItem(hdlg,IDC_SORT),TRUE);
  99. break;
  100. case IDC_GETMBFILE:
  101. lstrcpy((LPTSTR)lparam,DestFile);
  102. break;
  103. case IDC_GETSRCFILE:
  104. lstrcpy((LPTSTR)lparam,SrcFile);
  105. break;
  106. case IDC_SORT:
  107. //lpProcInfo = MakeProcInstance((FARPROC)InfoDlg, hInst);
  108. pfnmsg=(PFNMSG)SortProc;
  109. bEndProp=FALSE;
  110. //DialogBox(hInst,
  111. // MAKEINTRESOURCE(IDD_INFO),
  112. // hdlg,
  113. // (DLGPROC)lpProcInfo);
  114. /*(bEndProp)
  115. PropSheet_PressButton(GetParent(hdlg),PSBTN_OK);*/
  116. //FreeProcInstance(lpProcInfo);
  117. DialogBox(hInst,
  118. MAKEINTRESOURCE(IDD_INFO),
  119. hdlg,
  120. InfoDlg);
  121. break;
  122. default:
  123. break;
  124. }
  125. break;
  126. default:
  127. break;
  128. }
  129. return FALSE;
  130. }
  131. VOID SortProc(LPVOID hWnd)
  132. {
  133. static TCHAR file1[MAX_PATH]=TEXT("");
  134. static TCHAR file2[MAX_PATH]=TEXT("");
  135. SendMessage(GetParent(hDlgless),WM_COMMAND,IDC_GETSRCFILE,(LPARAM)file1);
  136. SendMessage(GetParent(hDlgless),WM_COMMAND,IDC_GETMBFILE,(LPARAM)file2);
  137. if(ConvReadFile(hDlgless,file1,file2))
  138. bEndProp=TRUE;
  139. SendMessage(hDlgless,WM_CLOSE,0,0L);
  140. }