[VB6] WM_APP werkt niet...

Pagina: 1
Acties:

  • Markieman
  • Registratie: December 2001
  • Laatst online: 15-08 13:58
Omdat ik tussen applicaties prive messages will versturen mbv SendMessage wilde ik hiervoor WM_APP gebruiken. Volgens microsoft moet dat namelijk (zie msdn)

Nu heb ik in mijn VB applicatie door middel van SetWindowProc een message handler toegevoegd. Deze vangt keurig alle WM_PAINT, WM_MOUSEMOVE etc op. Echter wordt deze functie niet aangeroepen als ik een message met WM_APP verstuur...

Weet iemand hoe dit zit?

(ben ik een beetje duidelijk?)

TNX

[ Voor 1% gewijzigd door Markieman op 17-09-2003 20:30 . Reden: typo ]

You do not fear them? - The Wraith? Naah. Now *clowns*, that's another story.


  • MisterData
  • Registratie: September 2001
  • Laatst online: 20:35
In C++ gebruik ik daar geen WM_APP voor hoor, meestal gewoon WM_USER+1 ofzo als message... probeer dat eens anders?

  • Markieman
  • Registratie: December 2001
  • Laatst online: 15-08 13:58
Zou ik kunnen doen, maar ik heb liever WM_APP, aangezien WM_USER af geraden wordt:

quote:
"Older books on Windows programming tell about how to define user-defined messages using the symbol WM_USER. This technique is obsolete. There were too many problems with WM_USER-based symbols conflicting with messages that Microsoft was using. The new method is to use WM_APP as the base. If you have something that uses WM_USER, the usage is identical to the usage of messages based on WM_APP. "

You do not fear them? - The Wraith? Naah. Now *clowns*, that's another story.


  • MisterData
  • Registratie: September 2001
  • Laatst online: 20:35
Oh, weet ik dat ook weer...

  • .oisyn
  • Registratie: September 2000
  • Laatst online: 04:06

.oisyn

Moderator Devschuur®

Demotivational Speaker

Om preciezer te zijn:
Message numbers in the second range (WM_USER through 0x7FFF) can be defined and used by an application to send messages within a private window class. These values cannot be used to define messages that are meaningful throughout an application, because some predefined window classes already define values in this range. For example, predefined control classes such as BUTTON, EDIT, LISTBOX, and COMBOBOX may use these values. Messages in this range should not be sent to other applications unless the applications have been designed to exchange messages and to attach the same meaning to the message numbers.
bron

Give a man a game and he'll have fun for a day. Teach a man to make games and he'll never have fun again.


  • Markieman
  • Registratie: December 2001
  • Laatst online: 15-08 13:58
Klopt, maar dan weet ik nog niet waarom WM_APP niet werkt.

Enne, aangezien het om verschillende apps gaat lijkt dat met toch verstandiger (klopt ik ben misschien eigenwijs)

En deze zin staat me gewoon niet aan: "For example, predefined control classes such as BUTTON, EDIT, LISTBOX, and COMBOBOX may use these values."

You do not fear them? - The Wraith? Naah. Now *clowns*, that's another story.


Verwijderd

Om het geheel nog aan te vullen...

The RegisterWindowMessage function defines a new window message that is guaranteed to be unique throughout the system. The returned message value can be used when calling the SendMessage or PostMessage function.

...

The RegisterWindowMessage function is typically used to register messages for communicating between two cooperating applications.
If two different applications register the same message string, the applications return the same message value. The message remains registered until the Windows session ends.
Only use RegisterWindowMessage when more than one application must process the same message. For sending private messages within a window class, an application can use any integer in the range WM_USER through 0x7FFF. (Messages in this range are private to a window class, not to an application. For example, predefined control classes such as BUTTON, EDIT, LISTBOX, and COMBOBOX may use values in this range.)

  • .oisyn
  • Registratie: September 2000
  • Laatst online: 04:06

.oisyn

Moderator Devschuur®

Demotivational Speaker

Die SetWindowProc, wat is dat precies voor functie? Of bedoel je gewoon SetWindowLong, met als parameter GWL_WNDPROC?

Als het een VB functie is dan kan ik me voorstellen dat ie de echte window proc niet zet, maar gewoon jouw functie aanroept als ie zelf een bericht krijgt. En dan kan het idd goed zijn dat je functie niet wordt aangeroepen bij een WM_APP

Give a man a game and he'll have fun for a day. Teach a man to make games and he'll never have fun again.


  • Markieman
  • Registratie: December 2001
  • Laatst online: 15-08 13:58
Ja, je hebt gelijk het is SetWindowLong:

Call SetWindowLong(Me.hwnd, GWL_WNDPROC, AddressOf formMain_WndMessage)

Waarbij formMain_WndMessage een functie is in een module

Deze roept daarbinnen CallWindowProc aan om de standaard message handle aan te roepen....

RegisterWindowMessage is een probleem aangezien NSIS dit niet ondersteund. Deze moet namelijk ook een SendMessage WM_APP + x uitvoeren...

You do not fear them? - The Wraith? Naah. Now *clowns*, that's another story.


  • curry684
  • Registratie: Juni 2000
  • Laatst online: 13-08 16:46

curry684

left part of the evil twins

Verwijderd schreef op 17 September 2003 @ 21:04:
For sending private messages within a window class, an application can use any integer in the range WM_USER through 0x7FFF. (Messages in this range are private to a window class, not to an application. For example, predefined control classes such as BUTTON, EDIT, LISTBOX, and COMBOBOX may use values in this range.) [/i]
Een reguliere class oftewel een normaal window echter niet, en daar je zowel de verzendende als de ontvangende app schrijf kun je dus gewoon WM_USER gebruiken.

Tis alleen deprecated tussen controls en bij broadcasts e.d. Zolang je de ontvangende en zendende kant maar schrijft maakt het niet uit.

Professionele website nodig?


Verwijderd

Markieman schreef op 18 September 2003 @ 01:53:
RegisterWindowMessage is een probleem aangezien NSIS dit niet ondersteund. Deze moet namelijk ook een SendMessage WM_APP + x uitvoeren...
Je met m.b.v. de System plug-in voor NSIS (standaard meegeleverd) API calls uitvoeren.
Pagina: 1