How to run Notepad and Paste from clipboard to it

  • Follow


Hello All,

How to RUN Notepad from my app and paste the Clipboard content from
it?

I tried:

RUN NOTEPAD.EXE
KEYBOARD K_CTRL_V

But this doesn't work.

Thanks in advance.

With best regards.

Sudip
0
Reply Sudip 1/21/2010 9:35:42 AM

Dear Sudip,

How are you brother?

Write the clipboard content to a text file. and than RUN NOTEPAD.EXE 
FILENAME.TXT

Regards
Bapu.

"Sudip" <sudipb001@gmail.com> wrote in message 
news:c1eb8bad-0347-46ca-a8b2-3b147fa52b06@l30g2000yqb.googlegroups.com...
> Hello All,
>
> How to RUN Notepad from my app and paste the Clipboard content from
> it?
>
> I tried:
>
> RUN NOTEPAD.EXE
> KEYBOARD K_CTRL_V
>
> But this doesn't work.
>
> Thanks in advance.
>
> With best regards.
>
> Sudip 

0
Reply Bapu 1/21/2010 11:27:12 AM


On 21 jan, 07:35, Sudip <sudipb...@gmail.com> wrote:
> Hello All,
>
> How to RUN Notepad from my app and paste the Clipboard content from
> it?
>
> I tried:
>
> RUN NOTEPAD.EXE
> KEYBOARD K_CTRL_V
>
> But this doesn't work.
>
> Thanks in advance.
>
> With best regards.
>
> Sudip


Hi Sudip,
If you don=B4t have to use NOTEPAD, it will work with WinWord.
Take a look at \xharbour-1.2.1.src.tests\xharbour-1.2.1\tests
\testOle.prg.
This allow you to work with Word itself and anything that works in
Macro you can use within XHarbour !
If you are newbie to VBScript you should "play" a while with VBScript
code until you can translate it to XHarbour.

Good luck,
HU





0
Reply Hu 1/21/2010 11:40:02 AM

Sudip,

You should use Windows API, like SendMessge(), or SendInput(). Please search 
this NG as samples were posted in the past.

Ron

"Sudip" <sudipb001@gmail.com> wrote in message 
news:c1eb8bad-0347-46ca-a8b2-3b147fa52b06@l30g2000yqb.googlegroups.com...
> Hello All,
>
> How to RUN Notepad from my app and paste the Clipboard content from
> it?
>
> I tried:
>
> RUN NOTEPAD.EXE
> KEYBOARD K_CTRL_V
>
> But this doesn't work.
>
> Thanks in advance.
>
> With best regards.
>
> Sudip 

0
Reply Ron 1/21/2010 12:15:03 PM

Hello,

Thanks a lot to all of you for your help :-)

Bapu, I don't why your tip doesn't work for me with gtwvw app :-( (but
it works with sample gtwvw app). There must be some error in my app (I
guess) :-)

HU, I worked with Excel from xHarbour, but never worked with Word. It
will be a good choice for me :-)

Ron, I searched for SendMessage() and SendInput() in this group, but
couldn't find. I shall again search for Windows API :-)

For the time being I am giving my client a facility to copy the text
file (which will be browsed as Preview report using TBrowse) to
Clipboard and then s/he will be able to paste it into anything s/he
will like :-) (very primitive way, but it works for me)

Thank you again for your help.

With best regards.

Sudip

0
Reply Sudip 1/22/2010 6:36:16 AM

On Thu, 21 Jan 2010 01:35:42 -0800 (PST), Sudip <sudipb001@gmail.com> wrote:

Hello Sudip.

I'm also looking for something similar to have a better MemoEdit function. I like to have the possibility to edit a MEMO field with Notepad.
I'm using GTWVW to use some possibility from Windows, but didn't find a good solutions to replace or to extend the MemoEdit function.

Good luck and if you find a solution for your NOTEPAD problem, let me now!

Regards
Otto



