Click here to Skip to main content
15,897,273 members
Home / Discussions / C#
   

C#

 
QuestionAxWindowsMediaPlayer Pin
Francesco-8014-Sep-11 7:08
Francesco-8014-Sep-11 7:08 
AnswerRe: AxWindowsMediaPlayer Pin
Francesco-8015-Sep-11 1:18
Francesco-8015-Sep-11 1:18 
Questionwhat is the "game engine"???? Pin
gif202013-Sep-11 23:40
gif202013-Sep-11 23:40 
AnswerRe: what is the "game engine"???? Pin
Pete O'Hanlon13-Sep-11 23:52
mvePete O'Hanlon13-Sep-11 23:52 
GeneralRe: what is the "game engine"???? Pin
OriginalGriff14-Sep-11 3:10
mveOriginalGriff14-Sep-11 3:10 
GeneralRe: what is the "game engine"???? Pin
molesworth14-Sep-11 7:27
molesworth14-Sep-11 7:27 
QuestionGetThreadPreferredUILanguages Pin
marca29213-Sep-11 22:56
marca29213-Sep-11 22:56 
AnswerRe: GetThreadPreferredUILanguages Pin
Luc Pattyn14-Sep-11 1:52
sitebuilderLuc Pattyn14-Sep-11 1:52 
Hi,

1. I'm not familiar with GetThreadPreferredUILanguages however I do know a thing or two about P/Invoke, and wrote a little article[^] on the subject. What you need here goes beyond the scope of my article though.

2. Your C# code is not doing what your C code does; in particular you should preallocate the result buffer, as you did with wchar_t buf[2323];. The native function you're calling expects a third parameter pwszLanguagesBuffer that is either a NULL, or a valid pointer to a buffer you provide for it to fill.

3. This seems like a reasonable approach: create a byte buffer, have it pinned (with GCHandle), call the native function, then use some kind of Marshal.PtrToString() for each string you need to extract from the buffer. Free the handle once all strings got extracted.

4. I would recommend you call GetThreadPreferredUILanguages twice, once without an output buffer (IntPtr.Zero), just to get the required buffer length; then the regular call with a sufficient buffer size.

Smile | :)
Luc Pattyn [My Articles] Nil Volentibus Arduum

AnswerRe: GetThreadPreferredUILanguages Pin
BobJanova14-Sep-11 2:14
BobJanova14-Sep-11 2:14 
QuestionWhere to use Try/Catch block? [modified] Pin
Adam_Dev13-Sep-11 22:21
Adam_Dev13-Sep-11 22:21 
AnswerRe: Where to use Try/Catch block? Pin
BobJanova13-Sep-11 22:40
BobJanova13-Sep-11 22:40 
GeneralRe: Where to use Try/Catch block? [modified] Pin
Adam_Dev13-Sep-11 23:01
Adam_Dev13-Sep-11 23:01 
GeneralRe: Where to use Try/Catch block? Pin
BobJanova14-Sep-11 2:09
BobJanova14-Sep-11 2:09 
AnswerRe: Where to use Try/Catch block? Pin
Pete O'Hanlon13-Sep-11 22:57
mvePete O'Hanlon13-Sep-11 22:57 
GeneralRe: Where to use Try/Catch block? [modified] Pin
Adam_Dev13-Sep-11 23:10
Adam_Dev13-Sep-11 23:10 
GeneralRe: Where to use Try/Catch block? Pin
Pete O'Hanlon13-Sep-11 23:50
mvePete O'Hanlon13-Sep-11 23:50 
GeneralRe: Where to use Try/Catch block? Pin
Adam_Dev14-Sep-11 0:26
Adam_Dev14-Sep-11 0:26 
AnswerRe: Where to use Try/Catch block? Pin
Luc Pattyn14-Sep-11 2:11
sitebuilderLuc Pattyn14-Sep-11 2:11 
GeneralRe: Where to use Try/Catch block? Pin
BobJanova14-Sep-11 2:22
BobJanova14-Sep-11 2:22 
GeneralRe: Where to use Try/Catch block? Pin
Adam_Dev14-Sep-11 2:33
Adam_Dev14-Sep-11 2:33 
AnswerRe: Where to use Try/Catch block? Pin
Luc Pattyn14-Sep-11 2:51
sitebuilderLuc Pattyn14-Sep-11 2:51 
JokeArrayList Pin
Subodh Kumar Jain13-Sep-11 20:38
Subodh Kumar Jain13-Sep-11 20:38 
GeneralRe: ArrayList Pin
Wayne Gaylard13-Sep-11 21:04
professionalWayne Gaylard13-Sep-11 21:04 
GeneralRe: ArrayList Pin
PIEBALDconsult14-Sep-11 2:27
mvePIEBALDconsult14-Sep-11 2:27 
GeneralRe: ArrayList Pin
Pete O'Hanlon14-Sep-11 3:51
mvePete O'Hanlon14-Sep-11 3:51 

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.