Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DLL is not Found
Message
 
To
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:
01378305
Views:
13
This message has been marked as the solution to the initial question of the thread.
>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 ?
NO! COM servers didn't accept ANY parameters in Init Event.
>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.
You can't. You must NOT use Init Event for anything else except some internal to the class settings.

Your Init event should look like this:
	PROCEDURE Init
		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
Then, in other application:
Arquivo_Inix = SYS(5) + SYS(2003) + "\SISTEMA.ini"
loBIBLIO_Ini = CREATEOBJECT("arquivos_ini.arquivos_ini") && If arquivos_ini is the name of the DLL
loBIBLIO_Ini.carquivo_ini = Arquivo_Inix
loBIBLIO_Ini.CallSomeMethod
>
>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
>
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Reply
Map
View

Click here to load this message in the networking platform