>Hello All,
>
>How to RUN Notepad from my app and paste the Clipboard content from
>it?
>
>I tried:
>
>RUN NOTEPAD.EXE
>KEYBOARD K_CTRL_V
>
>But this doesn't work.
>
>Thanks in advance.
>
>With best regards.
>
>Sudip
0
Reply Otto 1/22/2010 7:21:26 AM

Hello Otto,

For preview purpose I am doing:

1) SET PRINTER TO a temporary file, whose name I got by using
HB_FTempCreate() function (4th parameter).
2) Now I close the printer.
3) I opened the temporary file with TBrowse() (FileBrws() function,
again created by Clipper Guru, Rick Spence and modified by myself). I
also added mouse features with this :-) There is also another object,
TEditor, which has more features than, MemoEdit, but I found opening
time for FileBrws() function is better (at least in my case) for large
reports. Now, choice is yours :-)
4) With FieBrws() F2 is used to Search forward, F3 for Search backward
and I added F4 to copy contents of the file to Clipboard.

I want to add another feature to copy the contents of a file to
Nopepad directly, so that my user (who are sometimes not very much
computer knowledgeable) to save it to .txt file directly. Now, from
HU's tip, I think it will be better for them to open in MS Word
directly (I am assuming they have Win Word installed in their
computer).

Please send your valuable comments about preview report solution.

Thanks in advance.

With best regards.

Sudip
0
Reply Sudip 1/22/2010 12:41:23 PM

Dear Sudip,

While googling for your query I found one sample for vb...

  [DllImport("user32.dll", EntryPoint = "FindWindowEx")]
    public static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr 
hwndChildAfter, string lpszClass, string lpszWindow);
    [DllImport("User32.dll")]
    public static extern int SendMessage(IntPtr hWnd, int uMsg, int wParam, 
string lParam);
    private void button1_Click(object sender, EventArgs e)
    {
        Process [] notepads=Process.GetProcessesByName("notepad");
        if(notepads.Length==0)return;
        if (notepads[0] != null)
        {
            IntPtr child= FindWindowEx(notepads[0].MainWindowHandle, new 
IntPtr(0), "Edit", null);
            SendMessage(child, 0x000C, 0, textBox1.Text);
        }
    }

WM_SETTEXT=0x000c

***************** From this website ***************
http://stackoverflow.com/questions/523405/how-to-send-text-to-notepad-in-c-win32
*******************

Now, Guru's of xharbour can translate it for xharbour..!!! :-)



"Sudip" <sudipb001@gmail.com> wrote in message 
news:c1eb8bad-0347-46ca-a8b2-3b147fa52b06@l30g2000yqb.googlegroups.com...
> Hello All,
>
> How to RUN Notepad from my app and paste the Clipboard content from
> it?
>
> I tried:
>
> RUN NOTEPAD.EXE
> KEYBOARD K_CTRL_V
>
> But this doesn't work.
>
> Thanks in advance.
>
> With best regards.
>
> Sudip 

0
Reply Bapu 1/22/2010 3:02:39 PM

Dear Sudip:

On Jan 21, 11:36=A0pm, Sudip <sudipb...@gmail.com> wrote:
....
> Ron, I searched for SendMessage() and SendInput()
> in this group, but couldn't find. I shall again search
> for Windows API :-)

I find 9 pertinent hits, using Advanced search in Google Groups:
http://groups.google.com/groups/search?safe=3Doff&q=3D%22sendmessage%22+gro=
up%3Acomp.lang.xharbour&btnG=3DSearch&sitesearch=3D

They should be in what32...

> For the time being I am giving my client a facility
> to copy the text file (which will be browsed as
> Preview report using TBrowse) to Clipboard and then
> s/he will be able to paste it into anything s/he
> will like :-) (very primitive way, but it works for me)

copyclip()

Driving Word or Excel (or any OLE capable program) is a good way.  But
leaving it on the clipboard is, in my opinion, superior... since the
user can move the contents to any (non-DOS) application.  Just need
the capability to refresh the clipboard, since it can get used by
other applications, and the user does not always go from step K (copy
from your application) to step L (paste into destintation) in one
motion.  Sometimes they check emails in between...

