Thread overview
Cannot convert of type HANDLE to HANDLE
Sep 08, 2009
Sam Hu
Sep 08, 2009
div0
Sep 09, 2009
Sam Hu
Sep 09, 2009
Ary Borenszweig
Sep 10, 2009
Sam Hu
September 08, 2009
Under DMD 2.032+Window Xp:

Can I use

HMODULE LoadLibraryEx(
  LPCTSTR lpFileName,  // file name of module
  HANDLE hFile,           // reserved, must be NULL
  DWORD dwFlags           // entry-point execution option
);

in D2?Given below code :

HMODULE hDll=LoadLibraryEx(toStringz("netmsg.dll"),null,        DONT_RESOLVE_DLL_REFERENCES);
I got below error:
cannot implicitly convert expression (LoadLibraryExA(toStringz("netmsg.dll"),null,1u)) of type HANDLE to HANDLE

What's the problem?
Thanks for your help in advance.

Regards,
Sam

September 08, 2009
Sam Hu wrote:
> Under DMD 2.032+Window Xp:
> 
> Can I use
> 
> HMODULE LoadLibraryEx(
>   LPCTSTR lpFileName,  // file name of module
>   HANDLE hFile,           // reserved, must be NULL
>   DWORD dwFlags           // entry-point execution option
> );
> 
> in D2?Given below code :
> 
> HMODULE hDll=LoadLibraryEx(toStringz("netmsg.dll"),null,        DONT_RESOLVE_DLL_REFERENCES);
> I got below error:
> cannot implicitly convert expression (LoadLibraryExA(toStringz("netmsg.dll"),null,1u)) of type HANDLE to HANDLE
> 
> What's the problem?
> Thanks for your help in advance.
> 
> Regards,
> Sam
> 

You must have two different HANDLEs around.
The one in phobos is aliased to void* and there is no LoadLibraryEx call
in phobos, so you must be using something else.
Try using the FQN of the import where you are getting the LoadLibraryEx
from.

- --
My enormous talent is exceeded only by my outrageous laziness.
http://www.ssTk.co.uk
September 09, 2009
div0 Wrote:
> You must have two different HANDLEs around.
> The one in phobos is aliased to void* and there is no LoadLibraryEx call
> in phobos, so you must be using something else.
> Try using the FQN of the import where you are getting the LoadLibraryEx
> from.
Thanks for your help.

Yeah.I use DFL plus win32 package(http://www.dsource.org/projects/bindings/wiki/WindowsApi).
import dfl.all;
import Win32=win32.windows;
Now it got compiled and ran,but all main functions wrote in win32 API did not work(I mean does nothing),almost just a functionless Form.

PS.For *FQN of the import*,what do you mean?

Regards,
Sam


September 09, 2009
Sam Hu escribió:
> div0 Wrote:
>> You must have two different HANDLEs around.
>> The one in phobos is aliased to void* and there is no LoadLibraryEx call
>> in phobos, so you must be using something else.
>> Try using the FQN of the import where you are getting the LoadLibraryEx
>> from.
> Thanks for your help.
> 
> Yeah.I use DFL plus win32 package(http://www.dsource.org/projects/bindings/wiki/WindowsApi).
> import dfl.all;
> import Win32=win32.windows;
> Now it got compiled and ran,but all main functions wrote in win32 API did not work(I mean does nothing),almost just a functionless Form.
> 
> PS.For *FQN of the import*,what do you mean?

FQN = Fully Qualified Name
September 10, 2009
Ary Borenszweig Wrote:
> FQN = Fully Qualified Name

Got it.Thanks!