#include "windows.h"
#include "commdlg.h"
#define DllExport extern "C" __declspec (dllexport)
DllExport int PKColor(int iInitColor) ;
static COLORREF crCustColors[256] ;
static CHOOSECOLOR cc ;
int WINAPI DllMain(HINSTANCE hinstance,DWORD fdwreason,PVOID pvReserved)
{
return TRUE;
}
DllExport int PKColor(int iInitColor)
{
cc.rgbResult = iInitColor ;
cc.lStructSize = sizeof (CHOOSECOLOR) ;
cc.hwndOwner = NULL ;
cc.hInstance = NULL ;
cc.lpCustColors = crCustColors ;
cc.Flags = CC_FULLOPEN | CC_RGBINIT ;
cc.lCustData = 0 ;
cc.lpfnHook = NULL ;
cc.lpTemplateName = NULL ;
ChooseColor (&cc) ;
return cc.rgbResult ;
}
having compiled it, use this code from the VFP command window
Declare integer PKColor in my.dll integer nColor
nColor = 0
nColor = PKColor(nColor)
by passing nColor on successive calls, you highlight your previously selected colour