AfxShell Include Compile Error

Started by Richard Kelly, November 25, 2011, 07:08:16 AM

Previous topic - Next topic

Richard Kelly

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

Paul Squires

I can't seem to find AFXSHELL.INC in my download of Jose's includes.... maybe I am not using the latest?
Paul Squires
PlanetSquires Software

Richard Kelly

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

Rolf Brandt

Latest version is 2.05 from Nov.3, 2011.
Lots of more wrappers!

Rolf
Rolf Brandt
http://www.rbsoft.eu
http://www.taxifreeware.com
I cook with wine, sometimes I even add it to the food.
(W. C. Fields)

Richard Kelly

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

José Roca

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.

Richard Kelly

#6
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 :-[