Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DLL is not Found
Message
From
29/01/2009 16:51:24
Peter Wagner
Point Informática Ltda.
Limeira, Brazil
 
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Database:
MS SQL Server
Application:
Desktop
Miscellaneous
Thread ID:
01378274
Message ID:
01378300
Views:
13
>>When I run the code below
>>
>>Arquivo_Inix = SYS(5) + SYS(2003) + "\SISTEMA.ini"
>>loBIBLIO_Ini = CREATEOBJECT("arquivos_ini.dll", Arquivo_Inix)
>>
>>It returns this error message:
>>
>>"Class definition ARQUIVOS_INI.DLL is not found."
>>
>>arquivos_ini.dll is a Multi-threaded COM DLL generated with VFP and is registered.
>>I'm also passing a value to the INIT event of the DLL
>>
>>Any ideia why it doesn't work?
>>
>>TIA
>
>You could make an instance f VFP created DLL like this:
>DLLName.ClassInIt
>
>So, you MUST use this:
>
>loBIBLIO_Ini = CREATEOBJECT("arquivos_ini.ClassNameFromThatDLL")
>
>
>Also keep in mind that COM server didn't accept parameters in INIT event, so you must create your own method to handle what you want. Let me explain (I hope I could)
>
>Make a project named ARQUIVOS_INI.
>Add a Program in it, no matter what its name.
>In that ORG put:
>
>DEFINE CLASS MyClass AS Custom OLEPUBLIC
>
>      FUNCTION HandleINIFiles(lcPath AS STRING) AS String
>         LOCAL lcRetVal
>         lcretVal = ""
>         IF NOT EMPTY(m.lcPath)
>            **** do what you want to do here
>         ENDIF
>     RETURN  lcRetval
>
>ENDDEFINE
>
>
>Then in other application you cold use this:
>
>Arquivo_Inix = SYS(5) + SYS(2003) + "\SISTEMA.ini"
>loBIBLIO_Ini = CREATEOBJECT("arquivos_ini.MyClass")
>? loBIBLIO_Ini.HandleINIFiles(m.Arquivo_Inix)
>
Borislav,
thanks for the info, in fact I have a project with the same name... But was informed that it is necessary to pass some value to the INIT event of the DLL.
Is it true ?
If not and I create an object, how can I pass a value to the INIT event of the class that the DLL is based on? or it's just not possible.
TIA

My class has this structure:
DEFINE CLASS arquivos_ini AS custom OLEPUBLIC

	carquivo_ini = ""
	nultimoerro = 0
	Name = "arquivos_ini"

	PROCEDURE ler_valor_arq_ini
		LPARAMETER TcSessao, tcNomeChave, tcArquivo_ini
		LOCAL lcArq_ini, lnError, lnRetval, lcBuffer, lcRetval
		IF EMPTY(tcArquivo_ini)
			lcArquivo_ini= THIS.cArquivo_ini
		ELSE
			lcArquivo_ini= tcArquivo_ini
		ENDIF
		lcBuffer = SPACE(250) + CHR(0)
		IF GetPrivateProfileString(TcSessao, tcNomeChave, "", @lcBuffer, LEN(lcBuffer), lcArquivo_ini) > 0
			lcRetval = ALLTRIM(CHRTRAN(lcBuffer, CHR(0), ""))
			THIS.nUltimoErro= 0
		ELSE
			THIS.nUltimoErro= GetLastError()
			lcRetval = ""
		ENDIF
		RETURN lcRetval
	ENDPROC


	PROCEDURE excluir_sessao_ini
		LPARAMETER TcSessao, tcArquivo_ini
		LOCAL lcArq_ini, lnError, lnRetval
		IF EMPTY(tcArquivo_ini)
			lcArquivo_ini= THIS.cArquivo_ini
		ELSE
			lcArquivo_ini= tcArquivo_ini
		ENDIF
		lnError = WritePrivateProfileSection(TcSessao, "", lcArquivo_ini)
		IF lnError = 0
			THIS.nUltimoErro= GetLastError()
		ELSE
			THIS.nUltimoErro= 0
		ENDIF
		RETURN IIF(lnError = 0, THIS.nlasterror, 0)
	ENDPROC


	PROCEDURE grava_arq_ini
		LPARAMETER TcSessao, tcNomeChave, tcValue, tcArquivo_ini
		LOCAL lcArq_ini, lnError, lnRetval, lcBuffer, lnError
		IF EMPTY(tcArquivo_ini)
			lcArquivo_ini= THIS.cArquivo_ini
		ELSE
			lcArquivo_ini= tcArquivo_ini
		ENDIF
		lnError = WritePrivateProfileString(TcSessao, tcNomeChave, tcValue, lcArquivo_ini)
		IF lnError = 0
			THIS.nUltimoErro= GetLastError()
		ELSE
			THIS.nUltimoErro= 0
		ENDIF
		RETURN IIF(lnError = 0, THIS.nlasterror, 0)
	ENDPROC

	PROCEDURE Init
		LPARAMETER tcArquivo_ini
		IF NOT EMPTY(tcArquivo_ini) AND TYPE("tcArquivo_ini") = "C"
			THIS.cArquivo_ini= tcArquivo_ini
		ELSE
			THIS.cArquivo_ini= ""
		ENDIF
		DECLARE LONG GetPrivateProfileString IN WIN32API ;
			STRING lpApplicationName, ;
			STRING lpKeyName, ;
			STRING lpDefault, ;
			STRING @lpReturnedString, ;
			LONG nSize, ;
			STRING lpFileName

		DECLARE LONG WritePrivateProfileString IN WIN32API ;
			STRING lpApplicationName, ;
			STRING lpKeyName, ;
			STRING lpString, ;
			STRING lpFileName

		DECLARE LONG WritePrivateProfileSection IN WIN32API ;
			STRING lpAppName, ;
			STRING lpString, ;
			STRING lpFileName

		DECLARE LONG GetLastError IN WIN32API
	ENDPROC

ENDDEFINE
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform