Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
Terabyte
23
Years of Service
User Offline
Joined: 28th Dec 2002
Location: UK
Posted: 10th Oct 2003 00:22
Before some flange basket says this has nothing to do with DBPRO. Please read what i have to say

I have this code in delphi 7. It builds ok:



The idea of that code was to print the word "this is a test string" later on in dbpro and make a new form window.

I have this code in DBPRO (thankyou lagmaster). It makes "this is a test string appear" but then no form window .. ive tried doing one with buttons (its currently remarked) but i cant get it to appear either) i know i havnt free'd the doodahh and somewhere i have a memory leek. Is this why it doesnt work. Could sombody try this code. See whats wrong. and preferably correct it if not tell me how to correct it (you will need delphi 7(and dbpro))




The following threads and their accompanying sound tracks are protected by copyright and any broadcast public diffusion, copying and edditing are etc... etc.. you may not complain about my Typo's
empty
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: 3 boats down from the candy
Posted: 10th Oct 2003 00:43
Well first of all change
TForm.Create(tnewtformname)
to
newtformname := TForm.Create(nil)

Secondly, in your dll call
id3$ = call dll(2,"retstr", teststr$
you send a parameter but your function doesn't accept any.
So change
function retstr: PChar;
to
function retstr(InChar: PChar): PChar;

I awoke in a fever. The bedclothes were all soaked in sweat.
She said "You've been having a nightmare and it's not over yet"
Terabyte
23
Years of Service
User Offline
Joined: 28th Dec 2002
Location: UK
Posted: 10th Oct 2003 01:05
that last bit

Secondly, in your dll call
id3$ = call dll(2,"retstr", teststr$
you send a parameter but your function doesn't accept any.
So change
function retstr: PChar;
to
function retstr(InChar: PChar): PChar;


can ye say that again plz .. where abouts does it go... are you sure youve got enough brackets there?

The following threads and their accompanying sound tracks are protected by copyright and any broadcast public diffusion, copying and edditing are etc... etc.. you may not complain about my Typo's
empty
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: 3 boats down from the candy
Posted: 10th Oct 2003 01:13
Yeah I know copy and paste is not my strength

Well, in db you call the DLL function named retstr with the variable teststr$ as a parameter. In the Delphi source the function named retstr doesn't accept any parameters.
So in your Delphi code the correct line would be:

function retstr(InChar: PChar): PChar; stdcall;

I awoke in a fever. The bedclothes were all soaked in sweat.
She said "You've been having a nightmare and it's not over yet"
Terabyte
23
Years of Service
User Offline
Joined: 28th Dec 2002
Location: UK
Posted: 10th Oct 2003 01:48
so know i have



undeclared identifier aa

The following threads and their accompanying sound tracks are protected by copyright and any broadcast public diffusion, copying and edditing are etc... etc.. you may not complain about my Typo's
Terabyte
23
Years of Service
User Offline
Joined: 28th Dec 2002
Location: UK
Posted: 10th Oct 2003 01:51
OMG!!!!

it sorta worked!!

when i changed function retstr(InChar: PChar): PChar; stdcall; back to what it was so not to give an undecalred identifirer error with aa, i managed to see a form window appear in db.. but then the program crashed!... (send dont send bug report type of crash) so.. i guess thats a memory leek i was warned about... how do i clear this up.. (if it is a memory leek)

The following threads and their accompanying sound tracks are protected by copyright and any broadcast public diffusion, copying and edditing are etc... etc.. you may not complain about my Typo's
empty
23
Years of Service
User Offline
Joined: 26th Aug 2002
Location: 3 boats down from the candy
Posted: 10th Oct 2003 02:26
Sorry I confused the function names. the delphi functions are ok

It crashes because you unload the DLL in DB without freeing newtformname. You can check that when you insert "Wait key" before "Delete DLL 2" (it'll run fine to that point).

So you've got two possibilties now:
1) You create a new ExitProc or
2) You free the Form with another procedure, called from withing DB

Like:
procedure FreeMyForm;
begin
newtformname.free;
end;

I awoke in a fever. The bedclothes were all soaked in sweat.
She said "You've been having a nightmare and it's not over yet"

Login to post a reply

Server time is: 2026-07-26 05:03:20
Your offset time is: 2026-07-26 05:03:20