Drop files from Explorer to HMG Control

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

User avatar
AUGE_OHR
Posts: 2061
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Drop files from Explorer to HMG Control

Post by AUGE_OHR »

hi,

i have made a Sample to Drop Files from Explorer to HMG Control.
HB_FUNC are from MiniGUI but work under HMG
Drop2HMG.jpg
Drop2HMG.jpg (19.31 KiB) Viewed 43494 times
i use CREATE EVENT PROCNAME to get WM_DROPFILES Message.

Code: Select all

 CASE nMsg == WM_DROPFILES
Sample is just 1st Step and give you a Array with List of files which have "drop"
i have reduce Code to 32 Bit Version and to figure out how it "should work"
Dropfile01.zip
(1.26 MiB) Downloaded 344 times
have fun
Jimmy
User avatar
fouednoomen
Posts: 188
Joined: Sun Oct 14, 2012 8:33 am
DBs Used: DBF, MySQL, MariaDB, SQLite, PostgreSQL, Oracle, ODBC
Location: Tunisia

Re: Drop files from Explorer to HMG Control

Post by fouednoomen »

Many thanks
User avatar
mol
Posts: 3720
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: Drop files from Explorer to HMG Control

Post by mol »

Hi Jimmy!
Maybe no one had the courage to tell you - this forum was created to share our solutions in source code.
We help one to another not by .exe files - by concrete knowledge.
User avatar
AUGE_OHR
Posts: 2061
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: Drop files from Explorer to HMG Control

Post by AUGE_OHR »

hi,
mol wrote: Sun Mar 22, 2020 3:33 pm Maybe no one had the courage to tell you - this forum was created to share our solutions in source code.
We help one to another not by .exe files - by concrete knowledge.
i do have upload lot of "ready" Source Code but this was just the 1s Step of Sample.
so please give me time to finish it before i upload some Code.
have fun
Jimmy
User avatar
AUGE_OHR
Posts: 2061
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: Drop files from Explorer to HMG Control

Post by AUGE_OHR »

to drag from Explorer to a Control need 3 Steps

1.) DragAcceptFiles function
https://docs.microsoft.com/en-us/window ... ceptfiles
2.) DragQueryFileA function
https://docs.microsoft.com/en-us/window ... queryfilea
3.) DragFinish function
https://docs.microsoft.com/en-us/window ... dragfinish

and when moving

4.) DragQueryPoint function
https://docs.microsoft.com/en-us/window ... querypoint


---

in Harbour MiniGUI 1.4 Extended (Build 47) added by Grigory Filatov
you will find Source in c:\MiniGUI\SOURCE\c_winapimisc.c

the Source i saw was c:\MiniGUI\SAMPLES\Applications\RunCmd\RunCmd.prg

---

how it work :

1.) you need a Handle for DragAcceptFiles
this Sample is for Form

Code: Select all

   DragAcceptFiles( GetFormHandle('Form_1'), .T. )
to get Handle of Control is

Code: Select all

   hWnd := GetControlHandle( cObj, cForm )
2.) you need to get into Windows Message loop
this normal is handle by HMG in c:\hmg.3.4.4\SOURCE\h_windows.prg.

i have used modify Code from USB_Detect Sample

Code: Select all

CREATE EVENT PROCNAME Drop_Detect() HWND DropDemo.HANDLE STOREINDEX nIndex
MiniGUI Sample use

Code: Select all

SET EVENTS FUNCTION TO MYEVENTS
3.) get WM_DROPFILES Message

Code: Select all

FUNCTION Drop_Detect()
LOCAL nHWnd   := EventHWND()
LOCAL nMsg    := EventMSG()
LOCAL nWParam := EventWPARAM()
LOCAL nLParam := EventLPARAM()

   CASE nMsg == WM_DROPFILES
      aFiles := DragQueryFileS( nWParam )

MiniGUI have

Code: Select all

Function MyEvents ( hWnd, nMsg, wParam, lParam )

   case nMsg == WM_DROPFILES
      cCmd := DragQueryFile( wParam )
---

