PluginOpen wurde doch afaik durch die Dll...-Funktionen ersetzt, aber manchmal kann es immer noch nützlich sein.
@Deepred: Das habe ich gefunden
Spoiler anzeigen
C
#include <stdio.h>
#include <windows.h>
#include "AU3_Plugin_SDK\au3plugin.h"
/****************************************************************************
* Function List
*
* This is where you define the functions available to AutoIt. Including
* the function name (Must be the same case as your exported DLL name), the
* minimum and maximum number of parameters that the function takes.
*
****************************************************************************/
/* "FunctionName", min_params, max_params */
AU3_PLUGIN_FUNC g_AU3_Funcs[] =
{
{"AnalyzeHand", 7, 7}
};
/****************************************************************************
* AU3_GetPluginDetails()
*
* This function is called by AutoIt when the plugin dll is first loaded to
* query the plugin about what functions it supports. DO NOT MODIFY.
*
****************************************************************************/
AU3_PLUGINAPI int AU3_GetPluginDetails(int *n_AU3_NumFuncs, AU3_PLUGIN_FUNC **p_AU3_Func)
{
/* Pass back the number of functions that this DLL supports */
*n_AU3_NumFuncs = sizeof(g_AU3_Funcs)/sizeof(AU3_PLUGIN_FUNC);
/* Pack back the address of the global function table */
*p_AU3_Func = g_AU3_Funcs;
return AU3_PLUGIN_OK;
}
/****************************************************************************
* DllMain()
*
* This function is called when the DLL is loaded and unloaded. Do not
* modify it unless you understand what it does...
*
****************************************************************************/
BOOL WINAPI DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
/****************************************************************************
*AnalyzeHand
*
****************************************************************************/
int HR[32487834];
int LookupHand(int* pCards)
{
int p = HR[53 + *pCards++];
p = HR[p + *pCards++];
p = HR[p + *pCards++];
p = HR[p + *pCards++];
p = HR[p + *pCards++];
p = HR[p + *pCards++];
return HR[p + *pCards++];
}
AU3_PLUGIN_DEFINE(AnalyzeHand)
{
AU3_PLUGIN_VAR *pMyResult;
int card1, card2, card3, card4, card5, card6, card7, rawEval;
/* Allocate the return variable */
pMyResult = AU3_AllocVar();
/* Two parameters were numbers, get the values */
card1 = AU3_GetInt32(&p_AU3_Params[0]);
card2 = AU3_GetInt32(&p_AU3_Params[1]);
card3 = AU3_GetInt32(&p_AU3_Params[2]);
card4 = AU3_GetInt32(&p_AU3_Params[3]);
card5 = AU3_GetInt32(&p_AU3_Params[4]);
card6 = AU3_GetInt32(&p_AU3_Params[5]);
card7 = AU3_GetInt32(&p_AU3_Params[6]);
//rawEval = card1 + card2 + card3 + card4 + card5 + card6 + card7;
int cards[] = {card1, card2, card3, card4, card5, card6, card7};
memset(HR, 0, sizeof(HR));
FILE * fin = fopen("HandRanks.dat", "rb");
if (!fin)
return false;
size_t bytesread = fread(HR, sizeof(HR), 1, fin); // get the HandRank Array
fclose(fin);
rawEval = LookupHand(cards);
AU3_SetInt32(pMyResult, rawEval);
/* Pass back the result, error code and extended code.
* Note: AutoIt is responsible for freeing the memory used in p_AU3_Result
*/
*p_AU3_Result = pMyResult;
*n_AU3_ErrorCode = 0;
*n_AU3_ExtCode = 0;
return AU3_PLUGIN_OK;
}
Alles anzeigen
Das dürfte dir weiterhelfen.