FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Clipboard without a window
Posts: 512
Joined: Mon Oct 17, 2005 10:38 AM
Clipboard without a window
Posted: Sat May 15, 2021 02:33 PM
Hi to all.
I'm trying to call a prg already working into a small exe that will be called from modharbour.
This prg reads a lot of informations in several tables and the write this strings inside an excel file, using the clipboard for pasting the datas.
The problem is that if I don't have a window or a dialog I cannot use the tclipboard class because it gives error saying this :

Code (fw): Select all Collapse
Application
===========
   Path and name: C:\fw\excel_export.exe (32 bits)
   Size:   1.755.648 bytes
   Time from start: 0 hours 0 mins 0 secs 
   Error occurred at: 15/05/2021, 15:15:48
   Error description: Error BASE/1004  Class: 'NIL' has no exported method: HWND
   Args:
     [   1] = U   

Stack Calls
===========
   Called from:  => HWND(0)
   Called from: CLIPBRD.PRG => (b)TCLIPBOARD:TCLIPBOARD(0)
   Called from:  => TCLIPBOARD:OPEN(0)
   Called from: MAIN.PRG => MAIN(133)


and this are few lines with the code that doesn't work.

Code (fw): Select all Collapse
oClip := TClipBoard():New()
oClip:Clear()
oClip:SetText( cText )
oExcel:SetPos('A'+ALLTRIM(STR(F)) )
oExcel:Paste()
oClip:End()


Is there a possibility to make this ?
Thanks a lot.
Massimo
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Clipboard without a window
Posted: Sat May 15, 2021 03:42 PM

Massimo,

Please check that you have this code in Class TClipboard

METHOD Open() INLINE OpenClipboard( If( ::oWnd == nil, GetDeskTopWindow(), ::oWnd:hWnd ) )

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 512
Joined: Mon Oct 17, 2005 10:38 AM
Re: Clipboard without a window
Posted: Sat May 15, 2021 04:28 PM

Hi Antonio,
no, in my TClipboard Class I have this code :

METHOD Open() INLINE OpenClipboard( ::oWnd:hWnd )

Now I make the change and rebuild the exe again.
I'll be back to give you the new result.
Thanks a lot.
Massimo

Posts: 512
Joined: Mon Oct 17, 2005 10:38 AM
Re: Clipboard without a window
Posted: Sat May 15, 2021 05:00 PM

Here I am Antonio.
That was the problem and with your hint is resolved. The program now works like a Concorde.
Thank you very very very much.
Massimo

Continue the discussion