Перейти к содержимому
View in the app

A better way to browse. Learn more.

Zloplay community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
Опубликовано:

Hi,

 

I need help adding something to my C-written program. Since there isn't any programming section, I thought I would post it here.

 

So I want to add some info to my exe. So when the user had view mode on details he or she sees the program name and so on. This also means I want to add some info to the properties->details page of the program. This includes company name, version, copyright info, etc.

 

Thank you for the help in advance,

Brainzyy

Featured Replies

Опубликовано:
  • Автор

I'm getting a systax error, could you help? Thank you for your previous help as well.

 

resource.rc:

#define VER_FILEVERSION             0,1,0,0
#define VER_FILEVERSION_STR         "0.1.0.0\0"

#define VER_PRODUCTVERSION          0,1,0,0
#define VER_PRODUCTVERSION_STR      "0.1.0.0\0"

#ifndef DEBUG
#define VER_DEBUG                   0
#else
#define VER_DEBUG                   VS_FF_DEBUG
#endif

VS_VERSION_INFO VERSIONINFO
FILEVERSION    	VER_FILEVERSION
PRODUCTVERSION 	VER_PRODUCTVERSION
FILEFLAGSMASK  	VS_FFI_FILEFLAGSMASK
FILEFLAGS      	(VER_PRIVATEBUILD|VER_PRERELEASE|VER_DEBUG)
FILEOS         	VOS__WINDOWS32
FILETYPE       	VFT_DLL
FILESUBTYPE    	VFT2_UNKNOWN
BEGIN
   BLOCK "StringFileInfo"
   BEGIN
       BLOCK "040904E4"
       BEGIN
           VALUE "Brainzyy Programming Inc.",      VER_COMPANYNAME_STR
           VALUE "Compare you to me.",  VER_FILEDESCRIPTION_STR
           VALUE "0.1.0.0",      VER_FILEVERSION_STR
           VALUE "InternalName",     VER_INTERNALNAME_STR
           VALUE "Brainzyy Programming Inc. 2012",   VER_LEGALCOPYRIGHT_STR
           VALUE "All rights reserved", VER_LEGALTRADEMARKS1_STR
           VALUE "All rights reserved Brainzyy Programming Inc. 2012", VER_LEGALTRADEMARKS2_STR
           VALUE "OriginalFilename", VER_ORIGINALFILENAME_STR
           VALUE "Comparing People",      VER_PRODUCTNAME_STR
           VALUE "0.1.0.0",   VER_PRODUCTVERSION_STR
       END
   END

   BLOCK "VarFileInfo"
   BEGIN
       /* The following line should only be modified for localized versions.     */
       /* It consists of any number of WORD,WORD pairs, with each pair           */
       /* describing a language,codepage combination supported by the file.      */
       /*                                                                        */
       /* For example, a file might have values "0x409,1252" indicating that it  */
       /* supports English language (0x409) in the Windows ANSI codepage (1252). */

       VALUE "Translation", 0x409, 1252

   END
END

Опубликовано:
  • Автор
It would help if you'd provide the error - also are you sure it's a resource script (.rc, with corresponding tool used to build it) and not a .c/.cpp file?

Here's a screenshot. And afaik .rc is used for versioninfo.

UbRXz.png

EDIT: I'll try to compile it as .c instead of .rc .

Опубликовано:
  • Автор
no clue about that IDE, why aren't you using VS?

 

