Page 1 of 1
AChoice GUI ... how ?
Posted: Thu Feb 06, 2020 4:52 am
by AUGE_OHR
hi,
the benefit of AChoice are 6th Parameter alCanSelect
under Xbase++ i have made a own CLASS FROM and use Ownerdraw for disable Item and hilight possible Device.
- AChoice.jpg (31.32 KiB) Viewed 2746 times
now i think about a harbour / HMG Solution but it have no Owerdraw so i search for other Solution.
the Problem is how to make a Row "unselect-able"
ok i can check it at ON ENTER but i don´t want that User "canselect" e.g. "C:" to eject Device.
"not show" those Device is not a Option ...
so which Control to use ... GRID
i think ON CHANGE is the point to start and than ...
Re: AChoice GUI ... how ?
Posted: Thu Feb 06, 2020 5:39 pm
by franco
Jimmy. I think for what you are asking,
I use a browse for scanning and a grid for working in.
I remember on one of your posts you said a grid and browse where the same, they are not.
They use the same functions but react different. Browse is much faster for scanning large tables or arrays.
Re: AChoice GUI ... how ?
Posted: Fri Feb 07, 2020 2:47 am
by AUGE_OHR
franco wrote: ↑Thu Feb 06, 2020 5:39 pm
I remember on one of your posts you said a grid and browse where the same, they are not.
They use the same functions but react different. Browse is much faster for scanning large tables or arrays.
have a look into
Code: Select all
C:\hmg.3.4.4\SOURCE\c_browse.c
C:\hmg.3.4.4\SOURCE\c_grid.c
and search for Constant WC_LISTVIEW ( ClassName "SysListView32" )
the "Engine" is the same but it act in different Way.
the fastest Way is IMHO to use VIRTUAL where you "just" tell Window to "reserve Memory" with
Code: Select all
ITEMS aArray // must be PRIVATE or PUBLIC if change
ITEMCOUNT LEN( aArray )
---
i got a Solution which can be used
Code: Select all
STATIC PROCEDURE DoAction()
LOCAL nRow := This.CellRowIndex
LOCAL nType := VAL( Win_1.Grid_Device.CellEx( This.CellRowIndex, 2 ) )
LOCAL cDrive := aDrives[ nRow ] [ 2 ]
IF nType = DRIVE_REMOVABLE .OR. nType = DRIVE_CDROM
EjectMedia( cDrive, .T. )
ENDIF
RETURN
that is not exact what i want but it work right so it is ok.
- hb_Eject.jpg (56.6 KiB) Viewed 2665 times
but i can`t release that Tool without "safe-remove"
i still have Problem to include PREVENT_MEDIA_REMOVA Structure
https://docs.microsoft.com/de-de/window ... ia_removal
Re: AChoice GUI ... how ?
Posted: Fri Feb 07, 2020 6:19 am
by AUGE_OHR
hi
i found this
https://autohotkey.com/board/topic/2862 ... sh-drive/
; Enables or disables the mechanism that ejects media, for those devices possessing that locking capability.
; Drivers keep track of the lock count, and thereby allow ANY caller to unlock a drive (not just the one that locked it). See more at
http://msdn.microsoft.com/en-us/library/ms803649.aspx
Code: Select all
PreventRemovalOfVolume(hVolume, fPreventRemoval)
{
; struct PREVENT_MEDIA_REMOVAL is just a single bool
PMRBuffer := chr(fPreventRemoval ? 1 : 0)
return DeviceIoControl(hVolume, IOCTL_STORAGE_MEDIA_REMOVAL := 0x2D4804, PMRBuffer, 1)
}
this sample dow not use PREVENT_MEDIA_REMOVAL Structure as "is just a single bool"
as bool can be 0 or 1 -> CHR(0) or CHR(1)
it seems to work
but i have to make some more test
Re: AChoice GUI ... how ?
Posted: Fri Feb 07, 2020 1:37 pm
by danielmaximiliano
Re: AChoice GUI ... how ?
Posted: Fri Feb 07, 2020 9:42 pm
by AUGE_OHR
hi,
this Article describe how Cache is working but it does not help when "eject" USB Stick "while copy".
USB 3x is very fast so Microsoft have change Way and disable Cache but you still can enable it.
User can "un-plug" USB-Device while copy ... there is no Way to react on it
but if you have a Software to "eject" it must check if you can do it "now" or try it later
here is my 1st harbour / HMG Version
Re: AChoice GUI ... how ?
Posted: Sat Feb 08, 2020 10:10 pm
by AUGE_OHR
hi,
here is a Sample what i mean
- Prevent_Eject.jpg (56.18 KiB) Viewed 2519 times
i copy a large file to (slow) USB-Stick.
while copy file i try to "eject" USB-Stick with App and that must "react" and refuse it
my workaround for PREVENT_MEDIA_REMOVAL seem to work ... but it seem "to stay in Memory" ...
i have to re-start App to "reset" my workaround for next try ...
so i still have to ask how to work with Windows Structure under harbour / HMG.
this Tool make no sence if it don`t work 100% correct
Re: AChoice GUI ... how ?
Posted: Sun Feb 09, 2020 5:11 am
by AUGE_OHR
hi
i think i made big success with Thread and PUBLIC Variable
Code: Select all
STATIC caItems := {} // for GRID
STATIC acImage := {} // for GRID
STATIC aDrives
now i use Field-wide STATIC instead of PUBLIC and i get close to what i want.
attach Sample where you can see that it work even if Form have "no focus" (Tasktray
)
it need some time to detect DBT_DEVICEARRIVAL but it does immediately react on DBT_DEVICEREMOVECOMPLETE
Re: AChoice GUI ... how ?
Posted: Sun Feb 09, 2020 9:33 am
by bpd2000
Hi
Eject test om win-7 Ok