Solved

Using .MC files in C++ Builder

Posted on 2011-03-08
6
1,274 Views
Last Modified: 2012-05-11
HI, I am hand building a project file in C++ Builder using header and source files from a vcxproj (Visual Studio ) file for an open source library. The VS project has a file with an extension .mc. What exaclty is this file? what does it do? C++ Builder does not seem to know a file type with extension .mc. How  do I work it with c++ builder?
0
Comment
Question by:olmuser
  • 4
  • 2
6 Comments
 
LVL 16

Expert Comment

by:George Tokas
ID: 35095008
Hi there,
First check this out:
http://www.codeguru.com/forum/archive/index.php/t-302816.html
If this is the case we can continue....

George Tokas.
0
 
LVL 1

Author Comment

by:olmuser
ID: 35098282
This link below gives a good overview of MC files and how to use them...

http://rubyforge.org/docman/view.php/85/1734/mc_tutorial.html
0
 
LVL 16

Expert Comment

by:George Tokas
ID: 35098641
So it is just some text used as resource inside a DLL...
Visual Studio creates a DLL to hold that for - lets say, sorry I am Greek and forgive any mistakes - use inside the main application...
The questions are:
Is your application made with C++ Builder loading the DLL??
Do you need the dll or the resource (.res) file?

The above questions are asked because there are and other ways to implement the same functionality but because you are trying to copy code and functionality from VS I have to ask them.

George Tokas.
0
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 
LVL 1

Author Comment

by:olmuser
ID: 35130982
@gtokas, can you please highlight the other methods you mention?

THat could be useful as Borland compiler does not seem to have a mc compiler, so I am assuming they follow a different method.
0
 
LVL 16

Expert Comment

by:George Tokas
ID: 35151385
Sorry for the delay.
This particular subject is covered in the magazine I am publishing articles and I will post a compatible way very soon...
First I have to finish my article for this month...:-(
I'll be back tommorow with compatible solution.

George Tokas.
0
 
LVL 16

Accepted Solution

by:
George Tokas earned 250 total points
ID: 35175045
Hello again,
First of all to use unicode strings as in the sample I am about to show you have to use a version of C++ Builder supports unicode and those are 2006,2009,2010,XE.
The .mc file is a string table resource file...
You are compiling it using MC.exe same way with VS.
There would be as output some .bin files and a .RC file...
Add the .rc file to your project.
This way all .bin files defined inside the .rc file will be linked to the application.
After that you can retrieve the message using:

LPWSTR pMessage = NULL;

  DWORD dwFormatFlags = FORMAT_MESSAGE_FROM_SYSTEM |
                        FORMAT_MESSAGE_FROM_HMODULE |
                        FORMAT_MESSAGE_ALLOCATE_BUFFER;

  va_list args = NULL;
  va_start( args, dwLangId );   // 'dwLangId' is address of last named parameter of called function

  DWORD dwCount = FormatMessage( dwFormatFlags,
                      NULL,           // this app
                      dwMsgId,
                      dwLangId,
                      (LPWSTR)&pMessage,
                      0,
                      &args );

  if( 0 == dwCount )
  {
    ShowMessage( L"Format message failed with " + IntToStr( (__int64) GetLastError()) );
  }

  va_end( args );

George Tokas.
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many companies are making the switch from Microsoft to Google Apps (https://www.google.com/work/apps/business/). Use this article to learn more about what Google Apps has to offer and to help if you’re planning on migrating to Google Apps. It is …
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
Viewers will learn how to maximize accessibility options in an Excel workbook for users with accessibility issues.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question