🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: pl.comp.lang.pascal
8 messages
8 total messages Started by Mentor Wed, 02 Jan 2008 15:33
Lazarus i DLL ...
#92362
Author: Mentor
Date: Wed, 02 Jan 2008 15:33
14 lines
1331 bytes
Witam
   Potrzebuje napisać w oparciu o biblioteke dll program który by 
zczytywał dane ze sterownika PLC dane i zapisywał je w bazie danych....

Biblioteka produkcji visilogic... "UnCmDrv1.dll"

Sample jakie posiadam jest w Visual Basicu
Szukałem po google jak wykorzystać tą bibliotekę lub inną w Lazarusie 
ale jedyne co znajduje to wykorzystanie funkcji tu zaś mam kilka klas 
aktualnie potrzebuje skorzystać z "clsCommDriver" pytanie jak to napisać 
aby z tej klasy która jest zagnieżdżona w bibliotece móc korzystać :)
oraz ze zmiennych które są zdefiniowane w bibliotece ?

Pozdrawiam Mentor
Re: Lazarus i DLL ...
#92363
Author: DarekM
Date: Wed, 02 Jan 2008 20:22
13 lines
1229 bytes
Mentor pisze:
> Witam
>   Potrzebuje napisać w oparciu o biblioteke dll program który by 
> zczytywał dane ze sterownika PLC dane i zapisywał je w bazie danych....
> 
> Biblioteka produkcji visilogic... "UnCmDrv1.dll"


Nie wiem czy o to Ci chodzi. Poszukaj h2pas, który powinien generować z pliku 
nagłówkowego unit z deklaracjami funkcji z tej biblioteki.


Darek
Re: Lazarus i DLL ...
#92364
Author: Mentor
Date: Wed, 02 Jan 2008 23:31
52 lines
2391 bytes
DarekM pisze:
> Mentor pisze:
>> Witam
>>   Potrzebuje napisać w oparciu o biblioteke dll program który by 
>> zczytywał dane ze sterownika PLC dane i zapisywał je w bazie danych....
>>
>> Biblioteka produkcji visilogic... "UnCmDrv1.dll"
> 
> 
> Nie wiem czy o to Ci chodzi. Poszukaj h2pas, który powinien generować z 
> pliku nagłówkowego unit z deklaracjami funkcji z tej biblioteki.
> 
> 
> Darek

Może wstawie przykład z basica excel'a...

Dim mComDriver          As UnCmDrv1.clsCommDriver
Dim WithEvents mTimer   As UnCmDrv1.clsTimer

Private Function prvOpenPort() As Boolean
Dim eComParam As tPC_CommSettings  '<<<< zmienna z biblioteki dll

    'Create new instance of the Comm Driver Dll.
    Set mComDriver = New UnCmDrv1.clsCommDriver   '<< tutej mamy 
utworzenie jak by klasy w zmiennej mComDriver

    'Configure the connection parameters.
    With eComParam
       .Baudrate = eBR_38400
       .DataBits = eDB_8
       .Parity = eP_None
       .StopBits = eSB_1
       .TimeOut = 500
       .Retries = 3
    End With
    mComDriver.Comm_Autodetect = True    ' na ktorej wykonujemy operacje :/
    mComDriver.ShowCommMessages = True

    'Opens the com.
    prvOpenPort = mComDriver.Comm_Open(Cells(5, 4), eComParam)

End Function
__________________________

Tu pytanie jak coś podobnego zrobić w delphi ?
vb wykazuje spis funkcji i procedór dll'a i clsCommDriver z samej nazwy 
widać że to klasa osadzona w bibliotece dll

h2pas nie łyka tego wywala błąd

Pozdrawiam Mentor
Re: Lazarus i DLL ...
#92365
Author: DarekM
Date: Thu, 03 Jan 2008 09:24
16 lines
1517 bytes
> 
> Tu pytanie jak coś podobnego zrobić w delphi ?
> vb wykazuje spis funkcji i procedór dll'a i clsCommDriver z samej nazwy 
                              ^^^^^^^^
                              oczy od tego bolą

> widać że to klasa osadzona w bibliotece dll
> 
> h2pas nie łyka tego wywala błąd
h2pas łyka plik nagłówkowy z C, bo w nim pewnie jest napisana dll
musisz utworzyć unit UnCmDrv1 i w nim zadeklarować wszystkie typy z dll oraz 
zadeklarować dowiązania do funkcji,
poszukaj modułów ze słowem external


Darek
Re: Lazarus i DLL ...
#92366
Author: Łukasz 'Maly' Ostrowski
Date: Thu, 03 Jan 2008 15:47
35 lines
2332 bytes
DarekM wrote:
>> Tu pytanie jak coś podobnego zrobić w delphi ?
>> vb wykazuje spis funkcji i procedur dll'a i clsCommDriver z samej
>> nazwy widać że to klasa osadzona w bibliotece dll
>>
>> h2pas nie łyka tego wywala błąd
> h2pas łyka plik nagłówkowy z C, bo w nim pewnie jest napisana dll
> musisz utworzyć unit UnCmDrv1 i w nim zadeklarować wszystkie typy z
> dll oraz zadeklarować dowiązania do funkcji,
> poszukaj modułów ze słowem external

