|
|
Microsoft OS/2 SDK PM 08-08-1988
#define NORASTEROPS
#define NOSYSCOMMANDS
#include "cardfile.h"
/*********************************************************************/
/* Windows/PM Cardfile Shared Code */
/* */
/* (c) Copyright Microsoft Corp. 1987,1988 - All Rights Reserved */
/*********************************************************************/
/*********************************************************************/
/* The following shared code was developed from the original */
/* Cardfile application. This code can be compiled to run under */
/* either the Windows or the PM manager environment. All */
/* functionality associated with bitmaps or printing has been */
/* deleted. Some comments refering to these functions may still be */
/* present in the code and should be disregarded. jw. */
/*********************************************************************/
/*********************************************************************/
/* CardfileInput - */
/* This routine handles all the menu commands in Cardfile. */
/* */
/* Slightly different for PM and Windows */
/*********************************************************************/
void CardfileInput(hWindow, event)
HWND hWindow;
int event;
{
PSTR pchBuf;
PSTR pchFile;
LPCARDHEADER lpCards;
unsigned long lTemp;
OFSTRUCT ofStruct;
/* which menu command was it */
switch(event)
{
case IDM_ABOUT:
/* about dialog box */
PutUpDB(DTABOUT);
break;
case IDM_NEW:
/* create a new cardfile */
if (fReadOnly)
break;
/* make sure we save any changes the user made */
if (!MaybeSaveFile())
/* the user cancelled in the save changes dialog */
break;
CurIFile[0] = 0;
CurIFind[0] = 0;
SetCaption();
/* get rid of the old temp file */
Fdelete(TmpFile);
/* create a new one */
MakeTmpFile();
/* there's only one card in a new cardfile shrinking */
/* or leaving the same size, so this should always work */
GlobalReAlloc(hCards, (long)sizeof(CARDHEADER),GMEM_MOVEABLE);
cCards = 1;
iFirstCard = 0;
iTopCard = 0;
SetScrRangeAndPos();
/* Set up CurCardHead */
MakeBlankCard();
/* Save blank card in data structure */
lpCards = (LPCARDHEADER) GlobalLock(hCards);
*lpCards = CurCardHead;
GlobalUnlock(hCards);
/* when in phone book mode, not making changes so must */
/* save now */
if (CardPhone == IDM_PHONEBOOK)
SaveCurrentCard(iFirstCard);
/* make sure the window gets repainted */
InvalidateRect(hWindow, (LPRECT)NULL, TRUE);
/* clean file */
fFileDirty = FALSE;
/* make sure that any selection gets repainted for empty card */
if (CardPhone == IDM_CARDFILE)
{
SetFocus(NULL);
SetFocus(hCardWnd);
}
break;
case IDM_OPEN:
/* opening an existing file */
/* make sure that any changes get saved */
if(MaybeSaveFile())
{
/* put up dialog box, and if user hits ok, open file */
if (pchBuf = PutUpDB(DTOPEN))
{
if (!DoOpen(pchBuf))
SetCurCard(iFirstCard);
LocalFree((HANDLE)pchBuf);
}
else
/* user cancelled open dialog box */
SetCurCard(iFirstCard);
}
break;
case IDM_MERGE:
/* merge in another file */
DoMerge();
break;
case IDM_SAVE:
case IDM_SAVEAS:
/* save the file */
pchFile = NULL;
/* if doing a SAVE, and file is named, use current name */
if (event == IDM_SAVE && CurIFile[0])
pchFile = CurIFile;
/* else ask the user for a name */
else if (GetNewFileName(&ofStruct))
pchFile = ofStruct.szPathName;
/* if there is a name to save it to */
if (pchFile)
{
/* get the current selection if in cardfile mode */
if (CardPhone == IDM_CARDFILE)
lTemp = SendMessage(hCardWnd, EM_GETSEL, 0, 0L);
/* if in phonebook mode, or if in cardfile mode and */
/* able to save the front card */
if (CardPhone == IDM_PHONEBOOK ||
SaveCurrentCard(iFirstCard))
{
/* write the file out */
if (WriteCardFile(pchFile))
{
/* reset the caption */
SetCaption();
/* start a new temp file */
Fdelete(TmpFile);
MakeTmpFile();
}
/* if in cardfile mode */
if (CardPhone == IDM_CARDFILE)
{
/* get contents of front card again, and set */
/* selection*/
SetCurCard(iFirstCard);
#ifdef IN_WINDOWS
/* Unfortunately, the parameters for the EM_SETSEL */
/* message are reversed in PM and Windows - the */
/* easiest way to deal with this is to have */
/* separate SendMessage calls */
SendMessage(hCardWnd, EM_SETSEL, 0, lTemp);
#else
SendMessage(hCardWnd, EM_SETSEL, lTemp, 0L);
#endif
}
}
}
break;
case IDM_CARDFILE:
case IDM_PHONEBOOK:
/* change display modes */
if (event != CardPhone)
{
/* if changing to phonebook */
if (event == IDM_PHONEBOOK)
{
/* save data in card */
if (!SaveCurrentCard(iFirstCard))
/* if it doesn't work, stop */
break;
}
/* else changing to cardfile mode */
else
{
/* set the text in the front card */
SetCurCard(iFirstCard);
}
/* save new mode */
CardPhone = event;
/* turn off old scroll bar */
/* This define calls SetScrollRange and SetScrollPos */
SCROLL_RANGE(hWindow, event == IDM_PHONEBOOK ?
SB_HORZ : SB_VERT, 0, 0, 0);
/* if phonebook, get rid of edit control, otherwise reactivate */
ShowWindow(hCardWnd,
event == IDM_PHONEBOOK ? HIDE_WINDOW : SHOW_OPENWINDOW);
#ifdef IN_WINDOWS
/* In PM, the way in which the update is turned off is */
/* through a function. There is no easy way to have */
/* the SendMessage calls in Windows map into separate */
/* functions in PM, so they are in #ifdefs */
SendMessage(hCardWnd, WM_SETREDRAW,
event == IDM_CARDFILE, 0L);
#else
WinEnableWindowUpdate( hCardWnd, event == IDM_CARDFILE );
#endif
/* if phonbook, make sure that topcard is valid */
if (event == IDM_PHONEBOOK)
SetTopCard();
/* set up new scroll bar */
SetScrRangeAndPos();
/* set focus to right place */
SetFocus(event == IDM_PHONEBOOK ? hCardfileWnd : hCardWnd);
/* force a repaint */
InvalidateRect(hWindow, (LPRECT)NULL, TRUE);
}
break;
case IDM_HEADER:
/* if in phone book mode, make sure information is in right place */
if (CardPhone == IDM_PHONEBOOK)
{
SetCurCard(iFirstCard);
SaveCurrentCard(iFirstCard);
}
/* put up dialog box */
if(pchBuf = PutUpDB(DTHEADER))
{
/* save new header */
Mylstrcpy((LPSTR)CurCardHead.line, (LPSTR)pchBuf);
/* take it out of it's current position */
DeleteCard(iFirstCard);
/* and put it back in the right place */
iFirstCard = AddCurCard();
SetScrRangeAndPos(); /* set position */
fFileDirty = TRUE;
InvalidateRect(hWindow, (LPRECT)NULL, TRUE);
LocalFree((HANDLE)pchBuf);
}
break;
case IDM_RESTORE:
/* get the old information */
SetCurCard(iFirstCard);
InvalidateRect(hCardWnd, (LPRECT)NULL, TRUE);
break;
case IDM_CUT:
case IDM_COPY:
DoCutCopy(event);
break;
case IDM_PASTE:
DoPaste();
break;
case IDM_ADD:
/* get the new header for the new card */
if(pchBuf = PutUpDB(DTADD))
{
/* allocate space for new card */
lTemp = (cCards+1) * sizeof(CARDHEADER);
if (!GlobalReAlloc(hCards, lTemp,GMEM_MOVEABLE))
CardfileOkError(IDS_EINSMEMORY);
else
{
/* if in phone book mode, or can save current card */
if (CardPhone == IDM_PHONEBOOK ||
SaveCurrentCard(iFirstCard))
{
/* make a blank card */
MakeBlankCard();
/* save the header */
Mylstrcpy((LPSTR)CurCardHead.line, (LPSTR)pchBuf);
/* the card is dirty */
CurCardHead.flags |= (FDIRTY + FNEW);
/* add the card */
iFirstCard = AddCurCard();
/* make sure that top card is correct */
if (CardPhone == IDM_PHONEBOOK)
SetTopCard();
/* set new scroll information */
SetScrRangeAndPos();
/* if in phone book mode, need to save immediately */
if (CardPhone == IDM_PHONEBOOK)
SaveCurrentCard(iFirstCard);
/* else, force redraw of correct highlighting */
else
{
SetFocus(NULL);
SetFocus(hCardWnd);
}
/* force repaint */
InvalidateRect(hWindow, (LPRECT)NULL, TRUE);
}
}
LocalFree((HANDLE)pchBuf);
}
break;
case IDM_DELETE:
/* if in phone book mode */
if (CardPhone == IDM_PHONEBOOK)
{
/* get information */
SetCurCard(iFirstCard);
/* save it in case of cancel */
SaveCurrentCard(iFirstCard);
}
/* ask user for confirmation */
if (MyMessageBox(IDS_DELCURCARD,
CurCardHead.line,
MB_OKCANCEL | MB_ICONQUESTION | MB_DEFBUTTON2) == IDOK)
{
/* if not last card */
if (cCards > 1)
{
/* get rid of it */
DeleteCard(iFirstCard);
if (iFirstCard == cCards)
if (CardPhone == IDM_CARDFILE)
iFirstCard = 0;
else
iFirstCard = cCards-1;
/* change scroll information */
SetScrRangeAndPos();
/* if in card mode, get card's information */
if (CardPhone == IDM_CARDFILE)
SetCurCard(iFirstCard);
/* shrinking, so don't have to check */
lTemp = cCards * sizeof(CARDHEADER);
GlobalReAlloc(hCards, lTemp, GMEM_MOVEABLE);
}
/* else, last card */
else
{
/* make it blank */
MakeBlankCard();
/* store the info */
lpCards = (LPCARDHEADER) GlobalLock(hCards);
*lpCards = CurCardHead;
GlobalUnlock(hCards);
/* save the info in phonebook mode */
if (CardPhone == IDM_PHONEBOOK)
SaveCurrentCard(iFirstCard);
}
/* dirty file and window */
fFileDirty = TRUE;
InvalidateRect(hWindow, (LPRECT)NULL, TRUE);
}
break;
case IDM_DUPLICATE:
/* make sure there's room */
lTemp = (cCards + 1) * sizeof(CARDHEADER);
if (!GlobalReAlloc(hCards, lTemp, GMEM_MOVEABLE))
CardfileOkError(IDS_EINSMEMORY);
else
{
/* there is, save current card */
if (CardPhone == IDM_PHONEBOOK ||
SaveCurrentCard(iFirstCard))
{
/* get information */
SetCurCard(iFirstCard);
CurCardHead.flags |= (FDIRTY + FNEW);
/* add it */
iFirstCard = AddCurCard();
if (CardPhone == IDM_PHONEBOOK)
{
SaveCurrentCard(iFirstCard);
SetTopCard();
}
/* set new scroll information */
SetScrRangeAndPos();
InvalidateRect(hWindow, (LPRECT)NULL, TRUE);
fFileDirty = TRUE;
}
}
break;
case IDM_GOTO:
/* search headers */
if (pchBuf = PutUpDB(DTGOTO))
{
DoGoto(pchBuf);
LocalFree((HANDLE)pchBuf);
}
break;
case IDM_FINDNEXT:
/* search body of card */
if (CurIFind[0])
{
FindStrCard();
break;
}
case IDM_FIND:
/* search for a pattern */
if(pchBuf = PutUpDB(DTFIND))
{
/* save the pattern */
Mylstrcpy((LPSTR)CurIFind, (LPSTR)pchBuf);
FindStrCard();
LocalFree((HANDLE)pchBuf);
}
break;
default:
break;
}
}
/*********************************************************************/
/* SetTopCard - */
/* This routine is called in phone mode to figure out which */
/* header should appear at the top of the window */
/* */
/* Slightly different for PM and Windows */
/*********************************************************************/
void SetTopCard()
{
RECT rect;
int i;
GetClientRect(hCardfileWnd, (LPRECT)&rect);
#ifdef IN_WINDOWS
/* In PM, the height of a window after a GetClientRect call is */
/* stored in yTop (the origin is based on the bottom */
i = rect.bottom / CharFixHeight;
#else
i = rect.yTop / CharFixHeight;
#endif
if (!i)
i = 1;
iTopCard = min(iFirstCard-(i-1)/2, (cCards - i));
if (iTopCard < 0)
iTopCard = 0;
}
/*********************************************************************/
/* PutUpDB - */
/* Calls routine to put up requested dialog box */
/* */
/* Same for PM and Windows */
/*********************************************************************/
PSTR PutUpDB(idb)
int idb;
{
FARPROC lpdbProc;
DBcmd = idb;
switch(idb)
{
case DTMERGE:
case DTOPEN:
lpdbProc = lpfnOpen;
break;
case DTSAVE:
lpdbProc = lpfnSave;
break;
case DTABOUT:
lpdbProc = lpfnAbout;
break;
default:
lpdbProc = lpDlgProc;
break;
}
return((PSTR)DialogBox(hCardfileInstance,
MAKEINTRESOURCE(idb), hCardfileWnd, lpdbProc));
}
/*********************************************************************/
/* UpdateMenu - */
/* This routine initializes the menu every time it is about */
/* to be displayed for the user */
/* */
/* Same for PM and Windows */
/*********************************************************************/
void UpdateMenu()
{
HMENU hMenu;
long lSelection;
int wFmt;
int mfPaste;
hMenu = GetMenu(hCardfileWnd);
CheckMenuItem(hMenu, IDM_CARDFILE,
CardPhone == IDM_CARDFILE ? MF_CHECKED : MF_UNCHECKED);
CheckMenuItem(hMenu, IDM_PHONEBOOK,
CardPhone == IDM_PHONEBOOK ? MF_CHECKED : MF_UNCHECKED);
if (CardPhone == IDM_CARDFILE)
{
mfPaste = MF_GRAYED;
if (OpenClipboard(hCardfileWnd))
{
wFmt = 0;
while (wFmt = EnumClipboardFormats(wFmt))
{
if (wFmt == CF_TEXT)
{
mfPaste = MF_ENABLED;
break;
}
}
CloseClipboard();
}
EnableMenuItem(hMenu, IDM_PASTE, mfPaste);
EnableMenuItem(hMenu, IDM_RESTORE, MF_ENABLED);
EnableMenuItem(hMenu, IDM_FIND, MF_ENABLED);
EnableMenuItem(hMenu, IDM_FINDNEXT, MF_ENABLED);
lSelection = SendMessage(hCardWnd, EM_GETSEL, 0, 0L);
if (HIWORD(lSelection) == LOWORD(lSelection))
{
EnableMenuItem(hMenu, IDM_CUT, MF_GRAYED);
EnableMenuItem(hMenu, IDM_COPY, MF_GRAYED);
}
else
{
EnableMenuItem(hMenu, IDM_CUT, MF_ENABLED);
EnableMenuItem(hMenu, IDM_COPY, MF_ENABLED);
}
}
else
{
EnableMenuItem(hMenu, IDM_RESTORE, MF_GRAYED);
EnableMenuItem(hMenu, IDM_CUT, MF_GRAYED);
EnableMenuItem(hMenu, IDM_COPY, MF_GRAYED);
EnableMenuItem(hMenu, IDM_PASTE, MF_GRAYED);
EnableMenuItem(hMenu, IDM_FIND, MF_GRAYED);
EnableMenuItem(hMenu, IDM_FINDNEXT, MF_GRAYED);
}
}
/*********************************************************************/
/* SetEditText - */
/* This routine sets the contents of the edit control */
/* */
/* Same for PM and Windows */
/*********************************************************************/
void FAR SetEditText(lpText)
LPSTR lpText;
{
SetWindowText(hCardWnd, lpText);
#ifndef IN_WINDOWS
/* In PM, the Edit control doesn't initialize the modify flag to */
/* False after a SetWindowText call. Read state of modify flag */
/* to reset the flag. */
SendMessage(hCardWnd, EM_GETMODIFY, 0, 0L);
#endif
}
/*********************************************************************/
/* CardfileMouse - */
/* This handles all mouse input to main window. Mouse input in */
/* the edit control will get sent to CardWndProc */
/* */
/* Same for PM and Windows */
/*********************************************************************/
void CardfileMouse(hWindow, message, pt)
HWND hWindow;
int message;
POINT pt;
{
RECT rect;
int iCard;
HDC hDC;
int y;
MSG msg;
if (CardPhone == IDM_CARDFILE)
{
/* see if click on a card or background */
if ((iCard = MapPtToCard(pt)) > -1)
{
/* if on another card */
if (iCard != iFirstCard)
{
/* bring it to front */
CardfileScroll(hCardfileWnd, SB_THUMBTRACK, iCard);
CardfileScroll(hCardfileWnd, SB_THUMBPOSITION, iCard);
}
/* else if double click on first */
else if (message == WM_LBUTTONDBLCLK)
{
/* bring up header box */
SetCapture(hCardfileWnd);
while(GetKeyState(VK_LBUTTON) < 0)
{
PeekMessage((LPMSG)&msg, NULL, WM_MOUSEFIRST,
WM_MOUSELAST, TRUE);
PeekMessage((LPMSG)&msg, NULL, WM_KEYFIRST,
WM_KEYLAST, TRUE);
}
ReleaseCapture();
CardfileInput(hWindow, IDM_HEADER);
}
}
}
else /* phone book mode */
{
/* figure out which header the user clicked on */
TRANSLATE_COORDS( cyMainWindow );
iCard = iTopCard + (TRANSLATE_Y(pt.y) / CharFixHeight);
if (message == WM_LBUTTONDOWN || iCard != iFirstCard)
{
/* single click, change selection */
if (iCard < cCards)
{
y = (iFirstCard - iTopCard) * CharFixHeight;
hDC = GetDC(hWindow);
SetRect((LPRECT)&rect, 0, y,
(LINELENGTH+2)*CharFixWidth, y+CharFixHeight);
TRANSLATE_RECT( rect );
InvertRect(hDC, (LPRECT)&rect);
iFirstCard = iCard;
y = (iFirstCard - iTopCard) * CharFixHeight;
SetRect((LPRECT)&rect, 0, y,
(LINELENGTH+2)*CharFixWidth, y+CharFixHeight);
TRANSLATE_RECT( rect );
InvertRect(hDC, (LPRECT)&rect);
ReleaseDC(hWindow, hDC);
}
}
else /* double click on cur card */
{
/* bring up header box */
if (iCard < cCards)
{
while(!PeekMessage((LPMSG)&msg, NULL, WM_LBUTTONUP,
WM_LBUTTONUP, TRUE))
;
CardfileInput(hWindow, IDM_HEADER);
}
}
TRANSLATE_COORDS( 0 );
}
}
/*********************************************************************/
/* GetNewCard - */
/* This routine is called when a card which is brought forward */
/* via a keystroke (i.e. ctrl-letter) */
/* */
/* Same for PM and Windows */
/*********************************************************************/
BOOL FAR GetNewCard(iOldCard, iNewCard)
int iOldCard;
int iNewCard;
{
HDC hDC;
RECT rect;
int y;
/* if phonebook mode */
if (CardPhone == IDM_PHONEBOOK)
{
/* unselect old card */
y = (iOldCard - iTopCard) * CharFixHeight;
hDC = GetDC(hCardfileWnd);
TRANSLATE_COORDS( cyMainWindow );
SetRect((LPRECT)&rect, 0, y, (LINELENGTH+2)*CharFixWidth,
y+CharFixHeight);
TRANSLATE_RECT( rect );
TRANSLATE_COORDS( 0 );
InvertRect(hDC, (LPRECT)&rect);
ReleaseDC(hCardfileWnd, hDC);
/* get new one */
BringCardOnScreen(iFirstCard = iNewCard);
}
else
{
/* send scroll messages */
CardfileScroll(hCardfileWnd, SB_THUMBTRACK, iNewCard);
return(CardfileScroll(hCardfileWnd, SB_THUMBPOSITION, iNewCard));
}
return(TRUE);
}
/*********************************************************************/
/* MapPtToCard - */
/* Map mouse coordinates to a particular card. This is called in */
/* card mode only */
/* */
/* Same for PM and Windows */
/*********************************************************************/
int MapPtToCard(pt)
POINT pt;
{
int idCard;
int xCur;
int yCur;
int i;
RECT rect;
yCur = yFirstCard - (cScreenCards - 1)*ySpacing;
xCur = xFirstCard + (cScreenCards - 1)* (2 * CharFixWidth);
idCard = (iFirstCard + cScreenCards-1) % cCards;
TRANSLATE_COORDS( cyMainWindow );
for (i = 0; i < cScreenCards; ++i)
{
SetRect((LPRECT)&rect, xCur+1, yCur+1, xCur+CardWidth-1,
yCur+CharFixHeight+1);
TRANSLATE_RECT( rect );
if (PtInRect((LPRECT)&rect, pt))
return(idCard);
SetRect((LPRECT)&rect, rect.right - 2*CharFixWidth + 2,
yCur+1,rect.right,yCur-1+CardHeight);
TRANSLATE_RECT( rect );
if (PtInRect((LPRECT)&rect, pt))
return(idCard);
xCur -= (2*CharFixWidth);
yCur += ySpacing;
idCard--;
if (idCard < 0)
idCard = cCards - 1;
}
TRANSLATE_COORDS( 0 );
return(-1);
}
/*********************************************************************/
/* CardfileOkError - */
/* Puts up a dialog box with only an ok button */
/* */
/* Same for PM and Windows */
/*********************************************************************/
void FAR CardfileOkError(strid)
int strid;
{
MyMessageBox(strid, NULL, MB_OK | MB_ICONEXCLAMATION);
}
/*********************************************************************/
/* MyMessageBox - */
/* Puts up error message for strid, possibly merging in a string, */
/* and asks for the appropriate buttons and icons */
/* */
/* Same for PM and Windows */
/*********************************************************************/
WORD FAR MyMessageBox(strid, pchMerge, style)
WORD strid;
PSTR pchMerge;
WORD style;
{
char buf1[128];
char buf2[128];
if (strid == IDS_EINSMEMORY)
Mylstrcpy((LPSTR)buf1, (LPSTR)NotEnoughMem);
else
LoadString(hCardfileInstance, strid, (LPSTR)buf1, 128);
MergeStrings((LPSTR)buf1, (LPSTR)pchMerge, (LPSTR)buf2);
return(MessageBox(hCardfileWnd, (LPSTR)buf2,
(LPSTR)rgchCardfile, style));
}
/*********************************************************************/
/* MergeStrings - */
/* Scans sz1 for merge spec. If found, insert string sz2 at that */
/* point. Then append rest of sz1 NOTE! Merge spec guaranteed to be */
/* two chars. Returns TRUE if it does a merge, false otherwise. */
/* */
/* Same for PM and Windows */
/*********************************************************************/
BOOL FAR MergeStrings(lpszSrc, lpszMerge, lpszDst)
LPSTR lpszSrc;
LPSTR lpszMerge;
LPSTR lpszDst;
{
LPSTR lpchSrc;
LPSTR lpchDst;
lpchSrc = lpszSrc;
lpchDst = lpszDst;
/* Find merge spec if there is one. */
while (*(unsigned far *)lpchSrc != wMerge) {
*lpchDst++ = *lpchSrc;
/* If we reach end of string before merge spec, just return. */
if (!*lpchSrc++)
return FALSE;
}
/* If merge spec found, insert sz2 there. (check for null merge string */
if (lpszMerge) {
while (*lpszMerge)
*lpchDst++ = *lpszMerge++;
}
/* Jump over merge spec */
lpchSrc++,lpchSrc++;
/* Now append rest of Src String */
while (*lpchDst++ = *lpchSrc++);
return TRUE;
}
/*********************************************************************/
/* MakeBlankCard - */
/* */
/* Same for PM and Windows */
/*********************************************************************/
void MakeBlankCard()
{
CurCardHead.line[0] = 0;
CurCard.hBitmap = 0;
SetEditText((LPSTR)"");
CurCardHead.flags = FNEW;
}
/*********************************************************************/
/* SetCaption - */
/* Sets cardfile's window caption */
/* */
/* Same for PM and Windows */
/*********************************************************************/
void SetCaption()
{
char buf[40];
BuildCaption(buf);
SetWindowText( FRAME(hCardfileWnd), (LPSTR)buf );
}
/*********************************************************************/
/* BuildCaption - */
/* Creates the string that will appear in the window, or in the */
/* spooled file list */
/* */
/* Same for PM and Windows */
/*********************************************************************/
void FAR BuildCaption(pchBuf)
char *pchBuf;
{
char *pch;
char *pch3;
/* always starts off "Cardfile - " */
Mylstrcpy((LPSTR)pchBuf, (LPSTR)rgchCardfile);
Mylstrcat((LPSTR)pchBuf, (LPSTR)" - ");
/* if named, append just filename */
if (CurIFile[0])
{
pch = CurIFile;
pch3 = pch;
/* scan to end */
for ( ; *pch; ++pch)
;
/* run backwards looking for beginning of filename */
while (pch > pch3 && *pch != '\\')
pch = (PSTR)AnsiPrev(pch3, pch);
/* if at slash, point to filename */
if (*pch == '\\')
pch++;
Mylstrcat((LPSTR)pchBuf, (LPSTR)pch);
}
/* if unnamed, append "Untitled" */
else
Mylstrcat((LPSTR)pchBuf, (LPSTR)rgchUntitled);
}
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.