David A. Smith
0
Reply dlzc 1/22/2010 5:02:20 PM

Hello David,

I am completely agree with you. :) And thanks a lot for the tip :)

Now I am using hb_gtInfo( HB_GTI_CLIPBOARDDATA, cText) for copying cText to clipboard, but CopyClip() function will be a better choice. BTW, I found What32's ShellExecute() command can open Notepad (but I am not using Notepad for following reason ;) ).

Regarding copy to clip board, yes, it is more usable than using MS Excel, Word or Notepad directly. I am completely agree with you. :)

With best regards.

Sudip
0
Reply sudip (209) 1/23/2010 7:59:04 AM

Hello Friend Bapu,
Thanks a lot for your help. :)
With best regards.
Sudip
0
Reply sudip (209) 1/23/2010 8:08:53 AM

On 23 jan, 05:59, sudip <u...@compgroups.net/> wrote:
> Hello David,
>
> I am completely agree with you. :) And thanks a lot for the tip :)
>
> Now I am using hb_gtInfo( HB_GTI_CLIPBOARDDATA, cText) for copying cText to clipboard, but CopyClip() function will be a better choice. BTW, I found What32's ShellExecute() command can open Notepad (but I am not using Notepad for following reason ;) ).
>
> Regarding copy to clip board, yes, it is more usable than using MS Excel, Word or Notepad directly. I am completely agree with you. :)
>
> With best regards.
>
> Sudip
>
> ---
> frmsrcurl:http://compgroups.net/comp.lang.xharbour/How-to-run-Notepad-and-Paste...


Hi Sudip,

Is CopyClip() from XHarbour ?
When I Google all result refer to AutoCad !!??

Regards,
Hu





0
Reply Hu 1/26/2010 11:15:23 AM

Dear Hu:

On Jan 26, 4:15=A0am, Hu <h...@ig.com.br> wrote:
....
> Is CopyClip() from XHarbour ?
> When I Google all result refer to AutoCad !!??

Just use the online reference guide, and search for clipboard:
CloseClipboard() (winapi function reference guide)
EmptyClipboard() (winapi function reference guide)
GetClipBoardData() (winapi function reference guide)
GetOpenClipboardWindow() (winapi function reference guide)
IsclipBoardFormatAvailable() (winapi function reference guide)
OpenClipboard() (winapi function reference guide)
SetClipBoardData() (winapi function reference guide)

CopyClip could be Open + Empty + Set + Close

David A. Smith
0
Reply dlzc 1/26/2010 2:21:34 PM

On 26 jan, 12:21, dlzc <dl...@cox.net> wrote:
> Dear Hu:
>
> On Jan 26, 4:15=A0am, Hu <h...@ig.com.br> wrote:
> ...
>
> > Is CopyClip() from XHarbour ?
> > When I Google all result refer to AutoCad !!??
>
> Just use the online reference guide, and search for clipboard:
> CloseClipboard() (winapi function reference guide)
> EmptyClipboard() (winapi function reference guide)
> GetClipBoardData() (winapi function reference guide)
> GetOpenClipboardWindow() (winapi function reference guide)
> IsclipBoardFormatAvailable() (winapi function reference guide)
> OpenClipboard() (winapi function reference guide)
> SetClipBoardData() (winapi function reference guide)
>
> CopyClip could be Open + Empty + Set + Close
>
> David A. Smith

Thanks David !
You know XHarbour always fullfilled my needs so never have to worry
about WinAPI. Even knowing soon or later I have to !
Sorry but I still can=B4t find any reference to CopyClip() ! Could you
give more details ?

Best Regards,
Hu


0
Reply Hu 1/27/2010 10:46:03 AM

Dear Hu:

