Example #1
0
void CJComboBox::Draw()
{
	if( !IsVision() ) return;

	DrawSelectedItem();

	if( m_pDropButton )
		m_pDropButton->Draw();

	if( !m_bOwnerDraw )
		OwnerDraw();
}
Example #2
0
BOOL WINPROC EXPORT DlgGalleryProc(
    /***********************************************************************/
    HWND 	hDlg,
    UINT 	msg,
    WPARAM 	wParam,
    LPARAM 	lParam)
{
    FNAME	szTitleSave;
    BOOL	bUntitledSave;

    switch (msg)
    {
    case WM_INITDIALOG:
        SetControlFont (hDlg, IDC_GALLERY_T1);
        SetControlFont (hDlg, IDC_GALLERY_T2);
        SetControlFont (hDlg, IDC_GALLERY_T3);
        SetControlFont (hDlg, IDC_GALLERY_T4);
        RibbonInit( hDlg );
    // fall thru...

    case WM_CONTROLENABLE:
    case WM_DOCACTIVATED:
        break;

    case WM_SETCURSOR:
        return( SetupCursor( wParam, lParam, IDD_FILL ) );

    case WM_ERASEBKGND:
        break; // handle ERASEBKGND and do nothing; PAINT covers everything

    case WM_PAINT:
        LayoutPaint( hDlg );
        break;

    case WM_CLOSE:
        AstralDlgEnd( hDlg, NO|2);
        break;

    case WM_MEASUREITEM:
    case WM_DRAWITEM:
        return( OwnerDraw( hDlg, msg, lParam, NO ) );

    case WM_CTLCOLOR:
        return( (BOOL)SetControlColors( (HDC)wParam, hDlg, (HWND)LOWORD(lParam),
                                        HIWORD(lParam) ) );

    case WM_COMMAND:
        switch (wParam)
        {
        case IDC_GALLERY_T1:	// Save to Disk
            SendMessage( hWndAstral, WM_COMMAND, IDM_SAVESPECIAL, 0L );
            break;

        case IDC_GALLERY_T2:	// Print
            SendMessage( hWndAstral, WM_COMMAND, IDM_PRINT, 0L );
            break;

        case IDC_GALLERY_T3:	// To Floppy
            bSaving = TRUE;
            AstralDlg (NO|2, hInstAstral, hDlg, IDD_SAVEFLOPPY, (DLGPROC)DlgFloppyProc);
            if (szFileSpec[0] != 0)
            {
                bUntitledSave = lpImage->fUntitled;
                lpImage->fUntitled = FALSE;
                lstrcpy (szTitleSave, lpImage->CurFile);
                lstrcpy (lpImage->CurFile, szFileSpec);
                SendMessage (hWndAstral, WM_COMMAND, IDM_SAVESPECIAL, 0L);
                lstrcpy (lpImage->CurFile, szTitleSave);
                lpImage->fUntitled = bUntitledSave;
            }
            break;

        case IDC_GALLERY_T4:	// From Floppy
            bSaving = FALSE;
            AstralDlg (NO|2, hInstAstral, hDlg, IDD_LOADFLOPPY, (DLGPROC)DlgFloppyProc);
            if (szFileSpec[0] != 0)
            {
                AstralImageLoad (IDN_ART, szFileSpec, MAYBE, NO);
            }
            break;

        default:
            return( FALSE );
        }

    default:
        return( FALSE );
    }

    return( TRUE );
}
Example #3
0
BOOL WINPROC EXPORT DlgTextProc(
/***********************************************************************/
HWND 	hDlg,
UINT 	msg,
WPARAM 	wParam,
LPARAM 	lParam)
{
int i;
WORD wKey;
HFONT hFont;
STRING szString;

switch (msg)
    {
    case WM_INITDIALOG:
	RibbonInit( hDlg );
	ColorInit( hDlg );
	GetFonts( hDlg );
	CheckRadioButton( hDlg, IDC_TEXT_T1, IDC_TEXT_T10, Text.nFont+IDC_TEXT_T1 );
	Text.Size = 48;
	InitSlide( hDlg, IDC_TEXT_SIZE, Text.Size, 24, 200 );
	Text.Angle = 0;
	InitSlide( hDlg, IDC_TEXT_ANGLE, 0, -2, 2 );
	ControlEnable(hDlg, IDC_TEXT_ANGLE, TextCanRotate(hDlg, Text.nFont));
	for ( i=0; i<max(10,Text.nFont); i++ )
		{
		hFont = CreateFont(
				/* Height */ 45,
				/* Width */ 0,
				/* Escapement */ 0,
				/* Orientation */ 0,
				/* Weight */ FW_NORMAL,
				/* Italic */ FALSE,
				/* UnderLine */ FALSE,
				/* StrikeOut */ FALSE,
				/* CharSet */ Text.lpFontList[i].fdCharSet,
				/* Output Precis */ OUT_CHARACTER_PRECIS,
				/* Clip Precis */ CLIP_DEFAULT_PRECIS,
				/* Quality */ PROOF_QUALITY,
				/* PitchAndFamily */ Text.lpFontList[i].fdPitchAndFamily,
				/* Face */ Text.lpFontList[i].fdFaceName );
		if ( hFont )
			SendDlgItemMessage( hDlg, IDC_TEXT_T1+i, WM_SETFONT, (WPARAM)hFont, 0L );
		}
	if ( lpImage )
		{
		bTextBegun = TextBegin( lpImage->hWnd, 10/*x*/, 40/*y*/ );
		Tool.bActive = YES;
		SetFocus( lpImage->hWnd );
		}
	else
		bTextBegun = NO;
	// fall thru

    case WM_CONTROLENABLE:
    case WM_DOCACTIVATED:
	break;

	case WM_DESTROY:
	if ( bTextBegun )
		{
		if ( lpImage )
			{
			TextEnd( lpImage->hWnd, NO/*fCancel*/ );
			Tool.bActive = NO;
			AstralUpdateWindow( lpImage->hWnd );
			}
		bTextBegun = NO;
		}
	for ( i=0; i<max(10,Text.nFont); i++ )
		{
		if ( hFont = (HFONT)SendDlgItemMessage( hDlg, IDC_TEXT_T1+i, WM_GETFONT, (WPARAM)0, 0L ) )
			DeleteObject( hFont );
		}
	if ( Text.lpFontList )
		{
		FreeUp((LPTR)Text.lpFontList);
		Text.lpFontList = NULL;
		}
	break;

    case WM_CHAR:
	if ( !lpImage || !bTextBegun )
		return( FALSE );
	TextSetFocus();
	wKey = (WORD)lParam;
	TextKeystroke( lpImage->hWnd, wKey );
	if ( wKey == VK_RETURN )
		{
		TextAnchor( lpImage->hWnd );
		RandomizeActiveColor();
		break;
		}
	szString[0] = '_';
	szString[1] = wKey;
	szString[2] = '\0';
	Lowercase( szString );
	SoundStartResource( szString, NO/*bLoop*/, NULL/*hInstance*/ );
	break;

    case WM_KEYDOWN:
	if ( !lpImage || !bTextBegun )
		return( FALSE );
	wKey = lParam;
	switch (wKey)
		{
		case VK_UP:
			TextRMove( lpImage->hWnd, 0, -1 );
			break;
		case VK_DOWN:
			TextRMove( lpImage->hWnd, 0, 1);
			break;
		case VK_LEFT:
			TextRMove( lpImage->hWnd, -1, 0);
			break;
		case VK_RIGHT:
			TextRMove( lpImage->hWnd, 1, 0);
			break;
		default:
			break;
		}
	break;

    case WM_SETCURSOR:
	return( SetupCursor( wParam, lParam, IDD_TEXT ) );

    case WM_ERASEBKGND:
	break; // handle ERASEBKGND and do nothing; PAINT covers everything

    case WM_PAINT:
	LayoutPaint( hDlg );
	break;

    case WM_CLOSE:
	AstralDlgEnd( hDlg, FALSE );
	break;

    case WM_MEASUREITEM:
    case WM_DRAWITEM:
	return( OwnerDraw( hDlg, msg, lParam, NO ) );

    case WM_CTLCOLOR:
// We don't get this message
//	Print( "%u", HIWORD(lParam) );
//	if ( HIWORD(lParam) == CTLCOLOR_BTN )
//		{
//		SetTextColor( (HDC)wParam, RGB(0,0,255) ); // Blue text...
//		SetBkColor( (HDC)wParam, RGB(255,255,255) ); // on a white background
//		return( GetStockObject(WHITE_BRUSH) );
//		}
	return( (BOOL)SetControlColors( (HDC)wParam, hDlg, (HWND)LOWORD(lParam),
		HIWORD(lParam) ) );

    case WM_COMMAND:
	switch (wParam)
	    {
		case IDC_ACTIVECOLOR:
		case IDC_COLORS_TEXT:
		ColorCommand( hDlg, wParam, lParam );
		TextSetFocus();
		if (bTextBegun)
			TextFontChanged(lpImage->hWnd);
		break;

		case IDC_TEXT_T1:
		case IDC_TEXT_T2:
		case IDC_TEXT_T3:
		case IDC_TEXT_T4:
		case IDC_TEXT_T5:
		case IDC_TEXT_T6:
		case IDC_TEXT_T7:
		case IDC_TEXT_T8:
		case IDC_TEXT_T9:
		case IDC_TEXT_T10:
		CheckRadioButton( hDlg, IDC_TEXT_T1, IDC_TEXT_T10, wParam );
		Text.nFont = wParam - IDC_TEXT_T1;
		ControlEnable(hDlg, IDC_TEXT_ANGLE, TextCanRotate(hDlg, Text.nFont));
		TextSetFocus();
		if (bTextBegun)
			TextFontChanged(lpImage->hWnd);
		break;

	    case IDC_TEXT_SIZE:
		Text.Size = HandleSlide( hDlg, (ITEMID)wParam, (UINT)lParam, NULL );
		Text.Size = bound( Text.Size, 16, 216 );
		if ( !LBUTTON )
			TextSetFocus();
		if (bTextBegun)
			TextFontChanged(lpImage->hWnd);
		break;

	    case IDC_TEXT_ANGLE:
		i = HandleSlide( hDlg, (ITEMID)wParam, (UINT)lParam, NULL ); // -2 to 2
		Text.Angle = (i * 45);
		if ( Text.Angle < 0 )
			Text.Angle += 360;
		i = (Text.Angle + 22) / 45; // down to 0-8
		if ( i > 4 )
				i = bound( i - 8, -2, 0 );
		else	i = bound( i, 0, 2 );
		SetSlide( hDlg, wParam, i );
		if ( !LBUTTON )
			TextSetFocus();
		if (bTextBegun)
			TextFontChanged(lpImage->hWnd);
		break;

	    default:
		return( FALSE );
	    }

    default:
	return( FALSE );
    }

return( TRUE );
}
Example #4
0
BOOL WINPROC EXPORT DlgOpenProc(
/************************************************************************/
HWND 	hDlg,
UINT 	msg,
WPARAM 	wParam,
LPARAM 	lParam)
{
BOOL Bool;
ITEMID id;
WORD wMsg, wIndex;
int i, ii, l, fp, hi, lo;
FNAME szDriveNDir, szFileName, szExtension;
HMENU hMenu;
STRING szString;
char cChar;
BOOL bModifySaveName;
static BOOL bDisableCancel;

switch (msg)
    {
    case WM_INITDIALOG:
	SET_CLASS_HBRBACKGROUND(hDlg, ( HBRUSH )GetStockObject(LTGRAY_BRUSH));
	CenterPopup( hDlg );
	if ( !DlgDirList(hDlg, szFileSpec, IDC_FLIST, IDC_FPATH, wFileAttr) )
		{
		lstrcpy( szFileSpec, lstrchr( szFileSpec, '*' ) );
		DlgDirList(hDlg, szFileSpec, IDC_FLIST, IDC_FPATH, wFileAttr);
		}
	SetFileName(hDlg, IDC_FNAME, szFileSpec, szSaveName, fSaving);
	CheckComboItem( hDlg, IDC_FILETYPES, IDC_ART, IDC_BMP,
		IDC_ART + (idFileType-IDN_ART) );
	SendDlgItemMessage(hDlg, IDC_FNAME, EM_LIMITTEXT, MAX_FNAME_LEN-1, 0L);

	LoadComboWithDrives( hDlg, IDC_DRIVES );
	LoadComboWithDirectories( hDlg, IDC_DIRS, NO );
	CheckDlgButton( hDlg, IDC_SAVEPATH, Save.OKtoSavePath );
	CheckDlgButton( hDlg, IDC_SAVECOMPRESS, Save.Compressed );
	for (i = IDC_ART; bImageOpen && i <= IDC_BMP; ++i)
		{
		ii = i-IDC_ART;
		if (lstrlen(Readers[ii].szDLL))
			{
			lstrcpy(szString, Control.ProgHome);
			lstrcat(szString, Readers[ii].szDLL);
			if (!FileExists(szString))
				{
				if ( GetPrivateProfileString( "Micrografx", "Libraries", "",
					szString, sizeof(STRING), "MGX.INI" ) > 2 )
						FixPath( szString );
				lstrcat(szString, Readers[ii].szDLL);
				if (!FileExists(szString))
					{
					ControlEnable( hDlg, i, NO);
					continue;
					}
				}
			}
		if (fSaving)
			ControlEnable( hDlg, i, lpImage &&
				Readers[ii].bSave[FrameDepth(ImgGetBaseEditFrame(lpImage))] );
		else
			ControlEnable( hDlg, i, Readers[ii].bOpen );
		}
	if ( bImageOpen && lpImage )
		{
		idDataType = lpImage->DataType;
		for (i = IDC_SAVECT; i <= IDC_SAVE24BITCOLOR; ++i)
			ControlEnable( hDlg, i,
			Readers[idFileType-IDN_ART].bTypes[i-IDC_SAVECT]);
		CheckComboItem( hDlg, IDC_DATATYPES, IDC_SAVECT,
			IDC_SAVE24BITCOLOR, idDataType );
		ControlEnable( hDlg, IDC_SAVECOMPRESS,
			Readers[idFileType-IDN_ART].bCompressed );
		}

	SetFocus( GetDlgItem( hDlg, IDC_FNAME ) );
	SendDlgItemMessage(hDlg, IDC_FNAME, EM_SETSEL,
		NULL, MAKELONG(0, 0x7fff));
	bNavigated = NO;
	bDisableCancel = NO;
	return( FALSE );

    case WM_PALETTECHANGED:
	break;

    case WM_MENUSELECT:
	lo = LOWORD(lParam);
	hi = HIWORD(lParam);
	if (hi == 0)
		break;
	if (lo == -1)
		break;
	if (lo & MF_SYSMENU)
		break;
	if (lo & MF_POPUP)
		{
		hMenu = (HMENU)wParam;
		while (GetSubMenu(hMenu, 0))
			hMenu = GetSubMenu(hMenu, 0);
		id = GetMenuItemID(hMenu, 0);
		if (id <= 0)
			break;
		wParam = id - 1;
		}
	HintLine( wParam );
	break;

    case WM_SETCURSOR:
	return( SetupCursor( wParam, lParam, idOpen ) );

    case WM_CLOSE:
	AstralDlgEnd( hDlg, FALSE|2 );
	break;

    case WM_MEASUREITEM:
    case WM_DRAWITEM:
	id = ((LPDRAWITEMSTRUCT)lParam)->CtlID;
	Bool = ( id == IDC_DRIVES || id == IDC_DIRS );
	return( OwnerDraw( hDlg, msg, lParam, Bool ) );
//	break;

    case WM_CTLCOLOR:
	return( (BOOL)SetControlColors( (HDC)wParam, hDlg, (HWND)LOWORD(lParam),
		HIWORD(lParam) ) );

    case WM_COMMAND:
	if (wParam != IDCANCEL)
		bDisableCancel = NO;
	switch(wParam)
	    {
	    case IDC_FILETYPES:
//	    case IDC_ART:
//	    case IDC_TIFF:
//	    case IDC_BMP:
		if ( !(wParam = HandleCombo( hDlg, wParam, lParam )) )
			break;
		idFileType = IDN_ART + (wParam-IDC_ART);
		if (bNavigated)
			{
			LookupExtension( idFileType, szFileSpec );
			}
		else	GetFileLocation( idFileType, szFileSpec );
		for (i = IDC_SAVECT; i <= IDC_SAVE24BITCOLOR; ++i)
			ControlEnable( hDlg, i,
			Readers[idFileType-IDN_ART].bTypes[i-IDC_SAVECT]);
		ControlEnable( hDlg, IDC_SAVECOMPRESS,
			Readers[idFileType-IDN_ART].bCompressed );
		SetFileName(hDlg, IDC_FNAME, szFileSpec, szSaveName, NO );
		SendMessage( hDlg, WM_COMMAND, IDOK, 0L );
		break;

	    case IDC_DATATYPES:
//	    case IDC_SAVECT:
//	    case IDC_SAVELA:
//	    case IDC_SAVESP: // scatterprint
//	    case IDC_SAVE8BITCOLOR:
//	    case IDC_SAVE24BITCOLOR:
		if ( !(wParam = HandleCombo( hDlg, wParam, lParam )) )
			break;
		idDataType = wParam;
		break;

	    case IDC_SAVEPATH:
		Save.OKtoSavePath = (BOOL)SendDlgItemMessage (hDlg, IDC_SAVEPATH,
		  BM_GETCHECK, 0, 0L);
//		Save.OKtoSavePath = !Save.OKtoSavePath;
//		CheckDlgButton( hDlg, IDC_SAVEPATH, Save.OKtoSavePath );
		break;

	    case IDC_SAVECOMPRESS:
		Save.Compressed = (BOOL)SendDlgItemMessage (hDlg, IDC_SAVECOMPRESS,
		  BM_GETCHECK, 0, 0L);
//		Save.Compressed = !Save.Compressed;
//		CheckDlgButton( hDlg, IDC_SAVECOMPRESS, Save.Compressed );
		break;

	    case IDC_DRIVES:
		wMsg = HIWORD(lParam);
		if ( wMsg != CBN_SELCHANGE )
			break;
		wIndex = SendDlgItemMessage( hDlg, wParam, CB_GETCURSEL, 0, 0L);
		SendDlgItemMessage( hDlg, wParam, CB_GETLBTEXT, wIndex,
			(long)(LPSTR)szDriveNDir );
		id = ExtractStringID( szDriveNDir );
		if (CHDRIVE( *szDriveNDir - 'a' ))
			{
			LoadComboWithDrives(hDlg, IDC_DRIVES);
			break;
			}
		if (!CURRENTDIR(szString, sizeof(szString)))
			{
			GetDlgItemText(hDlg, IDC_FPATH, szString,
				 sizeof(szString));
			CHDRIVE(*szString - 'a');
			LoadComboWithDrives(hDlg, IDC_DRIVES);
			}
//12/15		SetFileName(hDlg, IDC_FNAME, szFileSpec, szSaveName, NO);
		DlgDirList( hDlg, szFileSpec, IDC_FLIST, IDC_FPATH, wFileAttr );
		LoadComboWithDirectories( hDlg, IDC_DIRS, YES );
		SetDlgItemText( hDlg, IDC_DISKSPACE,
			DriveSize( *szDriveNDir - 'a', szString ) );
		SetFileName(hDlg, IDC_FNAME, szFileSpec, szSaveName, fSaving );
		bNavigated = YES;
		break;

	    case IDC_DIRS:
		wMsg = HIWORD(lParam);
		if ( wMsg == LBN_DBLCLK )
			{
			SendMessage(hDlg, WM_COMMAND, IDOK, 1L);
			break;
			}
		if ( wMsg != LBN_SELCHANGE )
			break;
		wIndex = SendDlgItemMessage( hDlg, wParam, LB_GETCURSEL, 0, 0L);
		// Figure out how to build the path name based on the selection
		SendDlgItemMessage( hDlg, wParam, LB_GETTEXT, wIndex,
			(long)(LPSTR)szDriveNDir );
		id = ExtractStringID( szDriveNDir );
		if ( id == IDC_PATHICON_OPEN )
			i = 0; // Must start building the path from the root
		else
		if ( id == IDC_PATHICON_ACTIVE )
			i = 9999; // Don't build any path - we're there
		else	i = wIndex; // OK to build a relative path
		szFileName[0] = '\0';
		for ( ; i<=wIndex; i++ )
			{
			SendDlgItemMessage( hDlg, wParam, LB_GETTEXT, i,
				(long)(LPSTR)szDriveNDir );
			id = ExtractStringID( szDriveNDir );
			if ( id == IDC_PATHICON_CLOSED && i != wIndex )
				continue;
			lstrcat( szFileName, SkipSpaces(szDriveNDir) );
			if ( id != IDC_PATHICON_ROOT )
				lstrcat( szFileName, "\\" );
			}
		lstrcat( szFileName, szFileSpec );
		SetFileName(hDlg, IDC_FNAME, szFileName, szSaveName, NO );
		bNavigated = YES;
		break;

	    case IDC_FLIST:
		wMsg = HIWORD(lParam);
		if ( wMsg == LBN_DBLCLK )
			{
			SendMessage(hDlg, WM_COMMAND, IDOK, 1L);
			break;
			}
		if ( wMsg != LBN_SELCHANGE )
			break;
		/* If a directory is selected... */
		if (DlgDirSelectEx(hDlg, szFileName, sizeof(szFileName), wParam))
			lstrcat(szFileName, szFileSpec);
		// 1-2-92 - TMR - always use SetFileName for all FNAME sets
// 		SetDlgItemText(hDlg, IDC_FNAME, szFileName);
		SetFileName(hDlg, IDC_FNAME, szFileName, szSaveName, NO );
		SendDlgItemMessage(hDlg, IDC_FNAME, EM_SETSEL,
			NULL, MAKELONG(0, 0x7fff));
//		SendDlgItemMessage(hDlg, IDC_FNAME, CB_SETEDITSEL,
//			NULL, MAKELONG(0, 0x7fff));
		break;

	    case IDC_FNAME:
		/* If the name is changed, disable OK if its length goes 0 */
		if (HIWORD(lParam) != EN_CHANGE)
//		if (HIWORD(lParam) != CBN_EDITCHANGE)
			break;
		ControlEnable( hDlg, IDOK,
			(BOOL)SendDlgItemMessage( hDlg, wParam,
			WM_GETTEXTLENGTH, 0, 0L));
		
		// 1-2-92 - TMR - make sure Edit Box has focus to make sure
		// that szSaveName only gets overwritten from user input
		// 1-3-92 - TMR - move this after ControlEnable
		if (GetFocus() != GetDlgItem(hDlg, IDC_FNAME))
			break;
		if (fSaving)
			{
			GetDlgItemText(hDlg, IDC_FNAME, szSaveName,
				MAX_FNAME_LEN);
			fUntitled = NO;
			}
		break;

	    case IDC_FPATH:
		wMsg = HIWORD(lParam);
		if ( wMsg == BN_DOUBLECLICKED )
			{
			SendMessage(hDlg, WM_COMMAND, IDOK, 1L);
			break;
			}
		if ( wMsg != BN_CLICKED )
			break;
 		GetDlgItemText(hDlg, wParam, szFileName, sizeof(szFileName));
		if ( !szFileName[0] )
			break;
		FixPath( szFileName );
		lstrcat( szFileName, szFileSpec );
		SetFileName(hDlg, IDC_FNAME, szFileName, szSaveName, NO );
		bNavigated = YES;
		break;

	    case IDOK:
		GetDlgItemText(hDlg, IDC_FNAME, szFileName,sizeof(szFileName));
		bModifySaveName = fSaving && StringsEqual(szFileName,
			szSaveName);
		/* Strip off the drive and directory to make */
		/* a DlgDirlist() call to switch over to them */
		/* Loop backwards over the file name */
		l = lstrlen(szFileName);
		while( --l >= 0 )
		   {
		   cChar = szFileName[l];
		   /* If we find a wildcard, the next DlgDirList() takes */
		   /* care of drive and directory switching; so get out */
		   if ( cChar == '?' || cChar == '*' )
			break;
		   /* If we find a drive or directory, handle it and get out */
		   if ( cChar == '\\' || cChar == ':' )
			{
			lstrcpy(szDriveNDir, szFileName);
			l++;
			szDriveNDir[l] = '\0';
			lstrcat(szDriveNDir, szFileSpec);
			// 1-3-92 - TMR - Handle directory change error
			if (DlgDirList(hDlg, szDriveNDir,
					 IDC_FLIST, IDC_FPATH, wFileAttr))
				lstrcpy( szFileName, &szFileName[l] );
			else
				{
				szDriveNDir[l] = '\0';
				Message(IDS_EDIRECTORYCHANGE,
					 Lowercase(szDriveNDir));
				szFileName[0] = '\0';
				}
			break;
			}
		   }

		// 1-3-92 - TMR add extension if none present
		/* Check to see if the file has an extension... */
		if ( !lstrchr( szFileName, '.' ) ) // if no extension...
		    if ( LookupExtension( idFileType, szExtension ) )
			{
			if (lstrlen(szFileName))
			    lstrcat( szFileName, extension(szExtension) );
			else
			    lstrcat( szFileName, szExtension);
			}
		if (bModifySaveName)
			lstrcpy(szSaveName, szFileName);

		/* Try to display a new list box */
		if ( !szFileName[0] )
			lstrcat(szFileName, szFileSpec);
		if (DlgDirList(hDlg, szFileName, IDC_FLIST, IDC_FPATH,
		    wFileAttr))
			{ /* A wildcard was found and a new list displayed */
			lstrcpy(szFileSpec, szFileName);
			SetFileName(hDlg, IDC_FNAME, szFileSpec, szSaveName,
				fSaving );
			LoadComboWithDrives( hDlg, IDC_DRIVES );
			LoadComboWithDirectories( hDlg, IDC_DIRS, YES );
			
			break;
			}

		// If there is still a path or wildcards in the name, the
		// file specification must be invalid
		if (lstrchr(szFileName, '\\') || lstrchr(szFileName, ':') ||
		    lstrchr(szFileName, '?') || lstrchr(szFileName, '*'))
			{
			lstrcpy(szString, szFileName);
			stripfile(szString);
			Message(IDS_EDIRECTORYCHANGE, Lowercase(szString));
			lstrcpy(szFileSpec, filename(szFileName));
			lstrcpy(szFileName, szFileSpec); // is this needed?
			SetFileName(hDlg, IDC_FNAME, szFileSpec, szSaveName,
				fSaving );
			break;
			}

		/* No wildcards, and the drive and dir have been changed */
		LoadComboWithDrives( hDlg, IDC_DRIVES );
		LoadComboWithDirectories( hDlg, IDC_DIRS, YES );

		/* Check to see if the file has 8 characters or less... */
		if ( fSaving )
			RemoveWhiteSpace( szFileName );
		FixFileName( szFileName );

		/* Check to see if the file has an extension... */
		if ( !lstrchr( szFileName, '.' ) ) // if no extension...
			if ( LookupExtension( idFileType, szExtension ) )
				lstrcat( szFileName, extension(szExtension) );

		// Build the fully qualified path name
		GetDlgItemText( hDlg, IDC_FPATH, szString, sizeof(szString) );
		FixPath( szString );
		lstrcat( szString, szFileName );

		/* Check to see if the file exists... */
		if ( (fp = _lopen( szString, OF_READ ) ) < 0 )
			{ /* The file does not exist */
			if ( !fSaving )
				{
				Message(IDS_EOPEN, Lowercase(szString));
				break;
				}
			}
		else	{
			_lclose( fp );
			if ( fSaving )
				{
				if ( !AstralAffirm( IDS_OVERWRITEIMAGE,
					Lowercase(szString) ) )
					break;
				}
			}

		lstrcpy( szFileSpec, szString );
		AstralDlgEnd(hDlg, TRUE|2);
		break;

	    case IDC_CANCEL:
	    case IDCANCEL:
		if ( bDisableCancel && !LOWORD(lParam) )
			break;
		GetDlgItemText(hDlg, IDC_FPATH, szFileSpec,sizeof(szFileSpec));
		AstralDlgEnd(hDlg, FALSE|2);
		break;

	    default:
		return( FALSE );
	    }
	break;

    default:
	return( FALSE );
    }

return( TRUE );
}