在从VS6.0迁移到VS2015时调用CallWindowProc()函数时出现崩溃 [英] Getting crash when calling CallWindowProc() function in Migration from VS6.0 to VS2015
问题描述
我正在努力将Win32应用程序从VC ++ 6.0迁移到VS2015。代码编译正确。但是当我们按下客户端计算机上的按钮而不是开发人员计我通过WinDbg分析了崩溃转储,看到崩溃
发生在代码
CallWindowProc( )。我们似乎正在通过下面的代码将用户定义窗口处理器设置为控件而不是默认窗口处理器。
extern FARPROC     
lpfnOldTimeEditProc;    
extern   FARPROC     
lpfnTimeEditProc;          
lpfnTimeEditProc =
MakeProcInstance (( < span style ="font-size:9.5pt; font-family:Consolas; color:#2b91af"> FARPROC )
TimeEditProc ,hInst);
lpfnOldTimeEditProc =( FARPROC )
GetWindowLong (sTaskInfo [
IDC_TIME_EDIT_ID ]。hWnd, &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;
&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP ; GWL_WNDPROC )
;
SetWindowLong (sTaskInfo [
跨度>的 IDC_TIME_EDIT_ID 跨度> <跨度风格="font-size:9.5pt; font-family:Consolas">] .hWnd,
GWL_WNDPROC
,
( LONG )
lpfnTimeEditProc);
返回 ( CallWindowProc
(( WNDPROC < span style ="font-size:9.5pt; font-family:Consolas">)lpfnOldTimeEditProc,
hWnd ,
< span style ="font-size:9.5pt; font-family:Consolas; color:grey"> message ,>
&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; 跨度>的 wParam ,
&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP; 跨度>的 lParam ));
如果上述代码遇到崩溃问题,请告诉我。
问候,
RKeerthi。
如果是64位版本,请尝试以下操作:
跨度> 跨度>
<预类= "prettyprint"> lpfnOldTimeEditProc =(FARPROC)SetWindowLongPtr(...,GWLP_WNDPROC,(LONG_PTR)lpfnTimeEditProc);
返回CallWindowProc的( ...);
Hi,
I am working on migrating Win32 application from VC++6.0 to VS2015. The code compiled properly. But getting crash when we are pressing button at client machine but not in developer machines. I analysed the crash dump through WinDbg and seen the crash is happening below code at CallWindowProc().Here seems we are setting User define window processor to controls instead of default window processors through below code.
extern FARPROC
lpfnOldTimeEditProc ;
extern FARPROC
lpfnTimeEditProc ;
lpfnTimeEditProc =
MakeProcInstance ((FARPROC)
TimeEditProc , hInst) ;
lpfnOldTimeEditProc = (FARPROC)
GetWindowLong ( sTaskInfo [
IDC_TIME_EDIT_ID ].hWnd ,
GWL_WNDPROC)
;
SetWindowLong (sTaskInfo [
IDC_TIME_EDIT_ID ].hWnd ,
GWL_WNDPROC
,
(LONG)
lpfnTimeEditProc) ;
return (CallWindowProc
((WNDPROC)lpfnOldTimeEditProc,
hWnd,
message,
wParam,
lParam));
Please let me know if any one faced crash issue for the above code.
Regards,
RKeerthi.
In case of 64-bit version, try this:
lpfnOldTimeEditProc = (FARPROC)SetWindowLongPtr(…, GWLP_WNDPROC, (LONG_PTR)lpfnTimeEditProc); return CallWindowProc(…);
这篇关于在从VS6.0迁移到VS2015时调用CallWindowProc()函数时出现崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!