473,414 Members | 1,738 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

MAKELANGID

In C++, one can use the MAKELANGID macro from Winnt.h.

Can that be used in C#?

--
http://www.standards.com/; See Howard Kaikow's web site.
Nov 17 '05 #1
6 4488
Since there are no macros in C#, and since you can view the winnt.h
file...
why didn't you create methods like this:

/*
A language ID is a 16 bit value which is the combination of a
primary language ID and a secondary language ID. The bits are
allocated as follows:

+-----------------------+-------------------------+
| Sublanguage ID | Primary Language ID |
+-----------------------+-------------------------+
15 10 9 0 bit
Language ID creation/extraction macros:

MAKELANGID - construct language id from a primary language id
and
a sublanguage id.
PRIMARYLANGID - extract primary language id from a language id.
SUBLANGID - extract sublanguage id from a language id.
#define MAKELANGID(p, s) ((((WORD )(s)) << 10) | (WORD )(p))
#define PRIMARYLANGID(lgid) ((WORD )(lgid) & 0x3ff)
#define SUBLANGID(lgid) ((WORD )(lgid) >> 10)
*/

public ushort MAKELANGID(byte primaryLanguage, byte subLanguage)
{
return (ushort)((((ushort)subLanguage) << 10) |
(ushort)primaryLanguage);
}

public byte PRIMARYLANGID(ushort languageId)
{
return (byte)(languageId & 0x3ff);
}

public byte SUBLANGID(ushort languageId)
{
return (byte)(languageId >> 10);
}

Eyal.

Nov 17 '05 #2
Howard Kaikow wrote:
In C++, one can use the MAKELANGID macro from Winnt.h.

Can that be used in C#?


You cannot use the macro per se, but you easily reuse the macro's C++
expression in C#.

Cheers,
--
http://www.joergjooss.de
mailto:ne********@joergjooss.de
Nov 17 '05 #3
How do you reuse C++ macros in C#?

Eyal.

Nov 17 '05 #4
Eyal Safran wrote:
How do you reuse C++ macros in C#?

Eyal.


Eyal,

quoting helps keeping a post in context. Also, read what I actually
wrote:

"[...] you easily reuse the macro's C++ *expression* in C#."

Which is exactly what you did in your reply.

Cheers,
--
http://www.joergjooss.de
mailto:ne********@joergjooss.de
Nov 17 '05 #5
Eyal Safran <ey**@mokedor.com> wrote:
How do you reuse C++ macros in C#?


Not the macro - the macro *expression*. Basically translating it into
C#, as you did in your other post on this thread.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 17 '05 #6
"Eyal Safran" <ey**@mokedor.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
Since there are no macros in C#, and since you can view the winnt.h
file...
why didn't you create methods like this:


Thanx.
Nov 17 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: RoboCity | last post by:
I dont know if this is the right place to ask so sorry if not but i have a problem trying to use SAPI and wondered if anyone could help. I can connect to all the COM components fine and I can get...
8
by: RonHiler | last post by:
My copy constructor is crashing my program, and I can't figure out why. I'll try to make the code listing as short as I can. Here are the two headers: class BreakthroughClass { public:...
3
by: Karthik D | last post by:
Hello All, Basically I would like to take suggestions from programmers about implementation of a function which processes some error messages.(fyi:this is not a homework problem) Let me explain...
0
by: noe | last post by:
I have done a DLL in unmanaged code C++ and in that dll I have defined a function that use memcpy.This dll run ok.I use that dll in a aplication in C# managed code in Visual Studio .NET. I import...
0
by: Jay | last post by:
Hey There, When I run the code below, I get the error "The handle is invalid." .. This is output in the 2nd fprintf. The first one gives me a success message. What could be causing this? -Jay...
8
by: Jay | last post by:
Hey There, I have been writing some code in C++ that gets a message from a Macromedia Flash Player to launch an application that is associated with a flash button. When the button is pressed, it...
2
by: eliang | last post by:
after calls to logonuser() impersonateloggedouuser() the call to openprocess() fails with Access is denied. what i need to do to get the access right back to call OpenProcess success.
1
by: chriskent | last post by:
Hi, I have an unusual situation whereby we create a Window during initialisation. We have used this code for many years and have found one unusual case with a customer when the RegiterClass fails...
19
by: Pavan | last post by:
Hi, I want to know if there is any software for measuring lines of code of my c++ application. I found out a tool, sloccount, but it gives only physical lines of code. I found out one more...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.