From: Jack Unrue on
On 21 Sep 2006 10:35:55 -0700, "remixer" <remixer1(a)gmail.com> wrote:
>
> dustmop(a)gmail.com wrote:
> >
> > If your Lisp has a good FFI, you can just load the user32.dll et al and
> > call the Windows API directly. I've done this before with ECL and it
> > wasn't too bad (using macros to cover over the rough edges helped a
> > lot). Here's a reference to getting start with the clipboard functions.
> > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wceui40/html/cerefopenclipboard.asp
>
> Thanks a lot. This is exactly what I want in the first version -- just
> grab all clipboards. Can you elaborate on "load the user32.dll et al
> and call the Windows API directly"? Are there any example code
> fragments for doing this available? Also, which Lisps beside ECL can do
> this?

Each FFI has its own specific details, but all the Lisps you will
care about have a mechanism that associates a foreign function (which
is the term for a Lisp FFI binding to an external non-Lisp function;
you may also see the term 'alien function') with the library
providing that function; hence the library will be loaded.

If you're not already tied to ECL, you might consider experimenting
with CLISP, since it has a win32 bindings module that happens to include
the clipboard functions. If you're not interested in CLISP, I suggest
that you at least consider writing your FFI code using CFFI
(http://common-lisp.net/project/cffi).

Also, a terminology note: from your point of view, there is only one
clipboard. Clipboard access is restricted to one window at a time,
hence the HWND argument to OpenClipboard. It may have data in zero
or more formats.

> > As for interacting with Word or Email, you'll probably have to stick to
> > COM, which is much harder to do without C++ due to the requirement of
> > precise binary contracts. In general, if you don't have much experience
> > working with Win32 I'd recommend trying it in C++ before Lisp. Not that
> > Lisp is lacking here, but trying to learn FFI and Win32 at the same
> > time would probably make any mortal want to tear their own face off.
>
> Yeah maybe I will steer clear of this until I get the basic
> infrastructure in place.

I have some reservations about the scope of what you are trying
to do (consider, for instance, that you will need to register
hook functions in order to process mouse clicks within other
application windows), but I think it's always good to experiment
with ideas :-)

> > Asking a Microsoft specific group for help might also help when the
> > going gets tough. Here's a good one, for example:
> > http://groups.google.com/group/comp.os.ms-windows.programmer.win32

Seconded.

--
Jack Unrue
From: Ken Tilton on


remixer wrote:
> dustmop(a)gmail.com wrote:
>
>>remixer wrote:
>>
>>>Asbj?rn Bj?rnstad wrote:
>>>
>>>>remixer wrote:
>>>>
>>>>
>>>>>Are there parts of this application that will be very hard or
>>>>>impossible to do in Lisp? The other choice will be to build
>>>>>application-specific tools like a Firefox extension, or use .NET. I
>>>>>would rather use Lisp, but recommendations about stuff that I could
>>>>>reuse and things to know before I get started on this will be great.
>>>>
>>>>Maybe RDNZL is what you need? It's a ibrary for common lisp
>>>>interaction with .NET
>>>>
>>>>http://weitz.de/rdnzl/
>>>
>>>Thanks. I looked at RDNZL and was also thinking about using Corman Lisp
>>>for its Windows support. I was wondering if anyone had more experience
>>>building anything like this which possibly interacts with different
>>>applications like Word, Email client, etc. Or if there are any examples
>>>along those lines.
>>>
>>>
>>>>--
>>>> -asbjxrn
>>
>>If your Lisp has a good FFI, you can just load the user32.dll et al and
>>call the Windows API directly. I've done this before with ECL and it
>>wasn't too bad (using macros to cover over the rough edges helped a
>>lot). Here's a reference to getting start with the clipboard functions.
>>http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wceui40/html/cerefopenclipboard.asp
>
>
>
> Thanks a lot. This is exactly what I want in the first version -- just
> grab all clipboards. Can you elaborate on "load the user32.dll et al
> and call the Windows API directly"? Are there any example code
> fragments for doing this available?

Since you are considering Corman CL, the good news is that it has a
crapload of examples and predefined bindings to the win32 API.

> Also, which Lisps beside ECL can do
> this?

Check it out: http://common-lisp.net/project/cffi/

But CormanCL has loads of stuff built-in, and one of its users has a web
page leading to loads more.

kt

--
Cells: http://common-lisp.net/project/cells/

"I'll say I'm losing my grip, and it feels terrific."
-- Smiling husband to scowling wife, New Yorker cartoon
From: Jack Unrue on
I wrote:
>
> Also, a terminology note: from your point of view, there is only one
> clipboard. Clipboard access is restricted to one window at a time,
> hence the HWND argument to OpenClipboard. It may have data in zero
> or more formats.

You might also try implementing a clipboard viewer:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/dataexchange/clipboard/abouttheclipboard.asp

and see how that fits into your plans.

--
Jack Unrue
From: remixer on

