Back to index

lightning-sunbird  0.9+nobinonly
Functions
dialogs.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

MRESULT APIENTRY DlgProcUninstall (HWND hDlg, ULONG msg, MPARAM mp1, MPARAM mp2)
MRESULT APIENTRY DlgProcWhatToDo (HWND hDlg, ULONG msg, MPARAM mp1, MPARAM mp2)
MRESULT APIENTRY DlgProcMessage (HWND hDlg, ULONG msg, MPARAM mp1, MPARAM mp2)
void ParseAllUninstallLogs ()
HWND InstantiateDialog (HWND hParent, ULONG ulDlgID, PSZ szTitle, PFNWP pfnwpDlgProc)
void ShowMessage (PSZ szMessage, BOOL bShow)
void ProcessWindowsMessages (void)

Function Documentation

MRESULT APIENTRY DlgProcMessage ( HWND  hDlg,
ULONG  msg,
MPARAM  mp1,
MPARAM  mp2 
)

Definition at line 2156 of file dialogs.c.

{
  SWP       swpDlg;
  HWND      hSTMessage = WinWindowFromID(hDlg, IDC_MESSAGE); /* handle to the Static Text message window */
  HPS       hpsSTMessage;
  RECTL     rectlString;
  char      szBuf[MAX_BUF];
  char      szBuf2[MAX_BUF];

  memset(szBuf, 0, sizeof(szBuf));
  memset(szBuf2, 0, sizeof(szBuf2));

  switch(msg)
  {
    case WM_INITDLG:
      AdjustDialogSize(hDlg);
      WinSetPresParam(hDlg, PP_FONTNAMESIZE,
                      strlen(sgInstallGui.szDefinedFont)+1, sgInstallGui.szDefinedFont);
      if(GetPrivateProfileString("Messages", "STR_MESSAGEBOX_TITLE", "", szBuf2, sizeof(szBuf2), szFileIniInstall))
      {
        if((sgProduct.szProductName != NULL) && (*sgProduct.szProductName != '\0'))
          sprintf(szBuf, szBuf2, sgProduct.szProductName);
        else
          sprintf(szBuf, szBuf2, "");
      }
      else if((sgProduct.szProductName != NULL) && (*sgProduct.szProductName != '\0'))
        strcpy(szBuf, sgProduct.szProductName);

      WinSetWindowText(hDlg, szBuf);
      WinQueryWindowPos(hDlg, &swpDlg);
      WinSetWindowPos(hDlg,
                      HWND_TOP,
                      (gSystemInfo.lScreenX/2)-(swpDlg.cx/2),
                      (gSystemInfo.lScreenY/2)-(swpDlg.cy/2),
                      0,
                      0,
                      SWP_MOVE);

      break;

    case WM_CLOSE:
      AskCancelDlg(hDlg);
      return (MRESULT)TRUE;
      break;

    case WM_COMMAND:
      switch ( SHORT1FROMMP( mp1 ) )
      {
        case IDC_MESSAGE:
          hpsSTMessage = WinGetPS(hSTMessage);

          rectlString.xLeft = 0;
          rectlString.xRight = 10000;
          rectlString.yTop = 10000;
          rectlString.yBottom = 0;
          WinDrawText(hpsSTMessage, strlen((char*)mp2), (char*)mp2,
                            &rectlString, 0, 0,
                            DT_BOTTOM | DT_QUERYEXTENT | DT_TEXTATTRS | DT_WORDBREAK);
          WinReleasePS(hpsSTMessage);

          WinSetWindowPos(hDlg, HWND_TOP,
                      (gSystemInfo.lScreenX/2)-((rectlString.xRight + 55)/2),
                      (gSystemInfo.lScreenY/2)-((rectlString.yTop + 50)/2),
                      rectlString.xRight + 55,
                      rectlString.yTop + 50,
                      SWP_SIZE | SWP_MOVE);

          WinQueryWindowPos(hDlg, &swpDlg);

          WinSetWindowPos(hSTMessage,
                         HWND_TOP,
                         gSystemInfo.lDlgFrameX,
                         gSystemInfo.lDlgFrameY,
                         swpDlg.cx-2*gSystemInfo.lDlgFrameX,
                         swpDlg.cy-2*gSystemInfo.lDlgFrameY-gSystemInfo.lTitleBarY,
                         SWP_SIZE | SWP_MOVE);

          WinSetDlgItemText(hDlg, IDC_MESSAGE, (PSZ)mp2);
          return (MRESULT)TRUE;
          break;
      }
      break;
  }
  return(WinDefDlgProc(hDlg, msg, mp1, mp2));
}

