can i make a HB_FUNC() of it ?

can i make a HB_FUNC() of it ?

Postby Jimmy » Sat Feb 18, 2023 10:23 pm

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
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

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

Postby karinha » Sun Feb 19, 2023 5:21 pm

João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7826
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

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

Postby Jimmy » Mon Feb 20, 2023 1:02 am

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( ... ) ) ;
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 96 guests