ShowMessage或者Messagebox弹出后出现access violation......
在FormCreate事件里面调用ShowMessage或者MessageBox,但在弹出Message后,如果马上按确定,程序正常,但如果稍等两三秒后,就会出现: Access violation at address XXXXXXX in module 'vcl50.bpl'. Read of address 00000047. 我在FormShow函数调用就没有
在FormCreate事件里面调用ShowMessage或者MessageBox,但在弹出Message后,如果马上按确定,程序正常,但如果稍等两三秒后,就会出现:Access violation at address XXXXXXX in module 'vcl50.bpl'. Read of address 00000047.
我在FormShow函数调用就没有这种情况......
曾在CSDN的C++ builder版块中提问过,某位大大给出的原因:ShowMessage这些对话框会阻塞主进程,直到你点击确定才会继续.如果你的代码里面用到有皮肤组件等容易造成其他线程访问了没有初始化的资源造成错误.
遇到过好几次这种情况了,后面才留意了我所接触的项目里,都是将检测配置文件是否正确的代码写在FormCreate事件中,检测到错误就通过 ShowMessage或者MessageBox发出提示,从而有可能阻塞了主进程出现错误,为了防止这种情况,建议不要在FormCreate事件中弹出对话框 ,如果已经出现这种情况的,目前的解决方法有两种:
将检测配置文件是否正确的代码写在 winmain里面
有些时候不方便写在winmain,可以将其写在FormShow事件里,为了使代码尽量少改动,可使用bool blErrorFind变量,将原来在FormCreate事件里弹窗的位置改为blErrorFind = true,再在FormShow开始的地方判断blErrorFind变量,再决定是否弹出Message
mfc中线程使用messagebox也不是一个好主意,必须出错。所以最好设置一个flag,线程外弹窗。。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Many players want to ask when Ark of Destiny Sleepy Dream will be released. Sleepy Dream will meet us on March 13th. There will also be new professional fighter Jia Nan, new continent Rowan, God's Chosen Hero Weapons, new BOSS and other content. Specific details Let’s take a look at the content of this introduction to the launch time of Ark of Destiny Sleepy Dreams. Ark of Destiny Guide: When will Ark of Destiny Dreams be released? Answer: March 13th. Item level requirements. Level 1-Level 3 requires props level: 1540. Level 4 requires props level: 1560. Dropped items: Dream Thoughts, Dream Mark, Falling into despair. Brand new professional fighter male 1. Characteristics: Shura energy, accumulate Shura energy to enter [Kingdom Boxing State] 2. Professional attributes: Melee profession 3. Professional weapon: heavy arm armor. New Continent Rowan 1. How to open it

Some friends are always affected by the pop-up search box when using the system, and they don’t know how to close the automatic pop-up search box in Win10. For this reason, a detailed closing method is provided, which can help everyone not to be harassed. How to turn off the automatic pop-up of the search box in win10: 1. First, right-click the pop-up search box and enter the menu. 2. Then click "Search". 3. Then click "Hide" in the pop-up menu. 4. If you want to use it but don’t want to be disturbed, you can click “Show search icon”.

There are many Xiaomi users who want to buy a bracelet. They like the redmi band 2 very much and want to know when this bracelet will be released. In fact, the release time of this bracelet is December 24, 2022. It has many functions. . When will redmi band 2 be released: Answer: December 24, 2022. It has an ultra-thin body, a 1.47-inch screen, supports blood oxygen detection, and has very good performance. Introduction to redmi band 2 expansion: 1. It uses a 1.47-inch screen and the body is very thin and light, so you won’t feel uncomfortable if you wear it for a long time. 2. It supports more than 30 sports modes and can also help users detect blood oxygen saturation, which is very practical. 3. Magnetic charging can be used, and the battery life can reach 14 days in daily use. The battery life is very strong.

Recently, when many win7 system users play games on their computers, they report that they always pop up the realtek audio manager automatically, which makes the game's automatic return to the desktop interruption very annoying. How to deal with such a problem? In response to this problem, the editor will introduce to you the detailed solution to the problem that realtek audio manager always pops up when playing games in win7 system. How to solve the problem that realtek audio manager always pops up when playing games in win7? 1. We can click the button on the desktop, which is the lower left corner of the computer. 2. We find an action option there and we can click on it. It will enter the operation interface. 3. In the operation interface, we need to enter msconfig. After entering, tap the action or direct key. 4. in

Messagebox is a commonly used dialog box control in Windows operating systems. It is used to display a message to the user and wait for the user's response. Its usage is very simple, just call the MessageBox function and pass in the corresponding parameters. The prototype of the MessageBox function is "int MessageBox(HWND hWnd, LPCTSTR lpText, LPCTSTR lpCaption, UINT uType);".

Techniques and methods of using CSS to implement pop-up special effects when the mouse is hovering. In the design of web pages, we often encounter the need for pop-up special effects when the mouse is hovering. This special effect can improve the user experience and page interactivity. This article will introduce the techniques and methods of using CSS to achieve pop-up effects when the mouse is hovering, and provide specific code examples. 1. Use the transition attribute of CSS3 to realize gradient animation. The transition attribute of CSS3 can realize the gradient animation of elements by setting the appropriate transition time and transition.

PHP function introduction—array_shift(): Pop the element at the beginning of the array PHP is a widely used scripting language, especially suitable for web development. In PHP, many powerful array functions are provided, one of which is the array_shift() function. This function removes and returns the first element from the beginning of the array, while updating the original array's key value. The syntax of the array_shift() function is as follows: mixedarray_shift(arra

Recently, many friends have encountered that when using the keyboard, no matter what keys are pressed, various contents will pop up, and games cannot be played. What is the situation? Let’s take a look at the specific solutions below. Various pop-up solutions for Windows 10 keyboard 1. First, rule out hardware problems, that is, whether your window key or other pop-up keys are inexplicably touched or pressed, or the keys malfunction or the keys are pressed automatically. These are not the case. If so, proceed with the following software operations. 2. Then we use the window+r key to open the command line, and then enter services.msc3. After that, click the box on the right and find ProgramCompatibilityAssistantSer inside.
