www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Cannot convert of type HANDLE to HANDLE

reply Sam Hu <samhudotsamhu gmail.com> writes:
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
Sep 08 2009
parent reply div0 <div0 users.sourceforge.net> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iD8DBQFKppXJT9LetA9XoXwRAtjpAKCekF9+98z16ISxv8dglgBAovRpcgCgq8kR g5OtnDy+4rOXpGnu5fBaxG8= =qIrZ -----END PGP SIGNATURE-----
Sep 08 2009
parent reply Sam Hu <samhudotsamhu gmail.com> writes:
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
Sep 08 2009
parent reply Ary Borenszweig <ary esperanto.org.ar> writes:
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
Sep 09 2009
parent Sam Hu <samhudotsamhu gmail.com> writes:
Ary Borenszweig Wrote:
 FQN = Fully Qualified Name
Got it.Thanks!
Sep 09 2009