Here is the call graph for this function:

MRESULT APIENTRY DlgProcUninstall ( HWND  hDlg,
ULONG  msg,
MPARAM  mp1,
MPARAM  mp2 
)

Definition at line 91 of file dialogs.c.

{
  char  szBuf[MAX_BUF];
  SWP   swpDlg;

  switch(msg)
  {
    case WM_INITDLG:
      WinSetPresParam(hDlg, PP_FONTNAMESIZE,
                      strlen(ugUninstall.szDefinedFont)+1, ugUninstall.szDefinedFont);
      WinSetWindowText(hDlg, diUninstall.szTitle);
      sprintf(szBuf, diUninstall.szMessage0, ugUninstall.szDescription);
      WinSetDlgItemText(hDlg, IDC_MESSAGE0, szBuf);
      GetPrivateProfileString("Dialog Uninstall", "Yes", "", szBuf, sizeof(szBuf), szFileIniUninstall);
      WinSetDlgItemText(hDlg, IDWIZNEXT, szBuf);
      GetPrivateProfileString("Dialog Uninstall", "No", "", szBuf, sizeof(szBuf), szFileIniUninstall);
      WinSetDlgItemText(hDlg, DID_CANCEL, szBuf);

      WinQueryWindowPos(hDlg, &swpDlg);
      WinSetWindowPos(hDlg,
                      HWND_TOP,
                      (ulScreenX/2)-(swpDlg.cx/2),
                      (ulScreenY/2)-(swpDlg.cy/2),
                      0,
                      0,
                      SWP_MOVE);
      break;

    case WM_COMMAND:
      switch ( SHORT1FROMMP( mp1 ) )
      {
        case IDWIZNEXT:
          WinEnableWindow(WinWindowFromID(hDlg, IDWIZNEXT), FALSE);
          WinEnableWindow(WinWindowFromID(hDlg, DID_CANCEL), FALSE);
          ParseAllUninstallLogs();
          WinDestroyWindow(hDlg);
          WinPostQueueMsg(0, WM_QUIT, 0, 0);
          break;

        case DID_CANCEL:
          WinDestroyWindow(hDlg);
          WinPostQueueMsg(0, WM_QUIT, 0, 0);
          break;

        default:
          break;
      }
      break;
  }
  return(WinDefDlgProc(hDlg, msg, mp1, mp2));
}

Here is the call graph for this function:

MRESULT APIENTRY DlgProcWhatToDo ( HWND  hDlg,
ULONG  msg,
MPARAM  mp1,
MPARAM  mp2 
)

Definition at line 143 of file dialogs.c.

