Solution to Dax error prompt in OCX control developed by Delphi7

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.