Page 1 of 1

DllPreparecall

PostPosted: Sun Nov 18, 2012 10:21 pm
by mosh1
Where can I get documentation ?

Re: DllPreparecall

PostPosted: Mon Nov 19, 2012 11:42 am
by Antonio Linares
There are two ways to use a DLL:

1. Static linking
2. Dynamic linking

In order to use static linking you have to create an import library from the DLL. You can use libdef.exe or libimp.exe:
impdef.exe mydll.def mydll.dll
or
implib.exe mydll.lib mydll.dll

implib.exe will create the lib. impdef.exe will create a def file (ascii file) and then you can create the lib from it.

Then you create a C function that calls the DLL C function and link the import library.

HB_FUNC( THE_FUNCTION_TO_CALL )
{
TheCalledCfunction();
}

From your app:

The_Function_to_Call()

2. Dynamic link:

There is no need to create an import library. The DLL is loaded at rutime and unloaded once it is used. FWH provides the following command to use the functions from the DLL:

DLL FUNCTION FuncionName( param AS TYPE ) AS RESULT_TYPE FROM FunctionName LIB DLLName

in example:

DLL FUNCTION Shell_NotifyIcon( nMsg AS LONG, pNID AS LPSTR ) AS BOOL PASCAL ;
FROM "Shell_NotifyIconA" LIB "shell32.dll"

Re: DllPreparecall

PostPosted: Mon Nov 19, 2012 11:53 am
by Antonio Linares

Re: DllPreparecall

PostPosted: Mon Nov 19, 2012 8:54 pm
by mosh1
DLL FUNCTION Shell_NotifyIcon( nMsg AS LONG, pNID AS LPSTR ) AS BOOL PASCAL ;
FROM "Shell_NotifyIconA" LIB "shell32.dll"


Thanks but It gives me error in straight HB3 w/o FW/ What is the Harbour syntax?

Re: DllPreparecall

PostPosted: Mon Nov 19, 2012 9:19 pm
by Antonio Linares
Thats a FWH command, are you using #include "FiveWin.ch" ?

Re: DllPreparecall

PostPosted: Mon Nov 19, 2012 9:30 pm
by mosh1
Antonio Linares wrote:Thats a FWH command, are you using #include "FiveWin.ch" ?


No I am trying to do it in HB3 w/o fw

Re: DllPreparecall

PostPosted: Tue Jan 08, 2013 1:01 pm
by Horizon
Hi Antonio,

Is it possible to use dll that is created c# .net platform?

Thanks

Re: DllPreparecall

PostPosted: Tue Dec 29, 2015 10:03 am
by Horizon
mosh1 wrote:
DLL FUNCTION Shell_NotifyIcon( nMsg AS LONG, pNID AS LPSTR ) AS BOOL PASCAL ;
FROM "Shell_NotifyIconA" LIB "shell32.dll"


Hi Antonio,

Is this function alive?. I have tried like below. It did not worked.

Shell_NotifyIcon("testtesttest")

Re: DllPreparecall

PostPosted: Tue Dec 29, 2015 10:11 am
by Antonio Linares
Hakan,

Windows API function Shell_NotifyIcon() expects different parameters:

https://msdn.microsoft.com/en-us/library/windows/desktop/bb762159%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396

You can not call it providing it a string

Re: DllPreparecall

PostPosted: Tue Dec 29, 2015 10:30 am
by Horizon
Antonio Linares wrote:Hakan,

Windows API function Shell_NotifyIcon() expects different parameters:

https://msdn.microsoft.com/en-us/library/windows/desktop/bb762159%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396

You can not call it providing it a string


Hi Antonio,

I just want to write a message in 5 seconds like msgwait() function at right corner of window desktop like w10.

Is there any function?

Re: DllPreparecall

PostPosted: Tue Dec 29, 2015 10:32 am
by Antonio Linares
Why don't you use Msgwait() ?

You can change its source code to place it where you want

Re: DllPreparecall

PostPosted: Tue Dec 29, 2015 10:40 am
by Horizon
Antonio Linares wrote:Why don't you use Msgwait() ?

You can change its source code to place it where you want


in w10, the messages can be read in systray notify center. thats why.

Re: DllPreparecall

PostPosted: Tue Dec 29, 2015 11:22 am
by Antonio Linares
Do you want it just for Windows 10 ?

Re: DllPreparecall

PostPosted: Tue Dec 29, 2015 1:05 pm
by Horizon
Antonio Linares wrote:Do you want it just for Windows 10 ?


Of course not. :oops:

Re: DllPreparecall

PostPosted: Tue Dec 29, 2015 7:16 pm
by Antonio Linares
So better implement your own version that will work on all Windows versions :-)