{
  char  szBuf[MAX_BUF];
  SWP   swpDlg;

  switch(msg)
  {
    case WM_INITDLG:
      WinSetPresParam(hDlg, PP_FONTNAMESIZE,
                      strlen(ugUninstall.szDefinedFont)+1, ugUninstall.szDefinedFont);
      GetPrivateProfileString("Messages", "DLG_REMOVE_FILE_TITLE", "", szBuf, sizeof(szBuf), szFileIniUninstall);
      WinSetWindowText(hDlg, szBuf);

      if((PSZ)mp2 != NULL)
        WinSetDlgItemText(hDlg, IDC_STATIC_SHARED_FILENAME, (PSZ)mp2);

      GetPrivateProfileString("Dialog Uninstall", "Message1", "", szBuf, sizeof(szBuf), szFileIniUninstall);
      WinSetDlgItemText(hDlg, IDC_MESSAGE0, szBuf);
      GetPrivateProfileString("Dialog Uninstall", "Message2", "", szBuf, sizeof(szBuf), szFileIniUninstall);
      WinSetDlgItemText(hDlg, IDC_MESSAGE1, szBuf);
      GetPrivateProfileString("Dialog Uninstall", "FileName", "", szBuf, sizeof(szBuf), szFileIniUninstall);
      WinSetDlgItemText(hDlg, IDC_STATIC, szBuf);
      GetPrivateProfileString("Dialog Uninstall", "No", "", szBuf, sizeof(szBuf), szFileIniUninstall);
      WinSetDlgItemText(hDlg, ID_NO, szBuf);
      GetPrivateProfileString("Dialog Uninstall", "NoToAll", "", szBuf, sizeof(szBuf), szFileIniUninstall);
      WinSetDlgItemText(hDlg, ID_NO_TO_ALL, szBuf);
      GetPrivateProfileString("Dialog Uninstall", "Yes", "", szBuf, sizeof(szBuf), szFileIniUninstall);
      WinSetDlgItemText(hDlg, ID_YES, szBuf);
      GetPrivateProfileString("Dialog Uninstall", "YesToAll", "", szBuf, sizeof(szBuf), szFileIniUninstall);
      WinSetDlgItemText(hDlg, ID_YES_TO_ALL, szBuf);

      /* Center dialog */
      WinQueryWindowPos(hDlg, &swpDlg);
      WinSetWindowPos(hDlg,
                      HWND_TOP,
                      (ulScreenX/2)-(swpDlg.cx/2),
                      (ulScreenY/2)-(swpDlg.cy/2),
                      0,
                      0,
                      SWP_MOVE);
      break;

    case WM_COMMAND:
      switch ( SHORT1FROMMP( mp1 ) )
      {
        case ID_NO:
          WinDismissDlg(hDlg, WTD_NO);
          break;

        case ID_NO_TO_ALL:
          WinDismissDlg(hDlg, WTD_NO_TO_ALL);
          break;

        case ID_YES:
          WinDismissDlg(hDlg, WTD_YES);
          break;

        case ID_YES_TO_ALL:
          WinDismissDlg(hDlg, WTD_YES_TO_ALL);
          break;

        default:
          break;
      }
      break;
  }
  return(WinDefDlgProc(hDlg, msg, mp1, mp2));
}

Here is the call graph for this function:

HWND InstantiateDialog ( HWND  hParent,
ULONG  ulDlgID,
PSZ  szTitle,
PFNWP  pfnwpDlgProc 
)

Definition at line 2347 of file dialogs.c.

{
  char szBuf[MAX_BUF];
  HWND hDlg = NULL;


  if((hDlg = CreateDialog(hSetupRscInst, MAKEINTRESOURCE(dwDlgID), hParent, wpDlgProc)) == NULL)
  {
    char szEDialogCreate[MAX_BUF];

    if(GetPrivateProfileString("Messages", "ERROR_DIALOG_CREATE", "", szEDialogCreate, sizeof(szEDialogCreate), szFileIniInstall))
    {
      wsprintf(szBuf, szEDialogCreate, szTitle);
      PrintError(szBuf, ERROR_CODE_SHOW);
    }
    PostQuitMessage(1);
  }

  return(hDlg);
}

Definition at line 225 of file dialogs.c.