On Jan 27, 3:46=A0am, Hu <h...@ig.com.br> wrote:
> On 26 jan, 12:21, dlzc <dl...@cox.net> wrote:
> > On Jan 26, 4:15=A0am, Hu <h...@ig.com.br> wrote:
> > ...
>
> > > Is CopyClip() from XHarbour ?
> > > When I Google all result refer to AutoCad !!??
>
> > Just use the online reference guide, and search for clipboard:
> > CloseClipboard() (winapi function reference guide)
> > EmptyClipboard() (winapi function reference guide)
> > GetClipBoardData() (winapi function reference guide)
> > GetOpenClipboardWindow() (winapi function reference guide)
> > IsclipBoardFormatAvailable() (winapi function reference guide)
> > OpenClipboard() (winapi function reference guide)
> > SetClipBoardData() (winapi function reference guide)
>
> > CopyClip could be Open + Empty + Set + Close
>
> Thanks David !
> You know XHarbour always fullfilled my needs so
> never have to worry about WinAPI. Even knowing
> soon or later I have to !
> Sorry but I still can=B4t find any reference to
> CopyClip() ! Could you give more details ?

#include winuser.ch
function CopyClip
parameters cContents
local lSuccess :=3D .F.
   if valtype( cContents ) =3D "C"
      If OpenClipboard( ) <> 0
         if EmptyClipboard( ) <> 0
            lSuccess :=3D (SetClipBoardData( CF_TEXT, GlobalString
( cContents ) ) <> 0)
            endif
         CloseClipboard()
         endif
      endif
   return lSuccess

Might want to name the function "WriteClip" instead... So that you can
write its inverse "ReadClip".

David A. Smith
0
Reply dlzc 1/27/2010 5:39:59 PM

On 27 jan, 15:39, dlzc <dl...@cox.net> wrote:
> Dear Hu:
>
> On Jan 27, 3:46=A0am, Hu <h...@ig.com.br> wrote:
>
>
>
>
>
> > On 26 jan, 12:21, dlzc <dl...@cox.net> wrote:
> > > On Jan 26, 4:15=A0am, Hu <h...@ig.com.br> wrote:
> > > ...
>
> > > > Is CopyClip() from XHarbour ?
> > > > When I Google all result refer to AutoCad !!??
>
> > > Just use the online reference guide, and search for clipboard:
> > > CloseClipboard() (winapi function reference guide)
> > > EmptyClipboard() (winapi function reference guide)
> > > GetClipBoardData() (winapi function reference guide)
> > > GetOpenClipboardWindow() (winapi function reference guide)
> > > IsclipBoardFormatAvailable() (winapi function reference guide)
> > > OpenClipboard() (winapi function reference guide)
> > > SetClipBoardData() (winapi function reference guide)
>
> > > CopyClip could be Open + Empty + Set + Close
>
> > Thanks David !
> > You know XHarbour always fullfilled my needs so
> > never have to worry about WinAPI. Even knowing
> > soon or later I have to !
> > Sorry but I still can=B4t find any reference to
> > CopyClip() ! Could you give more details ?
>
> #include winuser.ch
> function CopyClip
> parameters cContents
> local lSuccess :=3D .F.
> =A0 =A0if valtype( cContents ) =3D "C"
> =A0 =A0 =A0 If OpenClipboard( ) <> 0
> =A0 =A0 =A0 =A0 =A0if EmptyClipboard( ) <> 0
> =A0 =A0 =A0 =A0 =A0 =A0 lSuccess :=3D (SetClipBoardData( CF_TEXT, GlobalS=
tring
> ( cContents ) ) <> 0)
> =A0 =A0 =A0 =A0 =A0 =A0 endif
> =A0 =A0 =A0 =A0 =A0CloseClipboard()
> =A0 =A0 =A0 =A0 =A0endif
> =A0 =A0 =A0 endif
> =A0 =A0return lSuccess
>
> Might want to name the function "WriteClip" instead... So that you can
> write its inverse "ReadClip".
>
> David A. Smith- Ocultar texto das mensagens anteriores -
>
> - Mostrar texto das mensagens anteriores -

Thanks a lot David !

Hu

0
Reply Hu 1/28/2010 9:28:25 AM

17 Replies
1204 Views

(page loaded in 0.181 seconds)

Similiar Articles:


















7/20/2012 8:10:56 PM


Reply: