Is APSTUDIO_INVOKED stuff necessary in a resource file header that generated by Visual Studio?

thebluetropics 1,046 Reputation points
2022-10-30T16:22:16.367+00:00

Visual Studio generates resource.h when creating a new .rc file.

Here is the generated file looks like:

   #ifdef APSTUDIO_INVOKED  
   # ifndef APSTUDIO_READONLY_SYMBOLS  
   #  define _APS_NEXT_RESOURCE_VALUE        102  
   #  define _APS_NEXT_COMMAND_VALUE         40001  
   #  define _APS_NEXT_CONTROL_VALUE         1001  
   #  define _APS_NEXT_SYMED_VALUE           102  
   # endif  
   #endif  

I have tried to compile and run without these stuff, it works perfectly like nothing is changed.

So, what are these stuff? Is it necessary to define it?

Probably Visual Studio uses it for incremental identifier for "next resource"?
However, I manually editing the .rc file, so I didn't use VS' resource manager...

C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,600 questions
0 comments No comments
{count} votes

Accepted answer
  1. Minxin Yu 10,466 Reputation points Microsoft Vendor
    2022-11-02T07:34:00.987+00:00

    Hi, @thebluetropics

    You could refer to the similar thread:
    What are the macros in resource.h used for?

    Best regards,

    Minxin Yu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. RLWA32 42,006 Reputation points
    2022-10-30T16:29:26.957+00:00

    The information is used by the resource editor.