By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,985 Members | 1,861 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,985 IT Pros & Developers. It's quick & easy.

Application crashing in window procedure :(

100+
P: 110
hi all,
I have a very general question.. My program is crashing in a window procedure...
the sample code is as follows..

Expand|Select|Wrap|Line Numbers
  1. return CallWindowProc(pccustgrid->m_wporiglistwndproc, hwnd, message, wparam, lparam);
  2.  
this is a window procedure for a listbox.. sometimes it is crashing while editing the listbox.. actually this listbox is a part of customized grid.. if a user presses tab then he can navigate thru the grid.. and edit.

my question..
wat may be the reasons an application can crash in a window procedure?

Thnx for any replies,
xoinki
Aug 10 '07 #1
Share this Question
Share on Google+
5 Replies


weaknessforcats
Expert Mod 5K+
P: 9,197
The window procedure is just a switch on the message received from DispatchMessage(). Each case is handwritten application code. Just use your debugger and you should be able to see exactly where the crash is occurring.
Aug 10 '07 #2

P: 86
CallWindowProc expects a C function (__stdcall) and not a member function.

If pccustgrid->m_wporiglistwndproc is actually a static function (which i am guessing it's not) you need to use pccustgrid::m_wporiglistwndproc assuming pccustgrid is the name of the class and not an instance
Aug 10 '07 #3

weaknessforcats
Expert Mod 5K+
P: 9,197
CallWindowProc expects a C function (__stdcall) and not a member function.
A member function should be OK as long as it is __stdcall (aka WINAPI). Member functions have addresses and can be used as regular functions provided a this pointer is OK for the first argument.
Aug 10 '07 #4

P: 86
A member function should be OK as long as it is __stdcall (aka WINAPI). Member functions have addresses and can be used as regular functions provided a this pointer is OK for the first argument.
No a member functon is Not OK to pass to CallWindowProc.

Now there are ways to craft a C function to accept and use a this pointer, but in this instance, The first parameter of CallWindowProc already has a set signature and therefore cannot take a member function.

To the OP: Here is a link that should help you understand how to accomplish what you are trying to do

http://web.archive.org/web/200511250...icles/wndproc/
Aug 10 '07 #5

weaknessforcats
Expert Mod 5K+
P: 9,197
No a member functon is Not OK to pass to CallWindowProc.

Now there are ways to craft a C function to accept and use a this pointer, but in this instance, CallWindowProc already has a set signature and therefore cannot take a member function.
You would have thought I would have checked the docs before saying anything. But no. That's twice today. I need more coffee.
Aug 10 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.