Recent

Author Topic: OnMyEvent  (Read 9822 times)

Pascaluvr

  • Full Member
  • ***
  • Posts: 216
OnMyEvent
« on: May 27, 2007, 10:15:20 am »
I asked about this in one of the other forum categories, but since I didn'tget a reply, I assume it doesn't exist and therefore a possible enhancement.

Many DLLs (including those of M$) uses the message queue to communicate to a program.  Unfortunately Events specified on a Form are only the commonly used ones.

I would like a way to access other messages sent by windows or DLLs.

I don't know anything about other OS's, but in Windows an Event like 'OnClick' or 'OnCreate' can be defined on the basis of a couple of parameters - so it should be possible to define different ..user...events based on values provided
Windows 7, Lazarus 1.0.8, FPC 2.6.2, SQLite 3

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2680
RE: OnMyEvent
« Reply #1 on: May 29, 2007, 12:19:16 pm »
for windows yes, other widgetsets don't work with messages, but with callbacks. So you cannot define simply some handlers cross platform
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

Pascaluvr

  • Full Member
  • ***
  • Posts: 216
RE: OnMyEvent
« Reply #2 on: May 30, 2007, 12:22:48 pm »
So does that mean that because its not cross-platform I am denied access to these msgs in windows, thus making lazarus useless in these circumstances?
Windows 7, Lazarus 1.0.8, FPC 2.6.2, SQLite 3

Vincent Snijders

  • Administrator
  • Hero Member
  • *
  • Posts: 2661
    • My Lazarus wiki user page
RE: OnMyEvent
« Reply #3 on: May 30, 2007, 12:30:31 pm »
No, you can use the windows unit and do whatever you want.

Pascaluvr

  • Full Member
  • ***
  • Posts: 216
RE: OnMyEvent
« Reply #4 on: May 30, 2007, 01:21:06 pm »
This is getting very frustrating.

I have asked a question how to do something and the answer is (eventually) - use the windows unit!

Sheeezzz ...  point me to some documentation that explains how to access the windows message loop.

See, the problem is that lazarus hides all this stuff to be platform independant.  I can understand that, but if I am writing a program for windows - how the hell do i access it.
Windows 7, Lazarus 1.0.8, FPC 2.6.2, SQLite 3

theo

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1945
RE: OnMyEvent
« Reply #5 on: May 30, 2007, 02:15:34 pm »

Pascaluvr

  • Full Member
  • ***
  • Posts: 216
OnMyEvent
« Reply #6 on: May 30, 2007, 09:18:07 pm »
WOW - there is a lot of patience here for newbies!!!!  I love the helpful explanations! :evil:

I know how to access the message loop in FPC.  However, the message loop must already be accessed in lazarus to process the standard events.

Even if I knew how to overide the lazarus code to take back the control it would then take away its processing of all the good things it does for me.

All I need to know is how to access the messages that lazarus doesn't process.  Is it possible to do this without having to make changes to lazarus itself?
Windows 7, Lazarus 1.0.8, FPC 2.6.2, SQLite 3

Vincent Snijders

  • Administrator
  • Hero Member
  • *
  • Posts: 2661
    • My Lazarus wiki user page
OnMyEvent
« Reply #7 on: May 30, 2007, 09:33:32 pm »
To be honest, these are not the things a newbie should try to do.

Anyway if you want to go that route, I can give you some suggestions, untested, maybe even wrong, maybe unhelpful. You may be better off not reading any further ...

That said, you can hook the window proc of an win32 window with setwindowlong (look at the msdn for its usage). Make sure you retrieve that the original value too and use that to call the original windowproc somewhere in your replacement.

Pascaluvr

  • Full Member
  • ***
  • Posts: 216
OnMyEvent
« Reply #8 on: May 30, 2007, 09:57:42 pm »
Thank you Vincent, from a quick look that appears to be exactly what I need.
Windows 7, Lazarus 1.0.8, FPC 2.6.2, SQLite 3

Pascaluvr

  • Full Member
  • ***
  • Posts: 216
OnMyEvent
« Reply #9 on: June 01, 2007, 06:20:29 am »
Thanks again Vincent for pointing me in the right direction.  Its working perfectly.

To Theo:  Sarcasm is the lowest form of wit.
Windows 7, Lazarus 1.0.8, FPC 2.6.2, SQLite 3

theo

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1945
OnMyEvent
« Reply #10 on: June 01, 2007, 12:20:19 pm »
Why are you so aggressive Pascaluvr?
MSDN is a good source of information if you want to code winapi-stuff.

Pascaluvr

  • Full Member
  • ***
  • Posts: 216
OnMyEvent
« Reply #11 on: June 01, 2007, 08:50:37 pm »
Its an excellent source if you know what you are looking for.  But its not much help if yuo don't know where to start.  It doesn't matter how much experience you have with win api's you will never know them all.  So attempting to find an API that does something you need is like looking for a needle in a haystack.  Until Vincent pointed me in the right direction I didn't even know if the solution would be there - I thought the solution would be somewhere within Lazarus.

BTW.  Does Lazarus have a snippet library?  I am sure other windows programmers would find my code useful - or is platform specific solutions frowned on here?
Windows 7, Lazarus 1.0.8, FPC 2.6.2, SQLite 3

 

TinyPortal © 2005-2018