"My Problem"
when using CREATE EVENT PROCNAME Drop_Detect() Syntax it only work with Form.Handle NOT with Control.Handle
so i have to try MiniGUI Style with HMG ... this need some more time to figure out how it work.

---

when search for "Drop" i found these HMG Files

Code: Select all

C:\hmg.3.4.4\SOURCE\c_browse.c
C:\hmg.3.4.4\SOURCE\c_dialogs.c
C:\hmg.3.4.4\SOURCE\c_InitCom.c
C:\hmg.3.4.4\SOURCE\c_listbox.c
C:\hmg.3.4.4\SOURCE\c_windows.c
C:\hmg.3.4.4\SOURCE\h_dialogs.prg
C:\hmg.3.4.4\SOURCE\h_init.prg
C:\hmg.3.4.4\SOURCE\h_listbox.prg
C:\hmg.3.4.4\SOURCE\h_windows.prg
there seems to be a DragDrop Sample for ListBox but it seems me "internal" not from "outside"
btw. it is NOT Ole-DragDrop :!:
DragQueryFile() will only give you a File-list with Name

Demo Code work but i have to find out how Demo Code work in hole HMG App or if Problem ...
so let me some Time to make it "safe" before i release Source Code

---
MiniGUI Sample use

Code: Select all

SET EVENTS FUNCTION TO MYEVENTS
i have try MiniGUI Syntax with HMG and got
C:\hmg.3.4.4\0\DragAccept\dropfile.PRG(84) Error E0030 Syntax error "syntax error at 'EVENTS'"

in c:\MiniGUI\Include\i_controlmisc.ch

Code: Select all

#command SET EVENTS FUNCTION TO <fname> [ RESULT TO <lSuccess> ] ;
=> ;
[ <lSuccess> := ] SetGlobalListener( <"fname"> )
so it is not "easy" to implement it to HMG ...
have fun
Jimmy
User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: Drop files from Explorer to HMG Control

Post by andyglezl »

Hi Jimmy

You can see this from EDK...

https://www.hmgforum.com/viewtopic.php? ... fix#p57451
Andrés González López
Desde Guadalajara, Jalisco. México.
User avatar
AUGE_OHR
Posts: 2061
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: Drop files from Explorer to HMG Control

Post by AUGE_OHR »

hi,
andyglezl wrote: Mon Mar 23, 2020 2:03 am You can see this from EDK...
https://www.hmgforum.com/viewtopic.php? ... fix#p57451
thx for Tip, GREAT Sample
but it use DragDrop "inside" App while i try to get DragDrop from "outside".

most i use DragDrop for new Media-Files to drop them into Playlist.
it is a single Control in a Window so it is easy to find Control where i drop.
the Demo Sample just do that ...
! Note : this DragDrop Style only have a File-List of Media-Files NOT Media itself

but i think about next Step when have many Controls in a Window ...
under HMG i´m not able to restrict it on Control i want ( Xbase++ -> o:DropZone := .T. )

here Source Code i use
DROPFILE_Source.ZIP
(6.55 KiB) Downloaded 316 times
have fun
Jimmy
User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: Drop files from Explorer to HMG Control

Post by andyglezl »

Que hace la diferencia / ventaja al utilizar Drag&Drop en vez de
GetFile ( { {"Archivos RTF", "*.rtf"} }, NIL, GetCurrentFolder() ) :?: :roll:
*-----------------------------------------------------------------------------------------------------------------------------------------------------------------
What makes the difference / advantage when using Drag & Drop instead of
GetFile ({{"RTF Files", "* .rtf"}}, NIL, GetCurrentFolder ()) :?: :roll:
Andrés González López
Desde Guadalajara, Jalisco. México.
chrisjx2002
Posts: 190
Joined: Wed Jan 06, 2010 5:39 pm

Re: Drop files from Explorer to HMG Control

Post by chrisjx2002 »

Great job!
User avatar
fouednoomen
Posts: 188
Joined: Sun Oct 14, 2012 8:33 am
DBs Used: DBF, MySQL, MariaDB, SQLite, PostgreSQL, Oracle, ODBC
Location: Tunisia

Re: Drop files from Explorer to HMG Control

Post by fouednoomen »

Great job!
Post Reply