home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 275 / DPCS0111DVD.ISO / Toolkit / Audio-Visual / VirtualDub / Source / VirtualDub-1.9.10-src.7z / src / Setup / main.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2009-09-14  |  16.5 KB  |  508 lines

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <stddef.h>
  4. #include <stdarg.h>
  5. #include <malloc.h>
  6. #include <ctype.h>
  7. #include <crtdbg.h>
  8.  
  9. #include <windows.h>
  10. #include <commctrl.h>
  11.  
  12. #include "resource.h"
  13. #include "registry.h"
  14.  
  15. HWND g_hwnd;
  16. HINSTANCE g_hInst; // current instance
  17. char szAppName[] = "VirtualDub Setup Class"; // The name of this application
  18. char szTitle[]   = ""; // The title bar text
  19. char g_szWinPath[MAX_PATH];
  20. char g_szProgPath[MAX_PATH];
  21. char g_szTempPath[MAX_PATH];
  22.  
  23. ///////////////////
  24.  
  25. BOOL Init(HINSTANCE, int);
  26. LRESULT APIENTRY WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
  27.  
  28. BOOL APIENTRY InstallAVIFileDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
  29. BOOL APIENTRY UninstallAVIFileDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
  30. BOOL APIENTRY RemoveSettingsDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
  31. BOOL APIENTRY AboutDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
  32.  
  33. ///////////
  34.  
  35. int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
  36.     LPSTR lpCmdLine, int nCmdShow )
  37. {
  38.     MSG msg;
  39.     char *lpszFilePart;
  40.  
  41.     ///////////
  42.  
  43.     if (!GetWindowsDirectory(g_szWinPath, sizeof g_szWinPath)) return FALSE;
  44.     if (!GetModuleFileName(NULL, g_szTempPath, sizeof g_szTempPath))
  45.         return FALSE;
  46.     if (!GetFullPathName(g_szTempPath, sizeof g_szProgPath, g_szProgPath, &lpszFilePart))
  47.         return FALSE;
  48.     *lpszFilePart=0;
  49.  
  50.     if (!Init(hInstance, nCmdShow)) return FALSE;
  51.  
  52.     // Main message loop.
  53.  
  54.     while (GetMessage(&msg, NULL, 0, 0)) {
  55. //        if (!IsDialogMessage(g_hwnd, &msg))
  56.         TranslateMessage(&msg);
  57.         DispatchMessage(&msg);
  58.     }
  59.  
  60.     return 0;
  61. }
  62.  
  63. ////////////////
  64.  
  65. BOOL Init(HINSTANCE hInstance, int nCmdShow)
  66. {
  67.     WNDCLASS  wc;
  68.  
  69.     // Register the window class for my window.                                                           */
  70.     wc.style = 0;                       // Class style.
  71.     wc.lpfnWndProc = (WNDPROC)WndProc; // Window procedure for this class.
  72.     wc.cbClsExtra = 0;                  // No per-class extra data.
  73.     wc.cbWndExtra = DLGWINDOWEXTRA;                  // No per-window extra data.
  74.     wc.hInstance = hInstance;           // Application that owns the class.
  75.     wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
  76.     wc.hCursor = LoadCursor(NULL, IDC_ARROW);
  77.     wc.hbrBackground = (HBRUSH)(COLOR_3DFACE+1); 
  78.     wc.lpszMenuName =  NULL;   // Name of menu resource in .RC file. 
  79.     wc.lpszClassName = szAppName; // Name used in call to CreateWindow.
  80.  
  81.     if (!RegisterClass(&wc)) return FALSE;
  82.  
  83.     g_hInst = hInstance; // Store instance handle in our global variable
  84.  
  85.     g_hwnd = CreateDialog(hInstance,MAKEINTRESOURCE(IDD_MAINWINDOW),NULL,(DLGPROC)NULL);
  86.  
  87.     if (!g_hwnd) {
  88.         return (FALSE);
  89.     }
  90.  
  91.     ShowWindow(g_hwnd, nCmdShow);
  92.     UpdateWindow(g_hwnd);
  93.  
  94.     return (TRUE);
  95. }
  96.  
  97. void PrintfWindowText(HWND hWnd, char *format, ...) {
  98.     char buf[256];
  99.     va_list val;
  100.  
  101.     va_start(val, format);
  102.     vsprintf(buf, format, val);
  103.     va_end(val);
  104.     SetWindowText(hWnd, buf);
  105. }
  106.  
  107. LRESULT APIENTRY WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
  108. {
  109.  
  110.     switch (message) { 
  111.         case WM_DESTROY:
  112.             PostQuitMessage(0);
  113.             break;
  114.  
  115.         case WM_COMMAND:
  116.             switch(LOWORD(wParam)) {
  117.             case IDC_EXECUTE:
  118.                 if ((int)ShellExecute(hWnd, "open", "VirtualDub.exe", NULL, NULL, SW_SHOWNORMAL) <= 32)
  119.                     MessageBox(hWnd, "Couldn't launch VirtualDub.exe.", "Oops", MB_OK);
  120.                 break;
  121.             case IDC_INSTALL:
  122.                 DialogBox(g_hInst, MAKEINTRESOURCE(IDD_ATTEMPT), hWnd, (DLGPROC)InstallAVIFileDlgProc);
  123.                 break;
  124.             case IDC_UNINSTALL:
  125.                 DialogBox(g_hInst, MAKEINTRESOURCE(IDD_ATTEMPT), hWnd, (DLGPROC)UninstallAVIFileDlgProc);
  126.                 break;
  127.             case IDC_REMOVE:
  128.                 DialogBox(g_hInst, MAKEINTRESOURCE(IDD_ATTEMPT), hWnd, (DLGPROC)RemoveSettingsDlgProc);
  129.                 break;
  130.             case IDC_ABOUT:
  131.                 DialogBox(g_hInst, MAKEINTRESOURCE(IDD_ABOUT), hWnd, (DLGPROC)AboutDlgProc);
  132.                 break;
  133.             case IDCANCEL:
  134.                 DestroyWindow(hWnd);
  135.                 break;
  136.             }
  137.             break;
  138.  
  139.         default:
  140.             return DefWindowProc(hWnd,message,wParam,lParam);
  141.     }
  142.     return (0);
  143. }
  144.  
  145. //////////////////////////////////////////////////////////////////////
  146.  
  147. void ListboxAddf(HWND hwndListbox, char *format, ...) {
  148.     char buf[256];
  149.     va_list val;
  150.  
  151.     va_start(val, format);
  152.     _vsnprintf(buf, sizeof buf, format, val);
  153.     va_end(val);
  154.     buf[(sizeof buf) - 1] = 0;
  155.  
  156.     SendMessage(hwndListbox, LB_ADDSTRING, 0, (LPARAM)buf);
  157. }
  158.  
  159. BOOL InstallFile(char *szSource, char *szDestFormat, ...) {
  160.     char szDest[MAX_PATH];
  161.     char szDestPath[MAX_PATH];
  162.     char szDestFile[MAX_PATH];
  163.     char *lpszDestFile;
  164.     char szCurInst[MAX_PATH];
  165.     char szTempFile[MAX_PATH];
  166.     DWORD dwFlags = VIFF_DONTDELETEOLD;
  167.     DWORD dwRet;
  168.     UINT uTmpLen;
  169.     char szFailure[256];
  170.     va_list val;
  171.  
  172.     va_start(val, szDestFormat);
  173.     vsprintf(szDest, szDestFormat, val);
  174.     va_end(val);
  175.  
  176.     if (!GetFullPathName(szDest, sizeof szDestPath, szDestPath, &lpszDestFile))
  177.         return FALSE;
  178.  
  179.     strcpy(szDestFile, lpszDestFile);
  180.     *lpszDestFile=0;
  181.  
  182.     do {
  183.         szTempFile[0]=0;
  184.         szCurInst[0]=0;
  185.         uTmpLen = sizeof szTempFile;
  186.         dwRet = VerInstallFile(dwFlags, szSource, szDestFile, g_szProgPath, szDestPath, szCurInst, szTempFile, &uTmpLen);
  187.  
  188.         if (dwRet & VIF_TEMPFILE) {
  189.             DeleteFile(szTempFile);
  190.             dwRet &= ~VIF_TEMPFILE;
  191.         }
  192.  
  193.         szFailure[0]=0;
  194.  
  195.         if (dwRet & (VIF_MISMATCH | VIF_DIFFTYPE))
  196.             sprintf(szFailure,    "The old %s doesn't look like a VirtualDub file.\n"
  197.                                 "If it belongs to another application, installing the new file may cause "
  198.                                 "the other app to stop functioning.\n"
  199.                                 "Install the new file only if you are sure or have a backup."
  200.                                 ,szDestFile);
  201.         else if (dwRet & VIF_SRCOLD)
  202.             sprintf(szFailure,    "%s is older than the %s being installed over.\n"
  203.                                 "You should install the older %s if you do not use other versions "
  204.                                 "of VirtualDub, since the newer file may be incompatible."
  205.                                 ,szSource,szDestFile,szSource);
  206.         else if (dwRet & VIF_WRITEPROT)
  207.             sprintf(szFailure,    "The %s being installed over has been marked read-only.\n"
  208.                                 "Override read-only attribute and install anyway?"
  209.                                 ,szDestFile);
  210.         else if (dwRet & VIF_FILEINUSE)
  211.             sprintf(szFailure,    "%s is in use.  It cannot be installed over right now.\n"
  212.                                 "If you have any copies of VirtualDub or any programs that "
  213.                                 "may be using VirtualDub's AVIFile handler, please close them "
  214.                                 "and then click OK to retry the operation."
  215.                                 ,szDestFile);
  216.         else if (dwRet & VIF_OUTOFSPACE)
  217.             sprintf(szFailure,    "Doh! We're out of space trying to write:\n\t%s\n\nCan you clear some up?"
  218.                                 ,szDest);
  219.         else if (dwRet & VIF_ACCESSVIOLATION)
  220.             sprintf(szFailure,    "Access violation.  Check with your administrator to see if you have "
  221.                                 "the appropriate permissions to write to \"%s\"."
  222.                                 ,szDest);
  223.         else if (dwRet & VIF_SHARINGVIOLATION)
  224.             sprintf(szFailure,    "Share violation; something else probably has %s open.  Try closing applications that "
  225.                                 "have the file open, and check permissions on network drives."
  226.                                 ,szDestFile);
  227.         else if (dwRet & VIF_CANNOTCREATE)
  228.             sprintf(szFailure,    "Couldn't create temporary file %s.\nTry again?", szTempFile);
  229.         else if (dwRet & VIF_CANNOTDELETE)
  230.             sprintf(szFailure,    "Couldn't delete temporary file %s.\nTry installing again?", szTempFile);
  231.         else if (dwRet & VIF_CANNOTDELETECUR)
  232.             sprintf(szFailure,    "Couldn't delete existing file \"%s\".\nTry installing again?", szDest);
  233.         else if (dwRet & VIF_CANNOTRENAME)
  234.             sprintf(szFailure,    "Deleted old file %s, but couldn't move %s into its place.\n"
  235.                                 "You should retry this operation.", szDestFile, szSource);
  236.         else if (dwRet & VIF_CANNOTREADSRC)
  237.             sprintf(szFailure,    "Couldn't read source file \"%s\".  Should I try again?"
  238.                                 ,szSource);
  239.         else if (dwRet & VIF_CANNOTREADDST)
  240.             sprintf(szFailure,    "Couldn't read destination file \"%s\".  I can try installing over it "
  241.                                 "anyway, though."
  242.                                 ,szDest);
  243.         else if (dwRet & VIF_OUTOFMEMORY)
  244.             sprintf(szFailure,    "Ran out of memory!  Try freeing some up.");
  245.         else if (dwRet)
  246.             sprintf(szFailure,    "Unidentified error copying:\n\t%s\n\t\tto\n\t%s\n\nTry forcing install?"
  247.                                 ,szSource
  248.                                 ,szDest);
  249.  
  250.         if (szFailure[0])
  251.             if (IDNO==MessageBox(NULL, szFailure, "Install error", MB_YESNO | MB_APPLMODAL))
  252.                 return FALSE;
  253.  
  254.         dwFlags |= VIFF_FORCEINSTALL;
  255.     } while(dwRet);
  256.  
  257.     return TRUE;
  258. }
  259.  
  260. BOOL InstallRegStr(HKEY hkBase, char *szKeyName, char *szName, char *szValue) {
  261.     char buf[256];
  262.  
  263.     if (!SetRegString(hkBase, szKeyName, szName, szValue)) {
  264.         sprintf(buf,"Couldn't set registry key %s\\%s",szKeyName,szName?szName:"(default)");
  265.         MessageBox(NULL, buf, "Install error", MB_OK);
  266.         return FALSE;
  267.     }
  268.  
  269.     return TRUE;
  270. }
  271.  
  272. BOOL InstallDeleteFile(char *szFileFormat, ...) {
  273.     char szFile[256];
  274.     va_list val;
  275.  
  276.     va_start(val, szFileFormat);
  277.     vsprintf(szFile, szFileFormat, val);
  278.     va_end(val);
  279.  
  280.     if (!DeleteFile(szFile))
  281.         if (GetLastError() != ERROR_FILE_NOT_FOUND)
  282.             return FALSE;
  283.  
  284.     return TRUE;
  285. }
  286.  
  287.  
  288. ///////////////////////////////////////
  289.  
  290. BOOL APIENTRY InstallAVIFileDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
  291.     switch(msg) {
  292.         case WM_INITDIALOG:
  293.             {
  294.                 HWND hwndListbox = GetDlgItem(hDlg, IDC_ACTIONLIST);
  295.  
  296.                 SetWindowText(hDlg, "Install AVIFile frameclient");
  297.  
  298.                 ListboxAddf(hwndListbox, "Copy VDREMOTE.DLL to %s\\SYSTEM\\VDREMOTE.DLL", g_szWinPath);
  299.                 ListboxAddf(hwndListbox, "Copy VDSRVLNK.DLL to %s\\SYSTEM\\VDSRVLNK.DLL", g_szWinPath);
  300.                 ListboxAddf(hwndListbox, "Add VDRemote class and AVIFile entries to Registry");
  301.             }
  302.             return TRUE;
  303.  
  304.         case WM_COMMAND:
  305.             switch(LOWORD(wParam)) {
  306.             case IDOK:
  307.                 if (    InstallFile("vdremote.dll","%s\\system\\vdremote.dll",g_szWinPath)
  308.                     &&    InstallFile("vdsvrlnk.dll","%s\\system\\vdsvrlnk.dll",g_szWinPath)
  309.                     &&    InstallRegStr(HKEY_CLASSES_ROOT,"CLSID\\{894288e0-0948-11d2-8109-004845000eb5}",NULL,"VirtualDub link handler")
  310.                     &&    InstallRegStr(HKEY_CLASSES_ROOT,"CLSID\\{894288e0-0948-11d2-8109-004845000eb5}\\InprocServer32",NULL,"vdremote.dll")
  311.                     &&    InstallRegStr(HKEY_CLASSES_ROOT,"CLSID\\{894288e0-0948-11d2-8109-004845000eb5}\\InprocServer32","ThreadingModel","Apartment")
  312.                     &&    InstallRegStr(HKEY_CLASSES_ROOT,"CLSID\\{894288e0-0948-11d2-8109-004845000eb5}\\InprocServer32\\AVIFile",NULL,"1")
  313.                     &&    InstallRegStr(HKEY_CLASSES_ROOT,"AVIFile\\Extensions\\VDR",NULL,"{894288e0-0948-11d2-8109-004845000eb5}")
  314.                     &&    InstallRegStr(HKEY_CLASSES_ROOT,"AVIFile\\RIFFHandlers\\VDRM",NULL,"{894288e0-0948-11d2-8109-004845000eb5}")
  315.                     )
  316.  
  317.                     MessageBox(hDlg, "AVIFile frameclient install successful.", "VirtualDub Setup", MB_OK);
  318.                 else
  319.                     MessageBox(hDlg, "AVIFile frameclient install failed.", "VirtualDub Setup", MB_OK);
  320.  
  321.                 EndDialog(hDlg, TRUE);
  322.                 return TRUE;
  323.             case IDCANCEL:
  324.                 EndDialog(hDlg, FALSE);
  325.                 return TRUE;
  326.             }
  327.     }
  328.     return FALSE;
  329. }
  330.  
  331. BOOL APIENTRY UninstallAVIFileDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
  332.     BOOL fSuccess;
  333.  
  334.     switch(msg) {
  335.         case WM_INITDIALOG:
  336.             {
  337.                 HWND hwndListbox = GetDlgItem(hDlg, IDC_ACTIONLIST);
  338.  
  339.                 SetWindowText(hDlg, "Uninstall AVIFile frameclient");
  340.  
  341.                 ListboxAddf(hwndListbox, "Delete %s\\SYSTEM\\VDREMOTE.DLL", g_szWinPath);
  342.                 ListboxAddf(hwndListbox, "Delete %s\\SYSTEM\\VDSRVLNK.DLL", g_szWinPath);
  343.                 ListboxAddf(hwndListbox, "Remove VDRemote class and AVIFile entries from Registry");
  344.             }
  345.             return TRUE;
  346.  
  347.         case WM_COMMAND:
  348.             switch(LOWORD(wParam)) {
  349.             case IDOK:
  350.                 fSuccess =  InstallDeleteFile("%s\\system\\vdremote.dll",g_szWinPath);
  351.                 fSuccess &= InstallDeleteFile("%s\\system\\vdsvrlnk.dll",g_szWinPath);
  352.  
  353.                 if (    ERROR_SUCCESS != RegDeleteKey(HKEY_CLASSES_ROOT,"Clsid\\{894288e0-0948-11d2-8109-004845000eb5}\\InprocServer32\\AVIFile")
  354.                     ||    ERROR_SUCCESS != RegDeleteKey(HKEY_CLASSES_ROOT,"Clsid\\{894288e0-0948-11d2-8109-004845000eb5}\\InprocServer32")
  355.                     ||    ERROR_SUCCESS != RegDeleteKey(HKEY_CLASSES_ROOT,"Clsid\\{894288e0-0948-11d2-8109-004845000eb5}")
  356.                     ||    ERROR_SUCCESS != RegDeleteKey(HKEY_CLASSES_ROOT,"AVIFile\\Extensions\\VDR")
  357.                     ||    ERROR_SUCCESS != RegDeleteKey(HKEY_CLASSES_ROOT,"AVIFile\\RIFFHandlers\\VDRM"))
  358.  
  359.                     MessageBox(hDlg, "Registry entries were in use.  Deinstall not successful.\n"
  360.                                     "\n"
  361.                                     "A partial installation now exists on your system.  Reinstall the AVIFile "
  362.                                     "handler to restore frameclient functionality, or close applications that may "
  363.                                     "be occupying the Registry entries and retry the deinstall."
  364.                                     ,"VirtualDub Setup",MB_OK);
  365.  
  366.                 else if (!fSuccess)
  367.                     MessageBox(hDlg, "DLL files were in use.  Deinstall not successful.\n"
  368.                                     "\n"
  369.                                     "A partial installation now exists on your system.  Reinstall the AVIFile "
  370.                                     "handler to restore frameclient functionality, or close applications that may "
  371.                                     "be occupying the shared DLLs and retry the deinstall."
  372.                                     ,"VirtualDub Setup",MB_OK);
  373.                 else
  374.                     MessageBox(hDlg, "AVIFile frameclient deinstall successful.", "VirtualDub Setup", MB_OK);
  375.  
  376.                 EndDialog(hDlg, TRUE);
  377.                 return TRUE;
  378.             case IDCANCEL:
  379.                 EndDialog(hDlg, FALSE);
  380.                 return TRUE;
  381.             }
  382.     }
  383.     return FALSE;
  384. }
  385.  
  386. ///////////////////////////////////////////////
  387.  
  388. void RemoveVirtualDubKeys(HWND hwndListbox) {
  389.     FILETIME ftModified;
  390.     int i;
  391.     LONG err;
  392.     char szKeyName[MAX_PATH];
  393.     char szErrorText[128];
  394.     DWORD dwKeyNameLen;
  395.  
  396.     SendMessage(hwndListbox, LB_RESETCONTENT, 0, 0);
  397.  
  398.     i=0;
  399.     for(;;) {
  400.         dwKeyNameLen = sizeof szKeyName;
  401.         err = RegEnumKeyEx(HKEY_USERS, i++, szKeyName, &dwKeyNameLen, 0, NULL, 0, &ftModified);
  402.  
  403.         if (err == ERROR_NO_MORE_ITEMS)
  404.             break;
  405.         else if (err == ERROR_SUCCESS) {
  406.             HKEY hkeyUser;
  407.             char *bp = szKeyName + strlen(szKeyName);
  408.             
  409.             err = RegOpenKeyEx(HKEY_USERS, szKeyName, 0, KEY_ALL_ACCESS, &hkeyUser);
  410.             if (err != ERROR_SUCCESS) {
  411.                 FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, err, 0, szErrorText, sizeof szErrorText, NULL);
  412.                 ListboxAddf(hwndListbox, "HKEY_USERS\\%s: %s", szKeyName, szErrorText);
  413.                 continue;
  414.             }
  415.  
  416.             strcpy(bp, "\\Software\\Freeware\\VirtualDub\\Capture");
  417.  
  418.             err = RegDeleteKey(HKEY_USERS,szKeyName);
  419.             if (err != ERROR_SUCCESS && err != ERROR_FILE_NOT_FOUND)
  420.                 FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, err, 0, szErrorText, sizeof szErrorText, NULL);
  421.             else
  422.                 strcpy(szErrorText, "Deleted");
  423.             ListboxAddf(hwndListbox, "HKEY_USERS\\%s: %s", szKeyName, szErrorText);
  424.  
  425.             strcpy(bp, "\\Software\\Freeware\\VirtualDub\\MRUList");
  426.  
  427.             err = RegDeleteKey(HKEY_USERS,szKeyName);
  428.             if (err != ERROR_SUCCESS && err != ERROR_FILE_NOT_FOUND)
  429.                 FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, err, 0, szErrorText, sizeof szErrorText, NULL);
  430.             else
  431.                 strcpy(szErrorText, "Deleted");
  432.             ListboxAddf(hwndListbox, "HKEY_USERS\\%s: %s", szKeyName, szErrorText);
  433.  
  434.             bp[29]=0;
  435.  
  436.             err = RegDeleteKey(HKEY_USERS,szKeyName);
  437.             if (err != ERROR_SUCCESS && err != ERROR_FILE_NOT_FOUND)
  438.                 FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, err, 0, szErrorText, sizeof szErrorText, NULL);
  439.             else
  440.                 strcpy(szErrorText, "Deleted");
  441.             ListboxAddf(hwndListbox, "HKEY_USERS\\%s: %s", szKeyName, szErrorText);
  442.  
  443.             RegCloseKey(hkeyUser);
  444.         }
  445.     }
  446. }
  447.  
  448. BOOL APIENTRY RemoveSettingsDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
  449.     switch(msg) {
  450.         case WM_INITDIALOG:
  451.             {
  452.                 HWND hwndListbox = GetDlgItem(hDlg, IDC_ACTIONLIST);
  453.  
  454.                 SetWindowText(hDlg, "Remove VirtualDub preference data");
  455.  
  456.                 ListboxAddf(hwndListbox, "Remove HKEY_USERS\\*\\Software\\Freeware\\VirtualDub\\*");
  457.             }
  458.             return TRUE;
  459.  
  460.         case WM_COMMAND:
  461.             switch(LOWORD(wParam)) {
  462.             case IDOK:
  463.                 SetWindowText(GetDlgItem(hDlg, IDC_ACTION), "Results:");
  464.  
  465.                 RemoveVirtualDubKeys(GetDlgItem(hDlg, IDC_ACTIONLIST));
  466.  
  467.                 SetWindowText(GetDlgItem(hDlg, IDOK), "Retry");
  468.                 SetWindowText(GetDlgItem(hDlg, IDCANCEL), "Done");
  469.                 return TRUE;
  470.             case IDCANCEL:
  471.                 EndDialog(hDlg, FALSE);
  472.                 return TRUE;
  473.             }
  474.     }
  475.     return FALSE;
  476. }
  477.  
  478.  
  479. ///////////////////////////////////////////////////////////////////////////
  480. //
  481. //    About...
  482. //
  483. ///////////////////////////////////////////////////////////////////////////
  484.  
  485. BOOL APIENTRY AboutDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
  486.     switch(msg) {
  487.         case WM_INITDIALOG:
  488.             SetDlgItemText(hDlg, IDC_FINALS_SUCK,
  489. #ifdef _DEBUG
  490.                 "Debug build"
  491. #else
  492.                 "Release build"
  493. #endif
  494.                 " ("__DATE__" "__TIME__")");
  495.  
  496.             return TRUE;
  497.  
  498.         case WM_COMMAND:
  499.             switch(LOWORD(wParam)) {
  500.             case IDOK:
  501.             case IDCANCEL:
  502.                 EndDialog(hDlg, FALSE);
  503.                 return TRUE;
  504.             }
  505.     }
  506.     return FALSE;
  507. }
  508.