Clipboard without a window

Clipboard without a window

Postby Massimo Linossi » Sat May 15, 2021 2: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: Select all  Expand view

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: Select all  Expand view

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
User avatar
Massimo Linossi
 
Posts: 498
Joined: Mon Oct 17, 2005 10:38 am
Location: Italy

Re: Clipboard without a window

Postby Antonio Linares » Sat May 15, 2021 3: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42076
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Clipboard without a window

Postby Massimo Linossi » Sat May 15, 2021 4: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
User avatar
Massimo Linossi
 
Posts: 498
Joined: Mon Oct 17, 2005 10:38 am
Location: Italy

Re: Clipboard without a window

Postby Massimo Linossi » Sat May 15, 2021 5: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
User avatar
Massimo Linossi
 
Posts: 498
Joined: Mon Oct 17, 2005 10:38 am
Location: Italy


Return to FiveWin for Harbour/xHarbour

Who is online

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