Category : C Source Code
Archive   : MEWELDT.ZIP
Filename : DESKHELP.C

 
Output of file : DESKHELP.C contained in archive : MEWELDT.ZIP
/*===========================================================================*/
/* */
/* File : DESKDLG.C */
/* */
/* Purpose : Dialog procs for the DESKTOP demo program. */
/* */
/* History : */
/* */
/* (C) Copyright 1989 Marc Adler/Magma Systems All Rights Reserved */
/*===========================================================================*/

#if MSC
#include /* for getcwd() */
#include /* for malloc() */
#elif TC
#include /* for getcwd() */
#include /* for malloc() */
#endif

#include
#include
#include
#include
#include
#include "window.h"
#include "keys.h"
#include "rc.h"

#include "desktop.h"

/***************************************************************************/
/* */
/* HELP ROUTINES */
/* */
/***************************************************************************/

int pascal HelpDialogProc(hDlg, msg, wParam, lParam)
HWND hDlg;
WORD msg;
WORD wParam;
DWORD lParam;
{
char szBuf[80];
static FILE *fHelp;
HWND hLB;
HWND hTopics;
int iTopic;
static int bShowingTopics;
#ifdef MSC
extern char *_pgmptr;
#endif
#ifdef TC
extern char *_argv[];
#endif
char *szExt;

switch (msg)
{
case WM_INITDIALOG :
#ifdef MSC
strcpy(szBuf, _pgmptr);
#endif
#ifdef TC
strcpy(szBuf, _argv[0]);
#endif
if ((szExt = strchr(szBuf, '.')))
strcpy(szExt+1, "HLP");

if ((fHelp = fopen(szBuf, "r")) == NULL)
{
MessageBox("Can't open DESKTOP.HLP", NULL, NULL, "Error", MB_OK);
EndDialog(hDlg, IDCANCEL);
return TRUE;
}
get_topics:
hLB = GetDlgItem(hDlg, ID_HELPLB);
SendMessage(hLB, LB_RESETCONTENT, 0, 0L);
ListBoxSetRedraw(hLB, FALSE);

while (fgets(szBuf, sizeof(szBuf), fHelp) != NULL && *szBuf != '\f')
{
char *szEnd = szBuf + strlen(szBuf) - 1;
if (*szEnd == '\n')
*szEnd = '\0';
SendMessage(hLB, LB_ADDSTRING, 0, (DWORD) (char far *) szBuf);
}

ListBoxSetRedraw(hLB, TRUE);
SetFocus(hLB);

hTopics = GetDlgItem(hDlg, ID_TOPICS);
EnableWindow(hTopics, FALSE);
WinSetAttr(hTopics, 0x37);

bShowingTopics = TRUE;
return TRUE;


case WM_QUIT :
EndDialog(hDlg, IDCANCEL);
break;

case WM_COMMAND :
switch (wParam)
{
case IDCANCEL :
fclose(fHelp);
EndDialog(hDlg, IDCANCEL);
break;
case IDOK :
if (bShowingTopics)
{
/* Show a help item */
hLB = GetDlgItem(hDlg, ID_HELPLB);
iTopic = SendMessage(hLB, LB_GETCURSEL, 0, 0L);

while (iTopic)
{
if (fgets(szBuf, sizeof(szBuf), fHelp) == NULL)
break;
if (*szBuf == '\f')
iTopic--;
}

hLB = GetDlgItem(hDlg, ID_HELPLB);
SendMessage(hLB, LB_RESETCONTENT, 0, 0L);
ListBoxSetRedraw(hLB, FALSE);

while (fgets(szBuf, sizeof(szBuf), fHelp) != NULL && *szBuf != '\f')
{
char *szEnd = szBuf + strlen(szBuf) - 1;
if (*szEnd == '\n')
*szEnd = '\0';
SendMessage(hLB, LB_ADDSTRING, 0, (DWORD) (char far *) szBuf);
}

ListBoxSetRedraw(hLB, TRUE);
SetFocus(hLB);
bShowingTopics = FALSE;

hTopics = GetDlgItem(hDlg, ID_TOPICS);
EnableWindow(hTopics, TRUE);
WinSetAttr(hTopics, 0x31);
}
else
{
rewind(fHelp);
goto get_topics;
}
break;
case ID_TOPICS:
rewind(fHelp);
goto get_topics;
}
return TRUE;

case WM_CHAR :
if (wParam == VK_ESC)
{
fclose(fHelp);
EndDialog(hDlg, IDCANCEL);
}
return FALSE;

default :
return FALSE;
}
}



  3 Responses to “Category : C Source Code
Archive   : MEWELDT.ZIP
Filename : DESKHELP.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/