PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: Richard Kelly on November 25, 2011, 07:08:16 AM

Title: AfxShell Include Compile Error
Post by: Richard Kelly on November 25, 2011, 07:08:16 AM
The attached pic has the information. I know pi is a PB reserved word, so I patched that up and then the second error.

Rick kelly
Title: Re: AfxShell Include Compile Error
Post by: Paul Squires on November 25, 2011, 08:41:07 AM
I can't seem to find AFXSHELL.INC in my download of Jose's includes.... maybe I am not using the latest?
Title: Re: AfxShell Include Compile Error
Post by: Richard Kelly on November 25, 2011, 09:01:29 AM
Quote from: TechSupport on November 25, 2011, 08:41:07 AM
I can't seem to find AFXSHELL.INC in my download of Jose's includes.... maybe I am not using the latest?

I am using the latest version downloaded directly from Jose's forums.

Rick Kely
Title: Re: AfxShell Include Compile Error
Post by: Rolf Brandt on November 25, 2011, 10:34:28 AM
Latest version is 2.05 from Nov.3, 2011.
Lots of more wrappers!

Rolf
Title: Re: AfxShell Include Compile Error
Post by: Richard Kelly on November 25, 2011, 10:43:32 AM
Quote from: Rolf Brandt on November 25, 2011, 10:34:28 AM
Latest version is 2.05 from Nov.3, 2011.
Lots of more wrappers!

Rolf

That's the version I'm using.

Rick Kelly
Title: Re: AfxShell Include Compile Error
Post by: José Roca on November 25, 2011, 12:41:19 PM
pi is not a reserved error. What happens is that you're must have defined it as a macro somewhere in your code and the compiler is trying to replace the parameter with 3.14...

Macros are a can of worms.
Title: Re: AfxShell Include Compile Error
Post by: Richard Kelly on November 25, 2011, 03:56:26 PM
Quote from: Jose Roca on November 25, 2011, 12:41:19 PM
pi is not a reserved error. What happens is that you're must have defined it as a macro somewhere in your code and the compiler is trying to replace the parameter with 3.14...

Macros are a can of worms.
OMG! You are always so spot on. It's in my date and time calculation routines.


' Credits - Calendrical Calculations Third Edition, Nachum Dershowitz and Edward M. Reingold
'           Astronomical Algorithms, Jean Meeus

' Written by: Rick Kelly, info@crooit.com

' Released into the public domain for private and public use without restriction

' Windows XP is minimum OS needed

' Include here for functions not found in PB standard WIN32API.INC

DECLARE FUNCTION TzSpecificLocalTimeToSystemTime LIB "KERNEL32.DLL" ALIAS "TzSpecificLocalTimeToSystemTime" _
            (lpTimeZoneInformation AS TIME_ZONE_INFORMATION, lpLocalTime AS SYSTEMTIME, lpUniversalTime AS SYSTEMTIME) AS LONG

MACRO J2000                         = 730120.5                          ' Jan 1, 2000 at 12:00PM
MACRO PI                            = 3.141592653589793##
MACRO DegreesToRadians(nDegrees)    = (nDegrees*0.0174532925199433##)
MACRO RadiansToDegrees(nRadians)    = (nRadians*57.29577951308232##)
MACRO MeanSynodicMonth              = 29.530588861##                    ' Mean time from new moon to new moon
MACRO EarthRadius                   = 6372000
MACRO VisibleHorizon                = .841314754398138##                ' Half diameter of the sun (16 minutes +
                                                                        ' 34.478885263888294 minutes for refraction)
                                                                        ' expressed in decimal degrees


I just changed it out to:


FUNCTION PI () AS EXTENDED

    FUNCTION = 3.141592653589793##

END FUNCTION


On the good side, your includes make putting an app shortcut on the desktop a snap.

Uses includes:

#INCLUDE "afxshell.inc"
#INCLUDE "wshom.inc"


Sub DesktopShortcut ()

' Create a shortcut to CTarget on the users desktop

Local pWsh          As IWshShell
Local pLnk          As IWshShortcut

    pWsh = NewCom "WScript.Shell"
   
    pLnk = pWsh.CreateShortcut(AfxGetDesktopFolder () + "\YourName.lnk")
   
' Set shortcut properties

   pLnk.Description      = App.LegalCopyright           
   pLnk.WorkingDirectory = App.Path     
   pLnk.IconLocation     = App.Path + "\" + App.EXEName + " ,0" 
   pLnk.TargetPath       = App.Path + "\" + App.EXEName         
   pLnk.WindowStyle      = %WSHNORMALFOCUS           

' Save shortcut

    pLnk.Save

End Sub


Rick Kelly :-[