To też nie wyjdzie, ten DLL to ActiveX/COM/TypeLib. Użycie tej
biblioteki w FPC będzie conajmniej problematyyczne, ale możliwe,
uses ActiveX, i jazda z kolejnymi callami do OLE, piekło. :]

Podglądnąć sobie można ta biblioteke w OLE/COM Object Viewerze na
przykład. Znajduje się on np. w Windows SDK.

Jeżeli potrzeba tylko ograniczonej funkcjonalnośći to można
spróbować napisać wrapper/proxy w C/Cpp, skompilować do DLLki
a później to oprogramować w FPC ;). Ale to droga przez mękę.

Snip z freepascal.org:
Planned for next versions
  Next major Version (2.4)
    Language:
      Support for DispInterface and dispid (OLE binding on Windows).

Tak, to jeszcze potrwa dłuższa chwile ;). A najprościej będzie
napisać to w Visual Studio lub Delphi ;).

-- 
Pozdrawiam,
Łukasz 'Maly' Ostrowski.
http://maly.nemo.pl/ 
Re: Lazarus i DLL ...
#92369
Author: DarekM
Date: Thu, 24 Jan 2008 20:53
36 lines
2425 bytes
it. Deut. 30:6: "God will circumcise thine
heart, and the heart of thy seed, that thou mayest love Him with all thine
heart."

That the uncircumcised in heart shall be judged. Jeremiah 9:26: For God will
judge the uncircumcised peoples, and all the people of Israel, because he is
"uncircumcised in heart."

That the external is of no avail apart from the internal. Joel 2:13:
Scindite corda vestra,104 etc.; Isaiah 58:3, 4, etc.

The love of God is enjoined in the whole of Deuteronomy. Deut. 30:19: "I
call heaven and earth to record that I have set before you life and death,
that you should choose life, and love God, and obey Him, for God is your
life."

That the Jews, for lack of that love, should be rejected for their offences,
and the heathen chosen in their stead. Hosea 1:10; Deut. 32:20. "I will hide
my face from them, I will see what their end shall be, for they are a very
froward generation, children in whom is no faith. have moved me to jealousy
with that which is not God... and I will move them to jealousy with those
which are not a people... and with a foolish nation." Isaiah 65:1.

That temporal goods are false, and that the true good is to be united to
God. Psalm 143:15.

That their feasts are displeasing to God. Amos 5:21.

That the sacrifices of the Jews displeased God. Isaiah 66:1-3; 1:11; Jer.
6:20; David, Miserere.105 Even on the part of the good, Expectavi.106 Psalm
49:8, 9, 10, 11, 12, 13, and 14.

That He has established them only for their hardness. Micah, admirably, 6; 1
Kings 15:22; Hosea 6:6.

That the sacrifices of the Gentiles will be accep
Re: Lazarus i DLL ...
#92367
Author: DarekM
Date: Thu, 24 Jan 2008 21:20
17 lines
2015 bytes
embarked. Which will
you choose then? Let us see. Since you must choose, let us see which
interests you least. You have two things to lose, the true and the good; and
two things to stake, your reason and your will, your knowledge and your
happiness; and your nature has two things to shun, error and misery. Your
reason is no more shocked in choosing one rather than the other, since you
must of necessity choose. This is one point settled. But your happiness? Let
us weigh the gain and the loss in wagering that God is. Let us estimate
these two chances. If you gain, you gain all; if you lose, you lose nothing.
Wager, then, without hesitation that He is. "That is very fine. Yes, I must
wager; but I may perhaps wager too much." Let us see. Since there is an
equal risk of gain and of loss, if you had only to gain two lives, instead
of one, you might still wager. But if there were three lives to gain, you
would have to play (since you are under the necessity of playing), and you
would be imprudent, when you are forced to play, not to chance your life to
gain three at a game where there is an equal risk of loss and gain. But
there 
Re: Lazarus i DLL ...
#92368
Author: DarekM
Date: Thu, 24 Jan 2008 21:53
48 lines
2324 bytes
deceivableness of unrighteousness in them that perish, because they received
not the love of the truth, that they might be saved. And for this cause God
shall send them strong delusion, that they should believe a lie."

205Deut. 13:3. "for the Lord your God proveth you, to know whether ye love
the Lord."

206Matt. 24:25-26. "Behold, I have told you before. Wherefore if they shall
say unto you, Behold."

207Is. 5:4. Quis est quod debui ultra facere vineae meae, et non faci ei?
"What could have been done more to my vineyard, that I have not done in it?"

[208]Gal. 1:8. "But though an angel."

209Ps. 41:4. "Where is thy God?"

[210]Ps. 111:4. "Unto the upright there ariseth light in the darkness."

211"The yes and the no."

212Is. 10:1. "Woe unto them that decree unrighteous decrees."

213John 15:24. "If he had not done."

214John 15:24. "If he had not done among them the works which none other man
did."

215Prov. 26. 4-5. "Answer... Answer not."

[216]Epistle 63. "Priest of the Lord."

[217]Luke 22:26. "But ye shall not be so."

[218]John 10:30. "I and my father are one."

219John 5:7. "And these three agree in one."

220"The strictest law is the greatest injustice." Terrence, Heauton
Timorumenus, iv. 5. 47; and Cicero, De officiis, i. 10.

221John 21:17. "Feed my sheep." Not "yours."

222"The Church will never be reformed."

223Jas. 4:6. "God giveth grace unto the humble."

224"But did he not give them
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads