Click here to Skip to main content
15,896,201 members
Home / Discussions / C#
   

C#

 
Questiongetting active window program failed Pin
dvdljns5-Dec-12 3:43
dvdljns5-Dec-12 3:43 
AnswerRe: getting active window program failed Pin
OriginalGriff5-Dec-12 4:56
mveOriginalGriff5-Dec-12 4:56 
QuestionC# - GDI+ Fixed width font Pin
rvlasacek5-Dec-12 2:44
rvlasacek5-Dec-12 2:44 
AnswerRe: C# - GDI+ Fixed width font Pin
Richard MacCutchan5-Dec-12 2:53
mveRichard MacCutchan5-Dec-12 2:53 
GeneralRe: C# - GDI+ Fixed width font Pin
rvlasacek5-Dec-12 3:22
rvlasacek5-Dec-12 3:22 
GeneralRe: C# - GDI+ Fixed width font Pin
Richard MacCutchan5-Dec-12 5:21
mveRichard MacCutchan5-Dec-12 5:21 
GeneralRe: C# - GDI+ Fixed width font Pin
rvlasacek5-Dec-12 7:22
rvlasacek5-Dec-12 7:22 
QuestionNET Code Generator for C ++ DLL Pin
MrKyaw4-Dec-12 21:37
MrKyaw4-Dec-12 21:37 
AnswerRe: NET Code Generator for C ++ DLL Pin
Richard MacCutchan4-Dec-12 22:47
mveRichard MacCutchan4-Dec-12 22:47 
AnswerRe: NET Code Generator for C ++ DLL Pin
Dave Kreskowiak5-Dec-12 2:23
mveDave Kreskowiak5-Dec-12 2:23 
GeneralRe: NET Code Generator for C ++ DLL Pin
MrKyaw9-Dec-12 18:07
MrKyaw9-Dec-12 18:07 
GeneralRe: NET Code Generator for C ++ DLL Pin
Dave Kreskowiak9-Dec-12 19:32
mveDave Kreskowiak9-Dec-12 19:32 
GeneralRe: NET Code Generator for C ++ DLL Pin
MrKyaw16-Dec-12 20:17
MrKyaw16-Dec-12 20:17 
GeneralRe: NET Code Generator for C ++ DLL Pin
Dave Kreskowiak17-Dec-12 3:30
mveDave Kreskowiak17-Dec-12 3:30 
GeneralRe: NET Code Generator for C ++ DLL Pin
MrKyaw18-Dec-12 22:38
MrKyaw18-Dec-12 22:38 
QuestionDisplay popup control through window service Pin
PankajKSood4-Dec-12 19:01
PankajKSood4-Dec-12 19:01 
AnswerRe: Display popup control through window service Pin
V.4-Dec-12 21:19
professionalV.4-Dec-12 21:19 
AnswerRe: Display popup control through window service Pin
BobJanova4-Dec-12 23:57
BobJanova4-Dec-12 23:57 
QuestionProblem with Taskbar Notifications window 7 Pin
PankajKSood4-Dec-12 18:55
PankajKSood4-Dec-12 18:55 
AnswerRe: Problem with Taskbar Notifications window 7 Pin
Eddy Vluggen4-Dec-12 21:42
professionalEddy Vluggen4-Dec-12 21:42 
AnswerRe: Problem with Taskbar Notifications window 7 Pin
Dave Kreskowiak5-Dec-12 2:20
mveDave Kreskowiak5-Dec-12 2:20 
QuestionHow to pass null to a ref ushort parameter in interop method? Pin
Garry Smith4-Dec-12 8:01
Garry Smith4-Dec-12 8:01 
Hi
I have implemented the IWMHeaderInfo3 interface from the Windows Media Format SDK as follows:

C#
[ComImport, Guid(IID.IWMHeaderInfo3), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
internal interface IWMHeaderInfo3 : IWMHeaderInfo2
{
...
void GetAttributeIndices([In] ushort wStreamNum, [In, MarshalAs(UnmanagedType.LPWStr)] string pwszName, [In] ref ushort pwLangIndex, [Out, MarshalAs(UnmanagedType.LPArray)] ushort[] pwIndices, [Out, In] ref ushort pwCount );
...
}


My problem is that according to the MSDN documentation the pwLangIndex parameter needs to be passed a null value at times. However a ushort cannot be assigned a null value so when I try to reference the method in code with a null in that position it complains the closest matching method has invalid parameters.

The unmanaged method is expecting a pointer to a WORD for this parameter so could I use IntPtr instead of ushort and the MarshalAs command to treat it as a WORD *? If so how do I do this?

What is the correct way to get around this issue? All help greatly appreciated.
AnswerRe: How to pass null to a ref ushort parameter in interop method? Pin
Gerry Schmitz4-Dec-12 10:41
mveGerry Schmitz4-Dec-12 10:41 
GeneralRe: How to pass null to a ref ushort parameter in interop method? Pin
Garry Smith4-Dec-12 14:07
Garry Smith4-Dec-12 14:07 
GeneralRe: How to pass null to a ref ushort parameter in interop method? Pin
Gerry Schmitz4-Dec-12 15:24
mveGerry Schmitz4-Dec-12 15:24 

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.