FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour How can I call external 2 DLL files in my prog?*Successful*
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
How can I call external 2 DLL files in my prog?*Successful*
Posted: Tue Nov 29, 2005 06:51 AM

Dear All,

I've used our 2 DLL files. How can I register or load in program and switch to use Dialog in 2nd Resource file (DLL)? I've used in FW16bits but I don't know how to use with xHB/FWH 2.5.

Thanks in advance,
Dutch

Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
How can I call external 2 DLL files in my prog?*Successful*
Posted: Tue Nov 29, 2005 06:39 PM

Dutch,

You may select one of the DLLs doing a:

SET RESOURCES TO "name_dll"

before using resources from it.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
It doesn't work with the same code FW and FWH
Posted: Tue Nov 29, 2005 07:05 PM

Dear Antonio,

This is my code is following and it've shown below message on EntryScr procedure.

** Fivewin Error/3 Cannot Create Dialog **

//---------------//
Function Main
Public hResc

hResc := LoadLibrary( "BWCC32.dll" ) // new fwh

SET RESOURCES TO "EZ4SCR.DLL" // new fwh
SET RESOURCES TO "EZ4.DLL" // new fwh

BWCCRegister( GetResources() ) // new fwh
...
...
return
//----------------//
Function EntryScr
SET RESOURCES TO "EZ4SCR.DLL"

DEFINE DIALOG oDlg RESOURCE 'RSFIELDS' TITLE 'In House List'
..
..

ACTIVATE DIALOG oDlg ON PAINT (SetResources( MEMVAR->hResc ))
return

Regards,
Dutch

Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
How can I call external 2 DLL files in my prog?*Successful*
Posted: Tue Nov 29, 2005 09:55 PM

Dutch,

Try this:

Function EntryScr

SET RESOURCES TO "EZ4SCR.DLL"
BWCCRegister( GetResources() ) // again

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
How can I call external 2 DLL files in my prog?*Successful*
Posted: Wed Nov 30, 2005 12:28 AM

Dutch

Just curious why you have two .dll's ... If you are creating your .dll's from .rc you can combine all your .rc's into one single .rc and then import them into a single .dll

I have modified rc2dll32.bat file as follows:

rem RC file to 32 bits resources DLL
rem syntax: rc2dll32.bat Your_rc_file !!! without the .RC extension

DEL VEH32.DLL
DEL VEH32.RC

: combine all .rc into a single .rc
COPY *.RC VEH32.RC

bcc32 -c c:\fwh26\dll\screen32.c
brc32 -r %1.rc
ilink32 /Tpd c:\borland\lib\c0d32.obj screen32.obj, %1.dll,,c:\borland\lib\cw32.lib c:\borland\lib\import32.lib,, %1.res
echo done!

Rick Lipkin
SC Dept of Health, USA

Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
Thanks
Posted: Wed Nov 30, 2005 03:31 AM

Dear Rick,

The 1st DLL (Convert to RC) file is our fixed entry screen (unmodification for user) and 2nd DLL is user modification entry screen (Booking screen) for each customer site. I compile my first DLL (RC) file to EXE file and 2nd will be able to modify (custom screen without changing source code) for customer need. Why has it 2 DLL files.


Dear Antonio,

It has another problem is the program does not focus to the main resource (1st RC file) when exit from 2nd DLL. I try to do exit EZ4SCR.DLL and focus to EZ4.RC as following but it didn't work.

//--------------------//
Function EntryScr

local hDLL := SETRESOURCES("EZ4SCR.DLL")

BWCCRegister( GetResources() )

DEFINE DIALOG oDlg RESOURCE "RSFIELDS"

ACTIVATE DIALOG oDlg ON PAINT (FreeLibrary( hDLL), SetResource( MEMVAR->hResc ))
return

How can I tell the program to focus at 1 RC file?

Thanks&Regards,
Dutch

Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
How can I call external 2 DLL files in my prog?*Successful*
Posted: Wed Nov 30, 2005 09:10 AM

Dutch,

Are you using Borland controls in both DLLs ?

Was it working on 16 bits ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
It works on FW16bits
Posted: Wed Nov 30, 2005 11:57 AM

Dear Antonio,

Yes, I've used Borland Control and it works in FW16bit. The 1st RC file is the same name of EXE file and the 2nd DLL is custom entry screen. This is my FW16 bits code
Example
=======

Static hResc


Function main()
hResc := GetResources()
SET RESOURCES TO ("SECOND.DLL")
SET RESOURCES TO ("BWCC.DLL")
SetResource( hResc )
..


Function Scr
Set Resource To "SECOND.DLL"
DEFINE DIALOG ...
ACTIVATE DIALOG ... ON PAINT SetResources( hResc )
return

Regards,
Dutch

Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
How can I call external 2 DLL files in my prog?*Successful*
Posted: Wed Nov 30, 2005 06:27 PM

Dutch,

Maybe un 32 bits you have to FreeLibrary() the BWCC32.dll before registering it again. Please try it, thanks.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
2 DLL files load is working
Posted: Wed Nov 30, 2005 07:04 PM

Dear Antonio,

It works if I use all in DLL files as below. But it didn't work if I use main resource as RC file. How can I load default (main) RC file as this cause.
ACTIVATE DIALOG oDlg ;
ON PAINT (SetResources("EZ4.DLL"), BWCCRegister( GetResources() ))

This code is working but can I do my case?
//---------------//
Function Main
Public hResc

hResc := LoadLibrary( "BWCC32.dll" ) // new fwh

SET RESOURCES TO "EZ4SCR.DLL" // new fwh
SET RESOURCES TO "EZ4.DLL" // new fwh

BWCCRegister( GetResources() ) // new fwh
...
...
return

//----------------//
Function EntryScr
SET RESOURCES TO "EZ4SCR.DLL"

DEFINE DIALOG oDlg RESOURCE 'RSFIELDS' TITLE 'In House List'
..
..

ACTIVATE DIALOG oDlg ;
ON PAINT (SetResources("EZ4.DLL"), BWCCRegister( GetResources() ))
return

Best regards,
Dutch

Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
How can I call external 2 DLL files in my prog?*Successful*
Posted: Wed Nov 30, 2005 07:19 PM

Dutch,

This code is dangerous:

ON PAINT (SetResources("EZ4.DLL"), BWCCRegister( GetResources() ))

as ON PAINT gets called many times. You should better do it from the ON INIT clause or use the <oDlg>:bStart codeblock, that it is evaluated just once.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
Can I use EZ4.RC file instead of EZ4.DLL?
Posted: Thu Dec 01, 2005 03:25 AM

Dear Antonio,

Can I load from default RC (same name with EXE file) instead of DLL? Because I want to include RC in EXE and distribute one DLL only but I don't know how to recall default RC file.

Best regards,
Dutch

Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
How can I call external 2 DLL files in my prog?*Successful*
Posted: Thu Dec 01, 2005 09:21 AM

Dutch,

Yes. FWH will look in the EXE by default. In order to use a DLL you do a SET RESOURCES TO "name.dll" and when you are ready with it, then you do SET RESOURCES TO, so FWH will search again in the EXE.

Please try it this way.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
Thanks a lot
Posted: Thu Dec 01, 2005 09:52 AM

Dear Antonio,

It works now.

Thanks for big help,
Dutch

Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)

Continue the discussion