How to get file and product version number ?

Hi ,

I want to get file version and product version from ".rc" file. BUT instead
of  theses

File version :  1,1,0,0
Product version : 2,0,0,1

my function return theses values :

dfileversionLs = 7864320
dfileversionMs = 655380
dproductversionLS = 65536000
dproductversionMS = 327680
dstructversion = 65536

Variables are in my following code :

HRESULT GetFileVersion(char *filename,char* sversion)
{
   VS_FIXEDFILEINFO pvsf;
   DWORD dwHandle;
   DWORD cchver = GetFileVersionInfoSize(filename,&dwHandle);
   if (cchver == 0)
      return LastError();
   char* pver = new char[cchver];
   BOOL bret = GetFileVersionInfo(filename,dwHandle,cchver,pver);
   if (!bret)
      return LastError();
   UINT uLen;
   void *pbuf;

   bret = VerQueryValue(pver,"\\",&pbuf,&uLen);
   if (!bret)
      return LastError();
   memcpy(&pvsf,pbuf,sizeof(VS_FIXEDFILEINFO));

   DWORD dfileversionLs = pvsf.dwFileVersionLS;
   DWORD dfileversionMs =pvsf.dwFileVersionMS;
   DWORD dproductversionLS =pvsf.dwProductVersionLS;
   DWORD dproductversionMS =pvsf.dwProductVersionMS;
   DWORD dstructversion = pvsf.dwStrucVersion;

   delete[] pver;

   return S_OK;
}

Thanks in advance


Cheickna




0
9/17/2003 4:17:10 PM
vc.mfc 33608 articles. 0 followers. Follow

1 Replies
1840 Views

Similar Articles

[PageSpeed] 57

The code looks fine. Try

        GetFileVersionInfo(filename,0,cchver,pver);

--
Cheers
Check Abdoul [ VC++ MVP ]
-----------------------------------


"Cheickna Traor�" <cheickna.traore@almas.fr> wrote in message
news:bka1i2$si9$1@s1.read.news.oleane.net...
> Hi ,
>
> I want to get file version and product version from ".rc" file. BUT
instead
> of  theses
>
> File version :  1,1,0,0
> Product version : 2,0,0,1
>
> my function return theses values :
>
> dfileversionLs = 7864320
> dfileversionMs = 655380
> dproductversionLS = 65536000
> dproductversionMS = 327680
> dstructversion = 65536
>
> Variables are in my following code :
>
> HRESULT GetFileVersion(char *filename,char* sversion)
> {
>    VS_FIXEDFILEINFO pvsf;
>    DWORD dwHandle;
>    DWORD cchver = GetFileVersionInfoSize(filename,&dwHandle);
>    if (cchver == 0)
>       return LastError();
>    char* pver = new char[cchver];
>    BOOL bret = GetFileVersionInfo(filename,dwHandle,cchver,pver);
>    if (!bret)
>       return LastError();
>    UINT uLen;
>    void *pbuf;
>
>    bret = VerQueryValue(pver,"\\",&pbuf,&uLen);
>    if (!bret)
>       return LastError();
>    memcpy(&pvsf,pbuf,sizeof(VS_FIXEDFILEINFO));
>
>    DWORD dfileversionLs = pvsf.dwFileVersionLS;
>    DWORD dfileversionMs =pvsf.dwFileVersionMS;
>    DWORD dproductversionLS =pvsf.dwProductVersionLS;
>    DWORD dproductversionMS =pvsf.dwProductVersionMS;
>    DWORD dstructversion = pvsf.dwStrucVersion;
>
>    delete[] pver;
>
>    return S_OK;
> }
>
> Thanks in advance
>
>
> Cheickna
>
>
>
>


0
CheckAbdoul
9/17/2003 5:50:10 PM
Reply:

Similar Artilces:

