Click here to Skip to main content
16,005,734 members
Home / Discussions / C#
   

C#

 
GeneralRe: Web Page Comments Pin
Heath Stewart14-Sep-04 11:05
protectorHeath Stewart14-Sep-04 11:05 
GeneralBitmap Dispose Pin
ee9903514-Sep-04 7:33
ee9903514-Sep-04 7:33 
GeneralRe: Bitmap Dispose Pin
Dave Kreskowiak14-Sep-04 9:03
mveDave Kreskowiak14-Sep-04 9:03 
GeneralRe: Bitmap Dispose Pin
Tom Larsen14-Sep-04 11:56
Tom Larsen14-Sep-04 11:56 
GeneralBest way to do this.. Pin
eggie514-Sep-04 7:17
eggie514-Sep-04 7:17 
GeneralRe: Best way to do this.. Pin
Heath Stewart14-Sep-04 10:44
protectorHeath Stewart14-Sep-04 10:44 
GeneralRe: Best way to do this.. Pin
eggie514-Sep-04 11:47
eggie514-Sep-04 11:47 
GeneralRe: Best way to do this.. Pin
Heath Stewart14-Sep-04 12:01
protectorHeath Stewart14-Sep-04 12:01 
I was saying you were right to set CharSet.Ansi since the function is declared using char* (which is always a single byte character). If you use CharSet.Auto or CharSet.Unicode, the string encoding is converted (if CharSet.Auto is set and you're running on Windows NT-based platforms).

The thing about function export spelling is common. ANSI functions are actually declared ending in "A" while Unicode functions are commonly declared ending in "W" like so:
int MyFuncA(LPCSTR lpszParam);
int MyFuncW(LPCWSTR lpszParam);
#ifdef UNICODE
#define MyFunc MyFuncW
#else
#define MyFunc MyFuncA
#endif
That's a pretty basic example, though. It's to make sure that the right string encoding is used for the right platform.

Also, '\0' != null. First of all, in C# anything between single quotes is a char (System.Char). A char is a value type and cannot be null (in .NET 2.0 char? is the same as Nullable<char> and can act like it's null, but value types still can't be null).

'\0' is the null character. This is the common representation in many programming languages, from C to C++ to C# to Perl to Java, etc. This is equal to (char)0. What I was doing was initializing the string contents to the null character, the equivalent of which in unmanaged code is similar to:
LPTSTR lpszVar = NULL;
lpszVar = (LPTSTR)malloc(512 * sizeof(TCHAR));
_tcsnset(lpszVar, TEXT('\0'), 512);


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

Software Design Engineer
Developer Division Sustained Engineering
Microsoft

[My Articles]
GeneralRe: Best way to do this.. Pin
eggie514-Sep-04 12:13
eggie514-Sep-04 12:13 
GeneralRe: Best way to do this.. Pin
eggie514-Sep-04 15:19
eggie514-Sep-04 15:19 
GeneralRe: Best way to do this.. Pin
Heath Stewart14-Sep-04 15:31
protectorHeath Stewart14-Sep-04 15:31 
GeneralProblem with registering a COM object Pin
Anonymous14-Sep-04 6:55
Anonymous14-Sep-04 6:55 
GeneralRe: Problem with registering a COM object Pin
mav.northwind14-Sep-04 7:11
mav.northwind14-Sep-04 7:11 
GeneralRe: Problem with registering a COM object Pin
Heath Stewart14-Sep-04 10:51
protectorHeath Stewart14-Sep-04 10:51 
GeneralRe: Problem with registering a COM object Pin
Code Learner15-Sep-04 5:12
sussCode Learner15-Sep-04 5:12 
Generalnetwork monitoring Pin
14-Sep-04 6:33
suss14-Sep-04 6:33 
GeneralRe: network monitoring Pin
Charlie Williams14-Sep-04 10:06
Charlie Williams14-Sep-04 10:06 
GeneralRe: network monitoring Pin
Dave Kreskowiak14-Sep-04 10:25
mveDave Kreskowiak14-Sep-04 10:25 
GeneralRe: network monitoring Pin
yoaz14-Sep-04 15:19
yoaz14-Sep-04 15:19 
GeneralContext menu with sub menu Pin
CyberTech14-Sep-04 6:26
CyberTech14-Sep-04 6:26 
GeneralRe: Context menu with sub menu Pin
Heath Stewart14-Sep-04 10:56
protectorHeath Stewart14-Sep-04 10:56 
GeneralRe: Context menu with sub menu Pin
CyberTech14-Sep-04 12:00
CyberTech14-Sep-04 12:00 
GeneralRe: Context menu with sub menu Pin
Heath Stewart14-Sep-04 12:08
protectorHeath Stewart14-Sep-04 12:08 
GeneralMobileWebApplication on PocketPc Pin
mathon14-Sep-04 6:02
mathon14-Sep-04 6:02 
GeneralRe: MobileWebApplication on PocketPc Pin
sreejith ss nair14-Sep-04 18:00
sreejith ss nair14-Sep-04 18:00 

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.