Global ccgLib Functions

09/02/99

Author: Daniel.Lindh@Home.se
ICQ: 7983755
HOMEPAGE: home.bip.net/CyberCow

Copyright © Cyber Cow 1995 - 1999.
All Rights Reserved.

OverView
Members

 

Overview

#include <ccgLib.h>


This file includes global constants, variables and functions in the ccgLib.

 

Members

Constants

CRLF

New Line

ON

Synonym to TRUE

OFF

Synonym to FALSE

VK_C

Virtual Key for C

VK_V

Virtual Key for V

VK_X

Virtual Key for X

VK_Z

Virtual Key for Z

Enums

E_ccErrRet

Used as a return value by functions. Give the caller a better ide what has happend in the function. If it totally failed or succeded etc.

CCFATALERROR = -1,
CCERROR      = 0,
CCFAILED     = 0,

CCNOTFOUND   = 0,
CCNOERROR    = 1,
CCSUCCEDED   = 1,
CCFOUND      = 1

E_BROWSER_TYPE

Diffrent web browser types.

CCB_DEFAULT = 0,
CCB_EXPLORER,
CCB_NETSCAPE,
CCB_MOSAIC,
CCB_OPERA

E_MAILCLIENT_TYPE

Diffrent mail reader types.

 

CCMC_DEFAULT = 0,
CCMC_OUTLOOK,

Functions

Public:

getSaveAsFile

Show a "save as" dialog window, and lets the user to select a directory.

fileExist

Check if the specified file exist.

AfxMessagBoxF

This small utility funtion will simply put up a userdefined message box with a string formatted like printf().

ccDelay

Delay the program .

surfTo

Open a specific web browser with a specific URL.

mailTo

Open a specific mail reader with a specific e-mail adress.

isSHIFTPressed

Check if SHIFT is pressed. 

isCTRLPressed

Check if CTRL is pressed.

 

 

getSaveAsFile

CString getSaveAsFile( CString asFileName, 

                       CString asFileNameExtension

                     )

Return Value:

CString

The new file name.

Arguments:

asFileName

The name of the file who should be saved. Ex. "ccTrace.trc"

asFileNameExtension

The file name extension, Should not include a period. Ex. "txt"

Remarks:

Show a "save as" dialog window, and lets the user to select a directory.

Example:

CString lsFileName;

lsFileName = getSaveAsFile( "ReadMe.txt", "txt" );

 

fileExist

E_ccErrRet fileExist( CString lsFileName )

Return Value:

E_ccErrRet

Returns CCFOUND if the file exist and CCNOTFOUND if the file doesn't exist.

Arguments:

lsFileName

The file who should be checked if it exist. Can include a path. If no path is included the current directory will be checked for the file.

Remarks:

Check if the specified file exist.

Example:

if ( fileExist( "ReadMe.txt" ) == CCSUCCEDED )

{

   ...

}

 

AfxMessageBoxF

int AfxMessagBoxF(UINT nType, PSTR sz,...)

Return Value:

int

Zero if there is not enough memory to display the message box; otherwise one of the following values is returned:
  • IDABORT   The Abort button was selected.
  • IDCANCEL   The Cancel button was selected.
  • IDIGNORE   The Ignore button was selected.
  • IDNO   The No button was selected.
  • IDOK   The OK button was selected.
  • IDRETRY   The Retry button was selected.
  • IDYES   The Yes button was selected.

If a message box has a Cancel button, the IDCANCEL value will be returned if either the ESC key is pressed or the Cancel button is selected. If the message box has no Cancel button, pressing the ESC key has no effect.

Arguments:

nType

The style of the message box. Apply any of the message-box styles (can be found in MSDN) to the box. 

sz

Format control (see printf).

...

Optional arguments (see printf).

Remarks:

This small utility funtion will simply put up a userdefined message box with a string formatted like printf().

Example:

if ( AfxMessageBoxF( MB_RETRYCANCEL, "Error on line: %d", errLine)

     == IDRETRY

   )

{

   ...

}                      

 

ccDelay

void ccDelay( int aiTime )

Return Value:

None

Arguments:

aiTime

Number of units to delay the program.

Remarks:

Delay the program .

Example:

ccDelay( 1000 );

 

 

surfTo

E_ccErrRet surfTo(CString asWebPage, CWnd * pParentWnd, 

                  E_BROWSER_TYPE aBrowserType /* = CC_DEFAULT */ )

Return Value:

E_ccErrRet

Arguments:

asWebPage

Return CCSUCCEDED if the browser was opened without any problems.

pParentWnd

Handle to the owner window of the message box to be created. If this parameter is NULL, the message box has no owner window.

aBrowserType

Which browser who should be used. See E_BROWSER_TYPE

Remarks:

Open a specific web browser with a specific URL.

Example:

surfTo( _T("www.codeguru.com", NULL);

 

mailTo

E_ccErrRet mailTo(CString asMailTo, CWnd * pParentWnd,

                  E_MAILCLIENT_TYPE aMailClientType = CC_DEFAULT )

Return Value:

E_ccErrRet

Return CCSUCCEDED if the mail reader was opened without any problems.

Arguments:

asMailto

The e-mail adress to send mail too.

pParentWnd

Handle to the owner window of the message box to be created. If this parameter is NULL, the message box has no owner window.

aMailClientType

Which mail client who should be used. See E_MAILCLIENT_TYPE

Remarks:

Open a specific web browser with a specific URL.

Example:

mailTo( _T("cybercow@home.se", NULL);

    

isSHIFTPressed

int isSHIFTPressed()

Return Value:

None

Arguments:

None

Remarks:

Check if SHIFT is pressed.

Example:

if (isSHIFTPressed() )

{

   ...

}

 

 

isCTRLPressed

int isCTRLPressed()

Return Value:

int

Arguments:

None

Remarks:

Check if CTRL is pressed

Example:

if (isCTRLPressed() )

{

   ...

}