Solved

Using .MC files in C++ Builder

Posted on 2011-03-08
6
1,212 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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

User Beware!  This is a rather permanent solution to removing your email from an exchange server.  The only way to truly go back is to have your exchange administrator restore your mailbox from backups.  This is usually the option of last resort.  A…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
Viewers will learn how to maximize accessibility options in an Excel workbook for users with accessibility issues.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

708 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now