Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

NOW function returns same value over time

Status
Not open for further replies.

togu

Programmer
Apr 13, 2004
3
NO
I use the NOW function in SysUtils to get the current date and time, i.e:
Code:
 Label1.Caption := DateTimeToStr(NOW);

After i call a function from a statically loaded DLL, (witch replays via Windows Messages) the NOW function gives me the same date and time value as before and does not renew its value. Why? Anyone got an idea?

If i do not use the DLL function, the NOW function works fine.

Extra info:The DLL works as a middle tier and is made in C++ (I have no source access) and in turn communicates with a java software module.
myApp <--> DLL <--> JavaApp

Thanks in advance
 
May be the DLL is bogus/bugged/broken/rotten? :)

What the function you are calling is supposed to do?

buho (A).
 
Hi! buho, and thanks for your answer.

The DLL seems to be ok, but it may contain bugs.

I use the dll like this:

Ans := InitDLL(MyFormHandle,replyMsg);
Ans := sendTrans(SomePCharValue);
If the Answer from the sendTrans function is 0 then it was successful.
My app waits for the event from the DLL....... (DLL uses PostMessage)
And my App responds to the event by calling another dll function; GetTransAnswer(BufferVar);

After the event handeling is done the NOW function stops renewing its value. Every other part of my app is working fine after calling the dll but not the NOW function. I dont have a clue on how to solve this problem....
 

The only thing I can think about is some overrun corrupting your stack/memory. Check carefully your PChars vars having the due space assigned and your BufferVar having the due size (and may be a little more to be sure).

Remember Delphi will change your PChar spaces any time you change the data in Delphi itself. So if you assign 100k to a PChar "P" and then make P := 'ABC' it is likely P space shrinking to 3 bytes and changing the address pointed by P. Of course, the DLL code will not act this way, as the ASCIIZ strings handling is different in C.

buho (A).
 
I managed to obtain a "fresh" copy of the DLL and the case was solved.
The DLL file was corrupt.......

Thanks for all your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top