Reflecting info between an excel file and a word one or two excel file.
I have an Excel file that I use as a database with the dates of the time when my company does the maintenance of our electronics tools (we work in an industry that uses them a lot, we have around 200 in an Excel file). So the documents look as follows (the images are copied and edited in paint, that's why they look kinda weird). They are next to each other; I divided it here in order to fit it to word's format (it's in Spanish, there's no need for you to understand what it says anyway): Go to www.caladeamerica.com.ar/1st file.jpg please and see it. We do the maintenance of...

i get error 404 not found when trying to download
I'm trying to download nokia pc suite to windows xp to upload gallery onto the computer but get error message404 not found - how can i download this pc suite please -- Krysy Albutt Krysy Albutt wrote: > I'm trying to download nokia pc suite to windows xp to upload gallery > onto the computer but get error message404 not found - how can i > download this pc suite please Care to enlighten us how this pertains to: - 1) Microsoft 2) Publisher 3) Windows If you're having problems downloading from the *NOKIA* site where do you think you should be directing your ...

How do I import a WORD file into EXCEL? #2
I'd like to import a WORD table to Excel but when I go to "Select Data Source", only other EXCEL files show, not my WORD files but the Help function indicates that all files should be showing. I've selected "Text Files" from the Data Source; I've tried "All File Types" with no luck. Anybody have a clue for me? ..signed, an Excel Idiot......thanks! File>open and select all files or copy and paste -- Regards, Peo Sjoblom "MauiMama" <MauiMama@discussions.microsoft.com> wrote in message news:27741FDC-23BA-478D-98AC-21760...

How to get Calendar to send me reminders
I have changed my e-mail address but for some reason I cannot get Calendar to send reminders to my new address - I think I have carried out all that is necessary to effect the changover but I am not getting reminders sent. Can anyone help please? Is the Calendar Live ID based and accessible at Calendar.live.com ? -- ....winston ms-mvp mail "Dabardevon" wrote in message = news:FDC2B3B2-EDE4-41B1-BFC4-C0F9ED59CFB9@microsoft.com... I have changed my e-mail address but for some reason I cannot get = Calendar to send reminders to my new address - I think I have...

PDF file #9
I have Publisher 2002 and would like to insert a .pdf file into a document I am working on. How do / Can I do this? Many thanks, Ger ...

isv.config file rollback
I have an issue with the isv.config file. I customized it, adding a couple of buttons to the toolbar section under quote. Every now and again, the isv.config file reverts back to an older version of the file, which does not have my customizations. Has anyone encountered this problem? Is there any way to prevent this from happening? Is there some setting that I may have forgotten to set? The isv.config is just a file so it won't revert on it self. However if you import an xml customization file this may contain a blank isv.config. -- Patrick Verbeeten (MCSD) Lead Developer ...

Some recipients get the attachment, some get winmail.dat
This one has me baffled. We are using Exchange 2000 and Outlook 2000 and have been for 8 months. No previous problems with attachments (.doc, .xls, .jpg). About 2 weeks ago, we started hearing from certain recipients that the attachment wasn't arriving; instead they were getting an unreadable file called winmail.dat. MS says that this is because the sender is using Rich Text to format the email. We have changed the senders to use Plain Text and still have the same problem. If the email is sent to several recipients, some will get the attachment fine, some will not. This didn'...

Automatic Numbering Rows
Hi all... Can't find how do to this using Excel 2003... I want to be able to have Excel automatically number rows (in the first column) that have text on them...but skip numbering rows without...and adjust the numbering if new rows get added in later. (I guess something similar to Bullets and Numbering in Word). Here's an example of what I want if I'm not making myself clear... 1. Text Here 2. Text Here 3. Text Here (Empty row...no text) 4. Text Here 5. Text Here (Empty row...no text) 6. Text Here etc.. Then...let's say...at a later date...I inserted a new row under...