{
  char  szFileInstallLog[MAX_BUF];
  char  szKey[MAX_BUF];
  sil   *silFile;
  DWORD dwFileFound;
  DWORD dwRv = 0;

  UndoDesktopIntegration();
  CleanupMailIntegration();
  dwFileFound = GetLogFile(ugUninstall.szLogPath, ugUninstall.szLogFilename, szFileInstallLog, sizeof(szFileInstallLog));
  while(dwFileFound)
  {
    if((silFile = InitSilNodes(szFileInstallLog)) != NULL)
    {
      FileDelete(szFileInstallLog);
      dwRv = Uninstall(silFile);
      DeInitSilNodes(&silFile);
      if(dwRv == WTD_CANCEL)
        break;
    }

    dwFileFound = GetLogFile(ugUninstall.szLogPath, ugUninstall.szLogFilename, szFileInstallLog, sizeof(szFileInstallLog));
  }

  if(dwRv != WTD_CANCEL)
  {
    lstrcpy(szFileInstallLog, ugUninstall.szLogPath);
    AppendBackSlash(szFileInstallLog, MAX_BUF);
    lstrcat(szFileInstallLog, ugUninstall.szLogFilename);
    if(FileExists(szFileInstallLog))
    {
      if((silFile = InitSilNodes(szFileInstallLog)) != NULL)
      {
        FileDelete(szFileInstallLog);
        Uninstall(silFile);
        DeInitSilNodes(&silFile);
      }
    }

    /* clean up the uninstall windows registry key */
    lstrcpy(szKey, "Software\\Microsoft\\Windows\\CurrentVersion\\uninstall\\");
    lstrcat(szKey, ugUninstall.szUninstallKeyDescription);
    RegDeleteKey(HKEY_LOCAL_MACHINE, szKey);

    // Calling SHChangeNotify() will update the file association icons
    // in case they had been reset.
    SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL);

    // Note completion of the uninstall process.
    gbUninstallCompleted = TRUE;
  }

  /* Broadcast message only if the windows registry keys exist
   * in case they were changed during uninstallation.  If they
   * were, then the broadcast will alert the OS to update the appropriate UIs.
   * This needs to be done regardless if the user canceled the uninstall
   * process or not.
   */
  if(WinRegKeyExists(HKEY_LOCAL_MACHINE, MOZ_CLIENT_BROWSER_KEY))
  {
    SendMessageTimeout(HWND_BROADCAST,
                       WM_SETTINGCHANGE,
                       0,
                       (LPARAM)MOZ_CLIENT_BROWSER_KEY,
                       SMTO_NORMAL|SMTO_ABORTIFHUNG,
                       MOZ_HWND_BROADCAST_MSG_TIMEOUT,
                       NULL);
  }
  if(WinRegKeyExists(HKEY_LOCAL_MACHINE, MOZ_CLIENT_MAIL_KEY))
  {
    SendMessageTimeout(HWND_BROADCAST,
                       WM_SETTINGCHANGE,
                       0,
                       (LPARAM)MOZ_CLIENT_MAIL_KEY,
                       SMTO_NORMAL|SMTO_ABORTIFHUNG,
                       MOZ_HWND_BROADCAST_MSG_TIMEOUT,
                       NULL);
  }
}

Definition at line 2336 of file dialogs.c.

{
  MSG msg;

  while(PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
  {
    TranslateMessage(&msg);
    DispatchMessage(&msg);
  }
}
void ShowMessage ( PSZ  szMessage,
BOOL  bShow 
)

Definition at line 2312 of file dialogs.c.

{
  if(sgProduct.mode != SILENT)
  {
    if(bShow && szMessage)
    {
      char szBuf[MAX_BUF];
 
      ZeroMemory(szBuf, sizeof(szBuf));
      GetPrivateProfileString("Messages", "MB_MESSAGE_STR", "", szBuf, sizeof(szBuf), szFileIniInstall);
      hDlgMessage = InstantiateDialog(hWndMain, DLG_MESSAGE, szBuf, DlgProcMessage);
      SendMessage(hDlgMessage, WM_COMMAND, IDC_MESSAGE, (LPARAM)szMessage);
    }
    else
    {
      DestroyWindow(hDlgMessage);
      hDlgMessage = NULL;
    }
  }
}