Re: Problem with old code, works under VC++ 6 but not VC 2005.

Tech-Archive recommends: Fix windows errors by optimizing your registry



T G wrote:
I have an old project for a DLL we use for Excel. When I build the project as Release in Visual C++ 6 it works fine. But when I build the project in Visual Studio 2005 it will not work. The problem I have is in the following code (I have reduced the code to only include the interesting part):

#define rgFuncsRows 2
static LPSTR rgFuncs[rgFuncsRows][7] =
{ // Procedure type_text function_text argument_text macro_type category shortcut_text
{" TEST1", " RR", " TEST1", " Arg", " 1", " ABC", " "},
{" TEST2", " RR", " TEST2", " Arg", " 1", " ABC", " "},
};


In addition to the other comments, you can fix your code by changing the above to:
#define rgFuncsRows 2
#define MAX_STR_LEN 10
static char rgFuncs[rgFuncsRows][7][MAX_STR_LEN + 1] =
{ // Procedure type_text function_text argument_text macro_type category shortcut_text
{" TEST1", " RR", " TEST1", " Arg",

" 1", " ABC", " "},
{" TEST2", " RR", " TEST2", " Arg",

" 1", " ABC", " "},
};

where MAX_STR_LEN is greater than or equal to the length of the longest string literal in the list of initializers.

Tom
.



Relevant Pages

  • MVS 2005 ERROR -Cant run Device Emulator Manager
    ... Visual Studio 2005 Professional Edition ... When I try to load a new project I get this error: ... Somebody suggest removing everything and installing again - I did this ... How can I fix it? ...
    (microsoft.public.windowsce.app.development)
  • [ANN] Currently available hotfixes for VC 2005
    ... FIX: An access violation may occur when you try to run a Visual C++ 2005 application that contains OMG CORBA IDL code ... You may receive an invalid type exception when floating-point optimization of a Visual C++ application occurs in Visual Studio 2005 ... FIX: Error message when you use certain code patterns that involve the IDisposable interface in the Visual Studio 2005 C++ compiler: Fatal error C1001 ... The IDE stops responding when you build a project that generates lots of text in the Output window in Visual Studio 2005 ...
    (microsoft.public.vc.language)
  • Re: I dont really understand windows security...I need help
    ... That is my exact problem, however the fix ... I now have updated to the new visual studio, so I've created a new aspnet ... >> the file system, I clicked fix, and ever since IE won't launch off the ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: [ANN] Currently available hotfixes for VC 2005
    ... Does anyone know when the full pack will be out? ... FIX: An access violation may occur when you try to run a Visual C++ 2005 ... optimization of a Visual C++ application occurs in Visual Studio 2005 ... Error message when you use certain code patterns that involve the ...
    (microsoft.public.vc.language)
  • Edit undo stops working and missing hot keys
    ... I'm migrating from VC6 to Visual Studio 2003.net. ... To fix it I had to restart Visual Studio. ... A macro maybe? ...
    (microsoft.public.vsnet.ide)