Solved

Using .MC files in C++ Builder

Posted on 2011-03-08
6
1,260 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
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to split this in C++ 4 102
Where to obtain Oracle Data Provider for .NET 3.5 7 53
Beginner to Unreal Engine 4 5 80
C# LINQ ForEach() question 6 28
We were having a lot of "Heartbeat Alerts" in our SCOM environment, now "Heartbeat" in a SCOM environment for those of you who might not be familiar with SCOM is a packet of data sent from the agent to the management server on a regular basis, basic…
Article by: Leon
Software Metering within our group of companies has always been an afterthought until auditing of software and licensing became a pain point. Orchestrator and SCCM metering gave us the answer and it was an exciting process.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…

777 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