logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
UltraLaser  
#1 Posted : Monday, September 5, 2011 4:06:01 AM(UTC)
UltraLaser

Rank: Newbie

Groups: Registered, Registered Users
Joined: 9/5/2011(UTC)
Posts: 2

Hello! Please help - I link msfl11.dll dynamically and init the library after linking (call MSFL1_Initialize) - this is Ok. I OpenDir and Lock security - and read the data - all these are ok. But then I try to write new data with functions MSFL1_WriteDataRec or MSFL1_InsertDataRec it returns the error -100 (As I understand this is MSFL_ERR_INVALID_FUNCTION_CALL. I have MSFL1_WriteDataRec and MSFL1_InsertDataRec in msfl11.dll (I see these function in DLL Export Viewer utility). Please help - what's wrong? Please see code below int nErr = 0; char ch = 0; char cDirNumber = 0; HSECURITY hSecurity = 0; WORD wRecNum = 0; WORD wRecCount = 0; MSFLSecurityInfo_struct SecInfo; SecInfo.dwTotalSize = sizeof (MSFLSecurityInfo_struct); MSFLPriceRecord_struct PriceRec; memset(&PriceRec, 0, sizeof(MSFLPriceRecord_struct) ); DateTime_struct psRecordDate; typedef int (__stdcall *MFOPEN)(LPCSTR, char FAR *, int); MFOPEN pfOpenDir; VERIFY( pfOpenDir = (MFOPEN)::GetProcAddress( static_cast<HMODULE>(theApp.GetMSFL11Hinstance()), "MSFL1_OpenDirectory") ); nErr = pfOpenDir( ".\\M_Stock_Buf_I", &cDirNumber, MSFL_DIR_FORCE_USER_IN ); typedef int (__stdcall *MFFIRSTSECURITYINFO)(char, MSFLSecurityInfo_struct FAR *); MFFIRSTSECURITYINFO pfFirstSecInfo; VERIFY( pfFirstSecInfo = (MFFIRSTSECURITYINFO)::GetProcAddress( static_cast<HMODULE>(theApp.GetMSFL11Hinstance()), "MSFL1_GetFirstSecurityInfo") ); nErr = pfFirstSecInfo( cDirNumber, &SecInfo ); // SecInfo correctly filled //MSFLFUNC int __stdcall MSFL1_LockSecurity(HSECURITY hSecurity, UINT uiLockType); typedef int (__stdcall *MFLOCKSEC)(HSECURITY, UINT); MFLOCKSEC pfLockSec = NULL; VERIFY( pfLockSec = (MFLOCKSEC)::GetProcAddress( static_cast<HMODULE>(theApp.GetMSFL11Hinstance()), "MSFL1_LockSecurity") ); nErr = pfLockSec( SecInfo.hSecurity, MSFL_LOCK_WRITE_LOCK ); // Lock is OK nErr = 0 some temporary ~files in the MetaStock files direcotory. Files intraday WORD dwMaxRec = 0; //MSFLFUNC int __stdcall MSFL1_GetDataRecordCount(HSECURITY hSecurity, // WORD FAR *pwNumOfDataRecs); typedef int (__stdcall *MFGETDATARECORDCOUNT)(HSECURITY, WORD FAR *); MFGETDATARECORDCOUNT pfDataRecordCount; VERIFY( pfDataRecordCount = (MFGETDATARECORDCOUNT)::GetProcAddress( static_cast<HMODULE>(theApp.GetMSFL11Hinstance()), "MSFL1_GetDataRecordCount") ); nErr = (*pfDataRecordCount)( SecInfo.hSecurity, &dwMaxRec); //dwMaxRec filled with correct number of data records PriceRec.lDate = 20110905; PriceRec.lTime = 1030000; PriceRec.fOpen = 89.0f; PriceRec.fHigh = 92.0f; PriceRec.fLow = 88.3f; PriceRec.fClose = 90.9f; PriceRec.fVolume = 900000.0f; PriceRec.fOpenInt = 0.0f; PriceRec.wDataAvailable = MSFL_DATA_DATE + MSFL_DATA_TIME + MSFL_DATA_OPEN + MSFL_DATA_HIGH + MSFL_DATA_LOW + MSFL_DATA_CLOSE + MSFL_DATA_VOLUME; // WriteDataRec typedef int (__stdcall *MFWRITEDATAREC) (HSECURITY, const MSFLPriceRecord_struct*); MFWRITEDATAREC pfWriteDataRec; VERIFY( pfWriteDataRec = (MFWRITEDATAREC)::GetProcAddress( static_cast<HMODULE>(theApp.GetMSFL11Hinstance()), "MSFL1_WriteDataRec") ); nErr = (*pfWriteDataRec)( SecInfo.hSecurity, &PriceRec ); // nErr = -100 :( the same result for InsertDataRec with the same parameters nErr = (*pfDataRecordCount)( SecInfo.hSecurity, &dwMaxRec); // dwMaxRec as before - the same :( nErr = 0 // MSFLFUNC int __stdcall MSFL1_UnlockSecurity(HSECURITY hSecurity); typedef int (__stdcall *MFUNLOCKSEC)(HSECURITY); MFUNLOCKSEC pfUnlockLockSec; VERIFY( pfUnlockLockSec = (MFUNLOCKSEC)::GetProcAddress( static_cast<HMODULE>(theApp.GetMSFL11Hinstance()), "MSFL1_UnlockSecurity") ); nErr = pfUnlockLockSec( SecInfo.hSecurity ); // nErr - 0 after calling - the temporary files disappeared // MSFLFUNC int __stdcall MSFL1_CloseDirectory(char cDirNumber); typedef int (__stdcall *MFCLOSEDIR)(char); MFCLOSEDIR pfCloseDir; VERIFY( pfCloseDir = (MFCLOSEDIR)::GetProcAddress( static_cast<HMODULE>(theApp.GetMSFL11Hinstance()), "MSFL1_CloseDirectory") ); nErr = pfCloseDir( cDirNumber);
Users browsing this topic
Guest (Hidden)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.