Page 1 of 1

can i make a HB_FUNC() of it ?

PostPosted: Sat Feb 18, 2023 10:23 pm
by Jimmy
hi,

i´m still struggle with this CODE
Code: Select all  Expand view
BOOL PreventRemovalOfVolume(HANDLE hVolume,  BOOL fPreventRemoval)
{
   DWORD dwBytesReturned;
   PREVENT_MEDIA_REMOVAL PMRBuffer;
   PMRBuffer.PreventMediaRemoval = (BOOL) fPreventRemoval;
   return DeviceIoControl( hVolume, IOCTL_STORAGE_MEDIA_REMOVAL,
                           &PMRBuffer, sizeof(PREVENT_MEDIA_REMOVAL),
                           NULL, 0, &dwBytesReturned, NULL );
}

HB_FUNC.PRG(148): warning C4244: "=": Konvertierung von "BOOL" in "BOOLEAN", möglicher Datenverlust
HB_FUNC.PRG(156): warning C4431: Fehlender Typspezifizierer - int wird angenommen. Hinweis: "default-int" wird von C nicht mehr unterstützt.

now i "think" to use a HB_FUNC() instead
Code: Select all  Expand view
HB_FUNC( PROV ) //PreventRemovalOfVolume
{
   HANDLE hVolume = ( HWND ) hb_parnl( 1 ) ;
   BOOL fPreventRemoval = ( BOOL) hb_parl(2) ;
   ...
   hb_retl( DeviceIoControl( ..) ) ;
}

is something like that possible :?:

---

if Yes :
what Type is "HANDLE hVolume" -> HWND :?:
does it need to check for 64 Bit

Re: can i make a HB_FUNC() of it ?

PostPosted: Sun Feb 19, 2023 5:21 pm
by karinha

Re: can i make a HB_FUNC() of it ?

PostPosted: Mon Feb 20, 2023 1:02 am
by Jimmy
hi,

thx for Answer

i do have working Version under Xbase++ and HMG using DLL Call
but as i had Problem under Fivewin i have to use HB_FUNC()

my CODE look like Github Sample but that are not HB_FUNC() which i like to have

---

my Question is if i can change those "internal" API Function to single HB_FUNC()
Code: Select all  Expand view
BOOL PreventRemovalOfVolume(HANDLE hVolume, BOOL fPreventRemoval)

goes to
Code: Select all  Expand view
HB_FUNC(PreventRemovalOfVolume)
   HANDLE hVolume = (HWND) hb_parnl(1) ;
   BOOL fPreventRemoval = (BOOL) hb_parl(2) ;
...
hb_retl( DeviceIoControl( ... ) ) ;