I have a project in C++Builder. It invokes Application->MessageBox in several files. I recently upgraded to C++Builder 2007. The MessageBox calls that were already there seem to work OK, but those I have added since upgrading all give an AccessViolation at Run time.
The Call Stack looks like this:

:7c812a5b kernel32.RaiseException + 0x52
:004940CC System::NotifyNonDelphiException()
:7c90378b ntdll.RtlConvertUlongToLargeInteger + 0x46
:7c90eafa ntdll.KiUserExceptionDispatcher + 0xe
:7c90f0aa ntdll.RtlAnsiStringToUnicodeString + 0x5e
:7c832874 ; C:\WINDOWS\system32\kernel32.dll
:7473d271 ; C:\WINDOWS\system32\MSCTF.dll
:7473fcfc ; C:\WINDOWS\system32\MSCTF.dll
:74740313 ; C:\WINDOWS\system32\MSCTF.dll
:7474077b ; C:\WINDOWS\system32\MSCTF.dll
:74740ec5 ; C:\WINDOWS\system32\MSCTF.dll
:7473cd8f ; C:\WINDOWS\system32\MSCTF.dll
:7e418734 USER32.GetDC + 0x6d
:7e418816 ; C:\WINDOWS\system32\USER32.dll
:7e4189cd ; C:\WINDOWS\system32\USER32.dll
:7e418a10 USER32.DispatchMessageW + 0xf
:7e42dbbf ; C:\WINDOWS\system32\USER32.dll
:7e42593f ; C:\WINDOWS\system32\USER32.dll
:7e43a91e ; C:\WINDOWS\system32\USER32.dll
:7e43a284 ; C:\WINDOWS\system32\USER32.dll
:7e4661d3 USER32.MessageBoxTimeoutW + 0x7a
:7e466278 USER32.MessageBoxTimeoutA + 0x9c
:7e450617 USER32.MessageBoxExA + 0x1b
:7e4505cf USER32.MessageBoxA + 0x45
:004CE16E Forms::TApplication::MessageBox(Self=:04BAB640, Text=????, Caption=:005351F6, Flags=????)
:0040F5A5 CEnvelope::SetVartoIgnoreinPhase(this=:04B8F620, iphase=22, nx=21, ignoreindex=12, iusethisphase=:0013E5E0)

SetVartoIgnoreinPhase is my function.
The calling statement is

Application->MessageBox(messbuff, "Phase Envelopes", MB_OK);

messbuff is a char array.

The included header includes
#include <vcl.h>
ANyone know what I need to do?

I might add that in Forms::TApplication.MessageBox in line
Result:= Windows.MessageBox(TaskActiveWindow,Text, Caption,Flags);

Text and Caption are correct and the other arguments are the same as for a MB that works OK. Windows is {} for both MBs.

Actually the Message Box was not really the cause of the Access Violation. I corrected something else unconnected with the message box statement and the AV went away. Don't know why it manifested as it did.

This question has already been answered. Start a new discussion instead.