It is said that delphi5 has always had this bug with Delphi7, and I don't know if it has been changed in a later version.
I use Delphi7.
I don't know much about delphi. ocx is also used to catch ducks. I cannot understand the cause of this bug, but I did solve the problem. I will explain the solution below (in fact, I also searched the website and sorted it out a little)
1. Go to the Delphi installation directory and find the source \ VCL \ axctrls. Pas file (in this fileCodeThere is a bug), copy it to your project folder, and add this file as part of your project (in this way, Delphi will apply the modified axctrls. Pas)
2. Find the parkingwindow function in the axctrls. Pas file and replace it with the following code.
Function parkingwindow: hwnd;
VaR
Tempclass: twndclass;
Parkingname: string;
Begin
Result: = xparkingwindow;
// If result <> 0 Then exit ;// This line of code does not seem to need to be commented out in delphi5 and DELPHI6.
// Fix Dax error: accessviolation (Win2k, Win XP)
Parkingname: = 'daxparkingwindow _ '+ format (' % P', [@ parkingwindowproc]);
Fillchar (tempclass, sizeof (tempclass), 0 );
If not getclassinfo (hinstance, pchar (parkingname), tempclass) Then // fix Dax error: accessviolation (Win2k, Win XP)
Begin
Tempclass. hinstance: = hinstance;
Tempclass. lpfnwndproc: = @ parkingwindowproc;
Tempclass. lpszclassname: = pchar (parkingname); // fix Dax error: accessviolation (Win2k, Win XP)
If windows. registerclass (tempclass) = 0 then
Raise eoutofresources. Create (swindowclass );
End;
Xparkingwindow: = createmediawex (ws_ex_toolwindow, tempclass. lpszclassname, nil,
Ws_popup, getsystemmetrics (sm_cxscreen) Div 2,
Getsystemmetrics (sm_cyscreen) Div 2, 0, 0, 0, 0, hinstance, nil );
Setwindowpos (xparkingwindow, 0, 0, 0, 0, 0, swp_noactivate or swp_noredraw
Or swp_nozorder or swp_showwindow );
Result: = xparkingwindow;
End;
3. compile the project.
References:
Http://www.delphibbs.com/delphibbs/dispq.asp? Lid = 919005
Bytes