Click here to Skip to main content
15,888,157 members
Home / Discussions / C#
   

C#

 
GeneralRe: Beginner: How to use BitFlags? Pin
matthias s.17-Sep-04 7:01
matthias s.17-Sep-04 7:01 
AnswerRe: Beginner: How to use BitFlags? Pin
Grimolfr17-Sep-04 7:31
Grimolfr17-Sep-04 7:31 
GeneralInvisible Text on Grid Pin
dbetting17-Sep-04 5:02
dbetting17-Sep-04 5:02 
QuestionIs this a compiler error? Pin
gordonpagan17-Sep-04 4:37
gordonpagan17-Sep-04 4:37 
AnswerRe: Is this a compiler error? Pin
leppie17-Sep-04 5:19
leppie17-Sep-04 5:19 
AnswerRe: Is this a compiler error? Pin
Steven Campbell17-Sep-04 7:46
Steven Campbell17-Sep-04 7:46 
GeneralWideChar Pin
yyf17-Sep-04 3:14
yyf17-Sep-04 3:14 
GeneralRe: WideChar Pin
Heath Stewart17-Sep-04 6:33
protectorHeath Stewart17-Sep-04 6:33 
You don't - strings are wide characters (Unicode) by default in .NET. You actually have to convert to ANSI when calling native functions on Windows (as opposed to Windows NT).

We have convered this countless times in the past, so I urge you both now and in the future to search first for previous similar questions. You can search this forum by clicking "Search comments" above.

For an introduction to marshaling strings with Platform Invoke (P/Invoke), read Marshaling Strings[^]. Basically, when you use the DllImportAttribute to P/Invoke native DLL entry points, or define a structure for use with a native function using the StructLayoutAttribute, you set the CharSet field that both have to CharSet.Ansi (default for P/Invoke) to call only ANSI functions (where native strings are declared as char*), CharSet.Unicode to call only Unicode functions (where native strings are declared as wchar_t*, almost always the case for OLE/COM), or CharSet.Auto when you want to call ANSI functions in Windows (i.e., Windows 9x/ME) and Unicode functions in Windows NT (i.e., Windows NT 4, Windows 2000, Windows XP, Windows 2003, and "Longhorn", plus all future Windows platforms). Windows only supports ANSI (although there is a Unicode layer, but that's an extra install) and Windows NT typically supports both but it's better to use Unicode because it allows for a much larger character set and you don't have to mess with codepages.

This posting is provided "AS IS" with no warranties, and confers no rights.

Software Design Engineer
Developer Division Sustained Engineering
Microsoft

[My Articles]
GeneralFilefield postback woes Pin
Vodstok17-Sep-04 3:08
Vodstok17-Sep-04 3:08 
GeneralRe: Filefield postback woes Pin
sreejith ss nair17-Sep-04 3:40
sreejith ss nair17-Sep-04 3:40 
GeneralRe: Filefield postback woes Pin
Vodstok17-Sep-04 4:36
Vodstok17-Sep-04 4:36 
GeneralStream writing html Pin
Mikke_x17-Sep-04 2:50
Mikke_x17-Sep-04 2:50 
GeneralRe: Stream writing html Pin
Steven Campbell17-Sep-04 4:33
Steven Campbell17-Sep-04 4:33 
GeneralRe: Stream writing html Pin
Heath Stewart17-Sep-04 6:53
protectorHeath Stewart17-Sep-04 6:53 
GeneralRe: Stream writing html Pin
Mikke_x17-Sep-04 7:14
Mikke_x17-Sep-04 7:14 
Generalposting data to another url using webclient Pin
Abraham Durairaj17-Sep-04 0:31
Abraham Durairaj17-Sep-04 0:31 
GeneralMaskEdit Pin
jzb17-Sep-04 0:09
jzb17-Sep-04 0:09 
GeneralRe: MaskEdit Pin
Heath Stewart17-Sep-04 6:37
protectorHeath Stewart17-Sep-04 6:37 
GeneralGraphical programming Pin
Member 62427317-Sep-04 0:06
Member 62427317-Sep-04 0:06 
GeneralRe: Graphical programming Pin
Colin Angus Mackay17-Sep-04 1:10
Colin Angus Mackay17-Sep-04 1:10 
Generalcustom progressbar, problem updating it. Pin
misterbear16-Sep-04 23:50
misterbear16-Sep-04 23:50 
GeneralRe: custom progressbar, problem updating it. Pin
Stefan Troschuetz17-Sep-04 2:47
Stefan Troschuetz17-Sep-04 2:47 
GeneralRe: custom progressbar, problem updating it. Pin
Tim Kohler17-Sep-04 9:49
Tim Kohler17-Sep-04 9:49 
Generalcorrel function for c# Pin
tradingsharp16-Sep-04 22:56
tradingsharp16-Sep-04 22:56 
GeneralRe: correl function for c# Pin
leppie16-Sep-04 23:46
leppie16-Sep-04 23:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.