Ejemplo n.º 1
0
/**
 * Checks if IE is not running asking user to close it automatically/manually if it is.
 * @returns TRUE iff IE is no longer running.
 */
EXPORTED(BOOL, EnsureIENotRunning)(BOOL isInstalling, BOOL silent)
{
  DWORD startTime;

  if (GetIEFrameHandle())
  {
    // Prompt the user to let the IE be closed automatically.
    if (!isInstalling || !silent)
    {
      if (!AskUser(FALSE, isInstalling))
      {
        return FALSE;
      }
    }

    // Keep trying to close IE for limited amount of milliseconds only.
    startTime = GetTickCount();
    HWND hwnd;
    while ((GetTickCount() - startTime < 10000) && (hwnd = GetIEFrameHandle()))
    {
      PostMessage(hwnd, WM_CLOSE, 0, 0);
      Sleep(100);
    }
  }

  // Still no success? Prompt the user to do it manually then.
  if (GetIEFrameHandle())
  {
    return WaitForManualIEClose(isInstalling, silent);
  } else {
    return TRUE;
  }
}
 virtual void Execute() final override {
     char* name = AskUser();
     if (0 != name) {
         Document* document = new Document(name);
         _application->Add(document);
         document->Open();
     }
 }
Ejemplo n.º 3
0
void OpenCommand::Execute()
{
    const char* name = AskUser();
    if(name != NULL)
    {
        Document* document = new Document(name);
        _application->Add(document);
        document->Open();
    }
}
Ejemplo n.º 4
0
// ****************************************************************************
//
//  Function Name:	AskUser::InformUser( )
//
//  Description:		Ask the user a question with an inform icon and OK
//							button.
//							Retrieve the message from a resource file.
//
//  Returns:			kAlertYes
//
//  Exceptions:		None
//
// ****************************************************************************
//
YAlertValues	RAlert::AskUser( YResourceId informId )
	{
	RMBCString	string = GetResourceManager().GetResourceString( informId );
#ifdef	TPSDEBUG
	char	buffer[128];
	buffer[0] = '\0';
	WinCode( wsprintf( buffer, " - %d", informId ) );
	string += buffer;
#endif
	return AskUser( (LPCSZ)string );
	}
Ejemplo n.º 5
0
static BOOL WaitForManualIEClose(BOOL isInstalling, BOOL silent)
{
  while (GetIEFrameHandle())
  {
    if (isInstalling && silent)
    {
      return FALSE;
    } else if (!AskUser(TRUE, isInstalling)) {
      return FALSE;
    }
  }
  return TRUE;
}
Ejemplo n.º 6
0
int main()
	{
	// ************************* begin modifiable *****************************************

	// *************************** end modifiable *****************************************

	char answer = AskUser("\nPress y to quit...");
	if (answer == '\0')
		std::cerr << "Oops, something bad happened in the AskUser function." << std::endl;
	else if (answer == 'y')
		std::cerr << "\nYou pressed y so I'm quitting" << std::endl;
	else
		std::cerr << "\nYou pressed " << answer << " but I'm quitting anyway!" << std::endl;
 
	return 0;
	}
Ejemplo n.º 7
0
Archivo: udcexp.c Proyecto: juddy/edcde
void createbdf(Exc_data * ed)
{
    int i = 0;
    char *comment_list[] = {""};
    int comment_num = 0;
    char *msg;
    int	ans;

    msg = GETMESSAGE(10, 2, "Failed to make the BDF file");

    i =  ExpGpftoBDF(ed->fontfile, ed->bdffile,
		     ed->code_num, ed->gpf_code_list,
		     comment_num, comment_list, 0);
    if (i != 0) {
	AskUser(ed->toplevel, ed, msg, &ans, "error");
    }
    excterminate(ed);
}
Ejemplo n.º 8
0
Archivo: main.c Proyecto: Ribtoks/heap
int main()
{
    FuncFactory stringFunctions;

    SkipList* list = 0;

    FILE* out = 0;

    InitStringFactoryStruct(&stringFunctions);
    list = CreateSkipList(&stringFunctions);

    memset(filename, '\0', MAX_FILENAME_LENGTH*sizeof(char));

    printf("Enter filename :> ");
    gets(filename);


    ProcessFile(filename, list);

    printf("\nAll words:\n");


    PrintList(list);

    if (AskUser("Print results to file?"))
    {
        if ((out = fopen("results.txt", "w+")) == NULL)
        {
            printf("Cannot open file. Press any key to exit.\n");
            getchar();
            exit(-1);
        }

        PrintListToFile(out, FilePrinter, list);
    }

    CleanupList(list);

    printf("Done.\n\nPress any key to exit...");
    getchar();
    return 0;
}
Ejemplo n.º 9
0
void filesbokCB(Widget widget, Exc_data * ed, XtPointer call_data)
{
    XmFileSelectionBoxCallbackStruct	*ptr;
    char				*file = NULL, *dir = NULL, *tmpfile;
    int					r, ans = 0;
    char				*msg1;
    char				*msg2;

    msg1 = GETMESSAGE(2, 4, "The selected file exists. Overwrite?");
    msg2 = GETMESSAGE(2, 6, "Failed to open the selected file.");

    ptr = (XmFileSelectionBoxCallbackStruct *) call_data;

    file = (char *)  _XmStringUngenerate((XmString) ptr->value, NULL,
					  XmMULTIBYTE_TEXT, XmMULTIBYTE_TEXT);
    if (!file) {
	return;
    }

    dir = (char *)  _XmStringUngenerate((XmString) ptr->dir, NULL,
					  XmMULTIBYTE_TEXT, XmMULTIBYTE_TEXT);
    if (!dir) {
	return;
    } else {
	if (*file != '/') {
	    if ((tmpfile = XtMalloc(strlen(dir) + 1 + strlen(file) + 1))
		== NULL) {
		excerror(ed, EXCERRMALLOC, "filesbokCB", "exit");
	    }
	    sprintf(tmpfile, "%s/%s", dir, file);
	    XtFree(file);
	    file = tmpfile;
	}
    }

    r = fopencheck(file, dir, ed->bdfmode);
    if (r == 0) {/* no problem */
	/*fprintf(stderr, "%s will be opened\n", file);*/
    } else if (r == 1) { /* file exist at export function */
	AskUser(widget, ed, msg1, &ans, "warning");
	if (ans != 1) { /* overwrite cancel */
	    freeStrings(dir, file);
	    return;
	}
    } else { /* file will not be opened */
	AskUser(widget, ed, msg2, &ans, "error");
	freeStrings(dir, file);
	return;
    }
    ed->bdffile = (char *) malloc(strlen(file) + 1);
    strcpy(ed->bdffile, file);
    freeStrings(dir, file);
    XtUnmanageChild(widget);
    if (ed->function == EXPORT)
    {
	createbdf(ed);
    } else if (ed->function == IMPORT)
    {
	PopupSelectXLFD(ed->toplevel);
    }
}