wrong number in cell
In XP PRO & Excel 2002 I have a cell formated as General and unlocked. I try to enter a number { 08607100 } I hit enter and it changes to { 8607100 } no matter what I try it. This is another example of a problem in a cell I enter { 03E2 } hit enter and it changes to { 3.00E+02 }. Is there some bug in certain cells or with excel 2002 or is there some setting I am missing? Help -- Thanks MK pipco wrote: > In XP PRO & Excel 2002 I have a cell formated as General and unlocked. I > try to enter a number { 08607100 } I hit enter and it changes to { 8607100 &g...

Hiding and Existing and Write-in products
Hello All, We are not using the Product Catalog at all but are using sales orders. Is there a way to hide the existing and write-in products on the Sales order entity? Thanks Removing security privileges on Products from security roles will hide Order Products from users "MDV1457" <MDV1457@discussions.microsoft.com> wrote in message news:BB84AE28-7D86-44FF-8B96-BBD5FEF37BF5@microsoft.com... > Hello All, > We are not using the Product Catalog at all but are using sales orders. Is > there a way to hide the existing and write-in products on the Sales order > ent...

Conditional linked files
Hi, I have two files (a master and a detail) in which I pull through a column from the detail to the master, using "=[Detail.xls]Sheet1!$A$2" However I would like to configure the spreadsheets so that only data which meets a condition is pulled in the master, in other words using pseudo code as follows. If [link] in detail.xls = yes then display in master. I realise that the condition statement will probably need to sit in the master file but have no idea how this is done or whether possible at all. Any ideas? Mark -- madiba --------------------------------------------------...

How to get the CScrollBar's Handle in CTreeCtrl?
Hey,All: I thought I have a problem when I trid to get the CScrollBar's handle from my CTreeCtrl extended handle. Can anybody tell me whether I can get the handle of the CScrollBar from the CTreeCtrl? Thanks in advance! Carl :-| Carl wrote: > Hey,All: > > I thought I have a problem when I trid to get the CScrollBar's handle from > my CTreeCtrl extended handle. > Can anybody tell me whether I can get the handle of the CScrollBar from the > CTreeCtrl? > > Thanks in advance! > Carl > :-| > > Sorry, it is not that simple. The scroll bars that...

A Crystal Beginner
I am using Crystal 9.2.4.77 and have loaded the Crystal enhancements. Now I want to do against the CRM database. What do I do? I thought I would create a data source to the CRM SQLserver, which I did, then connect to it through Crystal Reports. That works, but when I drill down on the AAA_MSCRM database to choose my tables, it shows me dbo as the only option (where did this come from??) and under that are just a few generic tables. No CRM tables. Something's not quite right. What am I missing? file - log on to aps server "KBLawson" <klawson@aetinc.com> wrote in ...

Same file exists when I run Optimizer
Dear Sir/Madam, While I was running the Optimizer to utilize free space I met a error message during moving the files C:\exchsrvr\imcdata into D:\exchsrver\imcdata " There is the same file, ...., in the destination.". But I could see for sure that there was No files in the destination. Could you let me know how to fix it? Thanks a lot in advance. KC "�̱�ö" <kclee@jcsworld.com> wrote: >While I was running the Optimizer to utilize free space I met a error >message during moving the files C:\exchsrvr\imcdata into >D:\exchsrver\imcdata " There is...

Install driver files with the same name
Hello, We have multiple driver files with the same name which were provided third party. I am looking for a way to install the drivers. Because We want that the each driver are used in different applications. Is there any way to install the drivers without changing their file sames? Taka <Taka@discussions.microsoft.com> wrote: > >We have multiple driver files with the same name which were provided third >party. >I am looking for a way to install the drivers. >Because We want that the each driver are used in different applications. > >Is there ...

Importing/parsing data from an external file in Word 2007 Macros
Hello! I am wondering if this is possible, and if so, how do I do it? What I want to do is this: I have a template, and I want to write a macro that will create a document based on this template by pulling data out of other files, formatting the data, and putting it in the appropriate section of the document. I have no experience with Word Macros or VBA, although I have programmed in VB.NET in the past. Any suggestions would be helpful! Thank you! Kaiti You would need an AutoNew macro in the template that contained the code statements. Sub AutoNew() ActiveDocu...

Unknown file exporting type. Please pick a new export type.
Hello, Has anyone ever seen the error message "Unknown file exporting type. Please pick a new export type." It has begun appearing when trying to use the Report Schedule within GP and after clicking Publish Now. This just began occurring in one company, but continues to work fine in other companies. The file export type is typically Adobe PDF, but users also receive this when switching to other types such as Text file. This is occurring on the server and at least two workstations. Has anyone seen this error before or does anyone have any thoughts on a resolution for it? ...

Case numbering 01-26-04
I have found the auto numbering in 1.2, but it only lets me change the prefix for the cases "CAS". I need to start my numbering at 3500 instead of 1000. Is there a way to change the starting number? Thanks, Stefanie ...

Missing inetcomm.hlp file
I am running Win98SE, with Outlook 97 (8.04.5619). When I go to tools | services, select an internet mail account, click properties, and then use the ( ? ) to get help on one of the fields, I get an error indicating that the inetcomm.hlp file can not be found... I am not sure if this was working in the past. I did, however recently apply some security patches from Microsoft. Can't seem to find a copy of the file anywhere (assuming it will fix the problem). Any Ideas? Thanks ...

Outlook Activation/PDA outlook version
Microsoft will not fully activate a OUTLOOK program that came with my Toshiba PDA, they say "cannot activate due to already activated on another machine", I deleated the program on the machine they mention however still dosent activate. Trying to work through Microsoft they wont help cause Toshiba sold me that version. if so how can microsoft limit my outlook and not answer my qustion. ...

file is locked does not appear in Excel if file already open by an
We have shared files on a network drive. When a file is open by one user, and a second user opens the file we want them to recieve <filename> is locked for editing message and open the file read only. This works great for some users, but we have several users that can open the file (even if someone is already in it) and they do not get the prompt and can edit the workbook. Is there a setting that would turn this off for some users and not others in excel? Hello Leslie, You could try sharing the workbook. With the Excel workbook open, choose Tools from the menu. Choose Share W...

Cannot get fast forward or fast reverse to work with WMP 11
I am running Vista Home Premium on a HP G 217-EM Notebook which comes pre-installed with Windows Media Player 11. When I play cds and try to fast forward or fast reverse by keeping the fast forward or fast reverse buttons constantly depressed nothing happens. Why is this, and can anyone come up with a solution? Many thanks This doesn't work on my system either, so it's probably just a limitation of WMP. Fast forward and fast reverse should work fine when you rip the CD's to MP3 or WMA files, and play these files instead. Regards -- Tim De Baets http://www....

Get paid while you get online!!
I found a great Internet company - Cashfiesta.com - that has created a product everyone can benefit from. They pay you while you work or play on your computer. All you need to do is keep their software - the FiestaBar=99 - active while you are online. They even pay you when your friends are using their computers. Unlike other companies, Cashfiesta gives you control over how much money you earn. They have an individual payrate based on the number of Special Offers you sign up for. As some of these offers are free, you can increase your payrate up to 33 times without spending a penny. It's...

I can not open doc file attachments from outlook express 6.0
I can not open doc file attachments in outlook express 6.0 Error message - There is not enough memory to open file All other attachments eg: jpeg etc are fine I have already increased my paging memory. >-----Original Message----- >I can not open doc file attachments in outlook express 6.0 >Error message - There is not enough memory to open file >All other attachments eg: jpeg etc are fine=20 >I have already increased my paging memory. >. > These Newsgroups address Office Outlook issues. Outlook Express gurus hang out here: http://communities.microsoft.com/newsgroups/def...

Converting Outlook files #2
Hi, In a magazine article that I read, it said that when moving from Outlook 2002 or earlier to Outlook 2003, you should convert the file to the new format that is found in 2003, but how can I do that BTW. I don't want to loose all of the documents and setting that are already associated with the current file -- Thank you in Advance Merci a l'Avance Martin In Outlook 2003, File->New->Outlook Data File->Type->Personal Folders File. Do not select the 97-2002 format. Then drag and drop your folders from the old to the new. --� Milly Staples [MVP - Outlook] Post...