Solved

Using .MC files in C++ Builder

Posted on 2011-03-08
6
1,235 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
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Lync meeting or Lync conferencing is what many organizations would like to deploy to allow them save money. But companies are now giving up for various reasons, one of which is that they cannot join external meetings (non-federated company meetings)…
The System Center Operations Manager 2012, known as SCOM, is a part of the Microsoft system center product that provides the user with infrastructure monitoring and application performance monitoring. SCOM monitors:   Windows or UNIX/LinuxNetwo…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

863 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

25 Experts available now in Live!

Get 1:1 Help Now