Register | Login
Views: 19364387
Main | Memberlist | Active users | ACS | Commons | Calendar | Online users
Ranks | FAQ | Color Chart | Photo album | IRC Chat
11-02-05 12:59 PM
0 user currently in Programming. | 3 guests
Acmlm's Board - I2 Archive - Programming - VB - Subclassing weirdness | |
Add to favorites | "RSS" Feed | Next newer thread | Next older thread
User Post
HyperLamer
<||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people

Sesshomaru
Tamaranian

Level: 118

Posts: 461/8210
EXP: 18171887
For next: 211027

Since: 03-15-04
From: Canada, w00t!
LOL FAD

Since last post: 2 hours
Last activity: 2 hours
Posted on 04-22-04 02:59 AM Link | Quote
Something ain't right here. I added a hidden window to my app with a fixed title to allow other processes to find it with FindWindow(). I've subclassed the window as such:
ProcOld = SetWindowLong(Me.hWnd, GWL_WNDPROC, AddressOf WindowProc)
So this should have the WindowProc() function in my program (which is in a module, not the window's code) run whenever the window recieves a message. The function is designed to respond to message ID 0xBEEF and return version info, variables, etc. I also have another program send such a message with wParam and lParam=0. The message is recieved alright, but the source hWnd is my own message window and lParam is some random garbage (it's not the source hWnd, I checked).
Here's the function BTW:


Public Function WindowProc(ByVal hWnd As Long, ByVal iMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Dim ReturnwParam As Long, ReturnlParam As Long, bReturn As Boolean

If iMsg = WM_MEMREQUEST Then
bReturn = True 'Most will return something
'Here would be the case select that determines what to reply with, left out because it's big and unnecessary

'Send a message back if need be
If bReturn Then SendMessage hWnd, WM_MEMREQUEST, ReturnwParam, ReturnlParam
Else
'Call the original window proc
WindowProc = CallWindowProc(ProcOld, hWnd, iMsg, wParam, lParam)
End If
If LogDbg And hWnd <> frmMessageWindow.hWnd Then WriteDebugLog "Window message 0x" + hex$(iMsg) + " recieved from 0x" + hex$(hWnd) + ": 0x" + hex$(wParam) + ", 0x" + hex$(lParam)
End Function

(WM_MEMREQUEST is a constant defined within my app equal to 0xBEEF.)
So... any ideas?

[edit] I figured out WTF's up with lParam... almost. Here's the log from the other app sending a message:

Window message 0xBEEF recieved from 0x6004FE: 0x0, 0x12FC2C
Window message 0xBEEF recieved from 0x6004FE: 0xB16B00B5, 0xB00B1E5

The second message is entirely accurate, but the first is entirely non-existant. Also I still have to way to get the source hWnd.
Whoo, big lightning. *unplugs cable and watches*


(edited by HyperHacker on 04-21-04 06:01 PM)
(edited by HyperHacker on 04-21-04 07:15 PM)
(edited by HyperHacker on 04-21-04 07:36 PM)
Add to favorites | "RSS" Feed | Next newer thread | Next older thread
Acmlm's Board - I2 Archive - Programming - VB - Subclassing weirdness | |


ABII


AcmlmBoard vl.ol (11-01-05)
© 2000-2005 Acmlm, Emuz, et al



Page rendered in 0.004 seconds.