April 29, 2024, 05:03:05 AM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


DLL path

Started by JoaoAfonso, November 10, 2009, 07:16:38 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

JoaoAfonso

Good evening.
Saw in other posts that DLL a program uses must be in the same path as the .exe file. Can't this be changed to a subdirectory of the dir .exe is?
Thanks in advance
JoÃÆ'ƒÂÃ,£o Afonso
Viriato
-----------------
Iberia MUD
www.iberiamud.com
iberiamud.com:5900

LarryMc

November 10, 2009, 12:12:24 PM #1 Last Edit: November 10, 2009, 12:33:00 PM by Larry McCaughn
I believe so if you use the full path; but I haven't tried it.

Are you talking about a dll that will be linked into your final exe?
From the EB Help file:
QuoteIf you wish to use your newly created DLL with Emergence BASIC just create an import library for it as outlined in Using DLL's. The DLL must be either in your system directory or the executables directory.

Otherwise declare a function in a dll with:
DECLARE "c:\somedir\image322.dll",ChangeSize(hBmp:INT,nWidth:INT,nHeight:INT),INT
I believe that will work for you.
Try it and see.
Larry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Ionic Wind Support Team

No.  Emergence doesn't determine the rules, Windows does.  A DLL can be in one of the following if loaded statically (with an import library)...

http://msdn.microsoft.com/en-us/library/ms682586(VS.85).aspx

You can put a DLL anywhere if you use LoadLibrary and indirectly call the functions using GetProcAddress

Paul.
Ionic Wind Support Team

zaphod

Hello,

An exemple of use dynamicaly a DLL (cards.dll in windows dir) :


$include "windows.inc"
'
declare cdtInit(int a,int b)
declare cdtTerm()
declare cdtDrawExt(int a,int b, int c, int d, int e,int f, int g = 0,int h = 0)
'
ENUM controls
BUTTON_1
static_1
ENDENUM
'
DIALOG d1
CREATEDIALOG d1,0,0,568,336,0x80C80080,0,"Caption",&d1_handler
CONTROL d1,@BUTTON,"Button1",13,20,70,20,0x50000000,BUTTON_1
CONTROL d1,@STATIC,"Static",184,13,70,20,0x5000010B,static_1

SHOWDIALOG d1
WAITUNTIL d1=0


SUB d1_handler
SELECT @MESSAGE
CASE @IDINITDIALOG
CENTERWINDOW d1
/* Initialize any controls here */
CASE @IDCLOSEWINDOW
CLOSEDIALOG d1,@IDOK
CASE @IDCONTROL
SELECT @CONTROLID
CASE BUTTON_1
IF @NOTIFYCODE = 0
load()
/*button clicked*/
ENDIF
ENDSELECT
ENDSELECT
RETURN
ENDSUB

sub load()
int handle
handle=_loadlibrary("cards.dll")
'

uint init,term,DRAW
init=_getprocaddress(handle,"cdtInit")
term=_getprocaddress(handle,"cdtTerm")
draw=_getprocaddress(handle,"cdtDrawExt")
int w,h,hdc
hdc=gethdc(d1)
!<cdtinit>init(&w,&h)
!<cdtdrawext>draw(hdc,50,50,80,100,15,0,0)
!<cdtterm>term()
releasehdc(d1,hdc)
if handle
_freelibrary(handle)
ENDIF

ENDSUB


JoaoAfonso

Very well.
Thought was easier, though.
Thank you for the answers.
JoÃÆ'ƒÂÃ,£o Afonso
Viriato
-----------------
Iberia MUD
www.iberiamud.com
iberiamud.com:5900