Ken Tilton wrote:
> remixer wrote:
> > dustmop(a)gmail.com wrote:
> >
> >>remixer wrote:
> >>
> >>>Asbjørn Bjørnstad wrote:
> >>>
> >>>>remixer wrote:
> >>>>
> >>>>
> >>>>>Are there parts of this application that will be very hard or
> >>>>>impossible to do in Lisp? The other choice will be to build
> >>>>>application-specific tools like a Firefox extension, or use .NET. I
> >>>>>would rather use Lisp, but recommendations about stuff that I could
> >>>>>reuse and things to know before I get started on this will be great.
> >>>>
> >>>>Maybe RDNZL is what you need? It's a ibrary for common lisp
> >>>>interaction with .NET
> >>>>
> >>>>http://weitz.de/rdnzl/
> >>>
> >>>Thanks. I looked at RDNZL and was also thinking about using Corman Lisp
> >>>for its Windows support. I was wondering if anyone had more experience
> >>>building anything like this which possibly interacts with different
> >>>applications like Word, Email client, etc. Or if there are any examples
> >>>along those lines.
> >>>
> >>>
> >>>>--
> >>>> -asbjxrn
> >>
> >>If your Lisp has a good FFI, you can just load the user32.dll et al and
> >>call the Windows API directly. I've done this before with ECL and it
> >>wasn't too bad (using macros to cover over the rough edges helped a
> >>lot). Here's a reference to getting start with the clipboard functions.
> >>http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wceui40/html/cerefopenclipboard.asp
> >
> >
> >
> > Thanks a lot. This is exactly what I want in the first version -- just
> > grab all clipboards. Can you elaborate on "load the user32.dll et al
> > and call the Windows API directly"? Are there any example code
> > fragments for doing this available?
>
> Since you are considering Corman CL, the good news is that it has a
> crapload of examples and predefined bindings to the win32 API.
>
> > Also, which Lisps beside ECL can do
> > this?
>
> Check it out: http://common-lisp.net/project/cffi/
>
> But CormanCL has loads of stuff built-in, and one of its users has a web
> page leading to loads more.

Thanks. I think I will go with Corman -- can you provide me the link to
this website you mentioned here?

> kt
>
> --
> Cells: http://common-lisp.net/project/cells/
>
> "I'll say I'm losing my grip, and it feels terrific."
> -- Smiling husband to scowling wife, New Yorker cartoon

From: Ken Tilton on


remixer wrote:
> Ken Tilton wrote:
>
>>remixer wrote:
>>
>>>dustmop(a)gmail.com wrote:
>>>
>>>
>>>>remixer wrote:
>>>>
>>>>
>>>>>Asbj?rn Bj?rnstad wrote:
>>>>>
>>>>>
>>>>>>remixer wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>>Are there parts of this application that will be very hard or
>>>>>>>impossible to do in Lisp? The other choice will be to build
>>>>>>>application-specific tools like a Firefox extension, or use .NET. I
>>>>>>>would rather use Lisp, but recommendations about stuff that I could
>>>>>>>reuse and things to know before I get started on this will be great.
>>>>>>
>>>>>>Maybe RDNZL is what you need? It's a ibrary for common lisp
>>>>>>interaction with .NET
>>>>>>
>>>>>>http://weitz.de/rdnzl/
>>>>>
>>>>>Thanks. I looked at RDNZL and was also thinking about using Corman Lisp
>>>>>for its Windows support. I was wondering if anyone had more experience
>>>>>building anything like this which possibly interacts with different
>>>>>applications like Word, Email client, etc. Or if there are any examples
>>>>>along those lines.
>>>>>
>>>>>
>>>>>
>>>>>>--
>>>>>>-asbjxrn
>>>>
>>>>If your Lisp has a good FFI, you can just load the user32.dll et al and
>>>>call the Windows API directly. I've done this before with ECL and it
>>>>wasn't too bad (using macros to cover over the rough edges helped a
>>>>lot). Here's a reference to getting start with the clipboard functions.
>>>>http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wceui40/html/cerefopenclipboard.asp
>>>
>>>
>>>
>>>Thanks a lot. This is exactly what I want in the first version -- just
>>>grab all clipboards. Can you elaborate on "load the user32.dll et al
>>>and call the Windows API directly"? Are there any example code
>>>fragments for doing this available?
>>
>>Since you are considering Corman CL, the good news is that it has a
>>crapload of examples and predefined bindings to the win32 API.
>>
>>
>>>Also, which Lisps beside ECL can do
>>>this?
>>
>>Check it out: http://common-lisp.net/project/cffi/
>>
>>But CormanCL has loads of stuff built-in, and one of its users has a web
>>page leading to loads more.
>
>
> Thanks. I think I will go with Corman -- can you provide me the link to
> this website you mentioned here?

Sorry, I should have mentioned that is featured prominently on the
Corman site: http://www.double.co.nz/cl/index.htm

kt

ps. the win32 trial lisps also come with win32 bindings and great FFIs,
tho I would recommend CFFI for portability. Last I heard Corman had
issues with CFFI. If you know C, mastering FFI should be easy. That in
turn opens up scads of libraries, obviating the only rap on CL.

k

--
Cells: http://common-lisp.net/project/cells/

"I'll say I'm losing my grip, and it feels terrific."
-- Smiling husband to scowling wife, New Yorker cartoon
First  |  Prev  |  Next  |  Last
Pages: 1 2 3
Prev: Lis(t|p) comprehensions
Next: Pocket Lisp Machine