(oh, I see, try a #include on top of the file)

Well don't laugh at me for this but can you code in C in VS? I just searched for a popular IDE for C and Codeblocks popped up and a friend of mine recommended it to me too.

EDIT: Could it be that it's because it's a console application that this doesn't work? Because it says that this only works for desktop applications on the page you linked me to.

Опубликовано:

The statement about 'desktop' is as opposed to 'modern style' applications. Also, VS has a bit broken C support lately (no C99), but I can't see why you would force yourself to strict C when you can also just use the C++ mode and eventually have easier interfacing with C++ libraries as well - nearly all C code compiles cleanly as C++, except for some malloc() patterns.

Опубликовано:
  • Автор
The statement about 'desktop' is as opposed to 'modern style' applications. Also, VS has a bit broken C support lately (no C99), but I can't see why you would force yourself to strict C when you can also just use the C++ mode and eventually have easier interfacing with C++ libraries as well - nearly all C code compiles cleanly as C++, except for some malloc() patterns.

I'll do that, thanks.

Опубликовано:
  • Автор

So I just copy and pasted and pasted my C code in Codeblocks but then with C++ (I did this since resource editing is not available in Visual C++ Express) So here's my main.cpp:

#include 
#include 
#include 
#include 
#include 
#include "resource.cpp"

int main(void)
{
   int bla1;
char bla2[50];
char bla3[50];
char bla4[50];
char bla5;

   printf("Enter your Age, Country, City and Zip code:\n");
   scanf("%d", &bla1);
   scanf("%s", bla2);
   scanf("%s", bla3);
   scanf("%s", bla4);

   if ((bla1 == 15) && (strcmp(bla2,"Belgium")==0) && (strcmp(bla3, "Brugge")==0) && (strcmp(bla4, "8310")==0))
   {
       printf("Are you me?\n");
   }

   else
   {
       printf("You are not me!\n");
       return 0;
   }
   int control = 0;

   do{
       printf("Press y/Y if true, press n/N if false.\n");
       fflush(stdin);
       scanf("%c", &bla5);

       if ( bla5 == 'y' || bla5 == 'Y')
       {
           printf("You are weird!\n");
           control = 1;
       }

       else if (bla5 == 'n' || bla5 == 'N')
       {
           printf("You are perfectly normal!\n");
           control = 1;
       }

       else
       {
           printf("Are you autistic? I said y/Y or n/N, learn to read and type!\n\n");
       }
   }
   while(control != 1);


   getch();
   return 0;
}

And here's my resource.cpp (since I thought I would try making it a .cpp instead of a .rc)

#include 
#include 
#define VER_FILEVERSION             3,10,349,0
#define VER_FILEVERSION_STR         "3.10.349.0\0"

#define VER_PRODUCTVERSION          3,10,0,0
#define VER_PRODUCTVERSION_STR      "3.10\0"

#ifndef DEBUG
#define VER_DEBUG                   0
#else
#define VER_DEBUG                   VS_FF_DEBUG
#endif

VS_VERSION_INFO VERSIONINFO
FILEVERSION    	VER_FILEVERSION
PRODUCTVERSION 	VER_PRODUCTVERSION
FILEFLAGSMASK  	VS_FFI_FILEFLAGSMASK
FILEFLAGS      	VS_FFI_FILEFLAGSMASK
FILEOS         	VOS__WINDOWS32
FILETYPE       	VFT_DLL
FILESUBTYPE    	VFT2_UNKNOWN
BEGIN
   BLOCK "StringFileInfo"
   BEGIN
       BLOCK "040904E4"
       BEGIN
           VALUE "CompanyName",      VER_COMPANYNAME_STR
           VALUE "FileDescription",  VER_FILEDESCRIPTION_STR
           VALUE "FileVersion",      VER_FILEVERSION_STR
           VALUE "InternalName",     VER_INTERNALNAME_STR
           VALUE "LegalCopyright",   VER_LEGALCOPYRIGHT_STR
           VALUE "LegalTrademarks1", VER_LEGALTRADEMARKS1_STR
           VALUE "LegalTrademarks2", VER_LEGALTRADEMARKS2_STR
           VALUE "OriginalFilename", VER_ORIGINALFILENAME_STR
           VALUE "ProductName",      VER_PRODUCTNAME_STR
           VALUE "ProductVersion",   VER_PRODUCTVERSION_STR
       END
   END

   BLOCK "VarFileInfo"
   BEGIN
       /* The following line should only be modified for localized versions.     */
       /* It consists of any number of WORD,WORD pairs, with each pair           */
       /* describing a language,codepage combination supported by the file.      */
       /*                                                                        */
       /* For example, a file might have values "0x409,1252" indicating that it  */
       /* supports English language (0x409) in the Windows ANSI codepage (1252). */

       VALUE "Translation", 0x409, 1252

   END
END

It gives me the error: "resource.cpp 15 error: expected unqualified-id before numeric constant"

Does anybody know how to fix this?

 

I tried this code too resource.cpp:

#include 
#include 
#define VOS_NT_WINDOWS32    0x00040004L
#define VFT_APP                      0x00000001L

//this will set your .exe icon
//A ICON MOVEABLE PURE LOADONCALL DISCARDABLE "myiconfilename.ico"

//include version information in .exe, modify these values to match your needs
1 VERSIONINFO
FILEVERSION 0,1,1,1
PRODUCTVERSION 0,1,1,1
FILETYPE VFT_APP
{
 BLOCK "StringFileInfo"
 {
	 BLOCK "040904E4"
	 {
		 VALUE "CompanyName", "write version info here"
		 VALUE "FileVersion", "write version info here"
		 VALUE "FileDescription", "write version info here"
		 VALUE "InternalName", "write version info here"
		 VALUE "LegalCopyright", "write version info here"
		 VALUE "LegalTrademarks", "write version info here"
		 VALUE "OriginalFilename", "write version info here"
		 VALUE "ProductName", "write version info here"
		 VALUE "ProductVersion", "write version info here"
	 }
 }
 BLOCK "VarFileInfo"
 {
	 VALUE "Translation", 0x0409, 1252 //language codes
 }
}

But it gives me the same error on 1 VERSIONINFO.

Опубликовано:
  • Автор
did you try having it just be a .rc with the #include on top?

Yes, gives me a syntax error on the first VALUE.

EDIT: If I make the 2 samples from above a .rc and compile then with main.cpp separately (not at the same time) I get a syntax error on the first VALUE with both of them.

Опубликовано:
  • Автор
did you try having it just be a .rc with the #include on top?

Yes, gives me a syntax error on the first VALUE.

Is it actually invoking rc.exe from the Windows SDK?

I'm sorry but I don't understand. Could you explain a bit what you mean? (Just started coding and just want this to work)

EDIT: If this is even relevant I am using the GNU GCC Compiler.

EDIT2: I just noticed I need rc.exe to compile my resource.rc to a .res that can be included/compiled in my .exe.

Опубликовано:
  • Автор

It seems like I need to use this: http://msdn.microsoft.com/en-us/library/windows/desktop/aa381055(v=vs.85).aspx to change my .rc file into a .res. How do I do this? How do I use the information on that page?

EDIT: Whatever, VS C++ Enterprise has the resource function enabled and generates a resource.h itself, it also compiles the .rc to a .res, it's just a shame that the express version doesn't have this.

Опубликовано:
  • Автор
VS Express should still be able to compile an existing .rc file if you'd add one to the project.

Yeah, but it needs resource.h to compile correctly, and since I have little programming experience I don't know how to code this myself. That's why I'm using Enterprise now, because that just genrates the correct resource.h itself, which is good for people like me. So in the end I finally managed to compile it correctly and add the resource to my program. Thanks for your time and effort.

  • 5 weeks later...
Опубликовано:

You may also choose the material from different alternatives like gold, silver or perhaps a mix of these. Besides that, Pandora jewelry created from enamel and murano glass is additionally becoming popular. You start out by picking out a basic bracelet. Afterwards, you'll have to add the different charm beads of your choice. There are plenty of Pandora stores everywhere and it is quite sure that you would look for a store nearby your own home. If you aren't able to locate a store, you're going to get a number of them on the Internet.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Гость
Ответить в тему...

Сейчас на странице 0

  • Нет пользователей, просматривающих эту страницу

Важная информация

Используя этот сайт, вы соглашаетесь Условия использования.

Account

Navigation

Поиск

Поиск

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.