API Documentation

APIVersion

Get the API version


    #define cszNxCoreAPIVersion "sNxCoreAPIVersion"
    typedef unsigned int (__stdcall *NxCoreAPIVersion) (void);

    unsigned int APIVersion();

Example

Here's an example of printing out the version of the DLL at program startup


#define _CRT_SECURE_NO_WARNINGS
#include <windows.h>
#include <stdio.h>

#include <NxCoreAPI.h>
#include <NxCoreAPI_class.h>

NxCoreClass nxCoreClass;

int __stdcall nxCoreCallback(const NxCoreSystem* pNxCoreSys, const NxCoreMessage* pNxCoreMessage)
{
    switch (pNxCoreMessage->MessageType)
    {
        case NxMSG_STATUS:
        {
            switch (pNxCoreSys->Status)
            {
                case NxCORESTATUS_INITIALIZING:
                {
                    unsigned int version = nxCoreClass.APIVersion();

                    printf("NxCoreAPI.dll version is %ld.%ld.%ld\n",
                            NxCORE_VER_MAJOR(version),
                            NxCORE_VER_MINOR(version),
                            NxCORE_VER_BUILD(version));

                    // also can do this
                    printf("NxCoreAPI.dll version is %ld.%ld.%ld\n",
                            NxCORE_VER_MAJOR(pNxCoreSys->DLLVersion),
                            NxCORE_VER_MINOR(pNxCoreSys->DLLVersion),
                            NxCORE_VER_BUILD(pNxCoreSys->DLLVersion));

                    break;
                }
            }
        }
    }

    return NxCALLBACKRETURN_CONTINUE;
}

int main(int argc, char** argv)
{
    if (!nxCoreClass.LoadNxCore("NxCoreAPI.dll") &&
        !nxCoreClass.LoadNxCore("C:\\Program Files\\Nanex\\NxCoreAPI\\NxCoreAPI.dll"))
    {
        fprintf(stderr, "Can't find NxCoreAPI.dll\n");
        return -1;
    }

    nxCoreClass.ProcessTape(argv[1], 0, NxCF_EXCLUDE_CRC_CHECK, 0, nxCoreCallback);

    return 0;
}

Example 2

Here's an example of find all NxCoreAPI.dlls on your system, and printing them, and a binary executable


#define _CRT_SECURE_NO_WARNINGS
#include <windows.h>
#include <stdio.h>

#include <NxCoreAPI.h>
#include <NxCoreAPI_class.h>

NxCoreClass nxCoreClass;

int __stdcall listDLL(void* pUserParam, const NxCoreAPIDLLFile* pNxDF)
{
    printf("%ld/%.2ld/%.2ld %.2d:%.2d:%.2d version:%ld.%ld.%ld size:%ld | %s\n",
            (long) pNxDF->BuildDate.Year, (long) pNxDF->BuildDate.Month,  (long) pNxDF->BuildDate.Day,
            (long) pNxDF->BuildTime.Hour, (long) pNxDF->BuildTime.Minute, (long) pNxDF->BuildTime.Second,
            (long) pNxDF->verMajor, (long) pNxDF->verMinor, (long) pNxDF->verBuild,
            (long) pNxDF->FileSize,
            pNxDF->PathnameStrZ
            );

    return  0;
}

int main(int argc, char** argv)
{
    const char* tape = "";

    if (!nxCoreClass.LoadNxCore("NxCoreAPI.dll"))
    {
        nxCoreClass.LoadNxCore("C:\\Program Files\\Nanex\\NxCoreAPI\\NxCoreAPI.dll");
    }

    printf("Looking for all NxCoreAPI.dll files in your system\n");

    nxCoreClass.ListAPIDLLs(0, listDLL, 0);

    return 0;
}