Click here to Skip to main content
15,895,799 members
Home / Discussions / C#
   

C#

 
GeneralRe: Not able to delete original jpeg file after it is copied with System.IO.File.Copy() Pin
Aseem Sharma5-Sep-10 6:39
Aseem Sharma5-Sep-10 6:39 
GeneralRe: Not able to delete original jpeg file after it is copied with System.IO.File.Copy() Pin
Dave Kreskowiak5-Sep-10 11:11
mveDave Kreskowiak5-Sep-10 11:11 
AnswerRe: Not able to delete original jpeg file after it is copied with System.IO.File.Copy() Pin
Pete O'Hanlon5-Sep-10 7:29
mvePete O'Hanlon5-Sep-10 7:29 
GeneralRe: Not able to delete original jpeg file after it is copied with System.IO.File.Copy() Pin
Aseem Sharma5-Sep-10 20:02
Aseem Sharma5-Sep-10 20:02 
GeneralRe: Not able to delete original jpeg file after it is copied with System.IO.File.Copy() Pin
NarVish6-Sep-10 0:04
NarVish6-Sep-10 0:04 
GeneralRe: Not able to delete original jpeg file after it is copied with System.IO.File.Copy() Pin
Pete O'Hanlon6-Sep-10 0:33
mvePete O'Hanlon6-Sep-10 0:33 
GeneralRe: Not able to delete original jpeg file after it is copied with System.IO.File.Copy() Pin
NarVish6-Sep-10 1:39
NarVish6-Sep-10 1:39 
QuestionProblem : Need to make COM InterOp at runtime using reflections Passing Pointers as parameters? Pin
glitteringsound4-Sep-10 20:23
glitteringsound4-Sep-10 20:23 
Hello,

I need to make COM IntetrOp at runtime using reflections. My native COM Object's exposed methods have some parameters as pointers (DWORD*) and some double pointers (DWORD**) and some are user defined types(e.g SomeUDTType objSmeUDTType) and vice versa its pointer(i.e. SomeUDTType *pSomeUDTType).

Now for dynamic method invocation, we have single option for passing parameters as array of object i.e object[] and filling this array statically.

But I need to pass pointers and references and pointers to pointers. For now how can I be able to populate object array as mixed data of simple data types, pointers or references and pointers to pointers.

Working Example:

Native COM exposed method :

STDMETHODIMP MyCallableMethod(DWORD *value_1,BSTR *bstrName,WESContext a_wesContext)
Translated by tlbimp.exe (COMInterop)

UDTINIDLLib.RuntimeCallingClass.MyCallableMethod(ref uint, ref string, UDTINIDLLib.WESContext)
Now calling these methods at runtime using reflection at runtime,

See here :

Assembly asembly = Assembly.LoadFrom("E:\\UDTInIDL\\Debug\\UDTINIDLLib.dll");
Type[] types = asembly.GetTypes();


Type type = null;
//foreach (Type oType in types)
{
try
{
type = asembly.GetType("UDTINIDLLib.RuntimeCallingClass");

}
catch (TypeLoadException e)
{
Console.WriteLine(e.Message);
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}

object parameters = new object[3];

Type CustomType = asembly.GetType("UDTINIDLLib.WESContext");
object oCustomType = Activator.CreateInstance(CustomType);
FieldInfo fieldInfo = CustomType.GetField("MachineName", BindingFlags.Public | BindingFlags.Instance);

string MachineName = "ss01-cpu-102";
string MachineIp = "127.0.0.1";
string Certificate = "UK/78T";

fieldInfo.SetValue(oCustomType, MachineName);
fieldInfo.SetValue(oCustomType, MachineIp);
fieldInfo.SetValue(oCustomType, Certificate);


object obj = Activator.CreateInstance(type);
MethodInfo mInfo = type.GetMethod("MyCallableMethod");
int lengthOfParams = mInfo.GetParameters().Length;
ParameterInfo [] oParamInfos = mInfo.GetParameters();



object[] a_params = new object[lengthOfParams];

int ValueType = 0;

for(int iCount = 0; iCount<lengthOfParams; iCount++)
{
a_params[iCount] = ???; //Now here this array should be populated with corresponding pointers and other objects (i.e WESContext's obj)
}

mInfo.Invoke(obj, a_params);
Hope code will clarifies ...If any any confusion do let me know I'll edit my question accordingly.

I am stuck here , I'll be obliged if you help me out.(I am confused about "dynamic" keyword might hope it solves the problem)
Regards

Usman
Questioncreating an own file for my application Pin
prasadbuddhika4-Sep-10 6:50
prasadbuddhika4-Sep-10 6:50 
AnswerRe: creating an own file for my application Pin
Not Active4-Sep-10 7:34
mentorNot Active4-Sep-10 7:34 
AnswerRe: creating an own file for my application Pin
DaveyM694-Sep-10 7:54
professionalDaveyM694-Sep-10 7:54 
AnswerRe: creating an own file for my application Pin
DaveAuld4-Sep-10 7:59
professionalDaveAuld4-Sep-10 7:59 
AnswerRe: creating an own file for my application [modified] Pin
Luc Pattyn4-Sep-10 9:20
sitebuilderLuc Pattyn4-Sep-10 9:20 
AnswerRe: creating an own file for my application Pin
OriginalGriff4-Sep-10 10:25
mveOriginalGriff4-Sep-10 10:25 
AnswerRe: creating an own file for my application Pin
Expert Coming4-Sep-10 22:12
Expert Coming4-Sep-10 22:12 
QuestionHii I am working on project and want to get some data from dataset and want to create and ink stroke Pin
googlejumbo4-Sep-10 6:20
googlejumbo4-Sep-10 6:20 
AnswerRe: Hii I am working on project and want to get some data from dataset and want to create and ink stroke Pin
Luc Pattyn4-Sep-10 6:40
sitebuilderLuc Pattyn4-Sep-10 6:40 
QuestionHow to determine and check whether a type in assembly is Custom type or Primitive type using reflection in .NET? Pin
glitteringsound4-Sep-10 5:14
glitteringsound4-Sep-10 5:14 
AnswerRe: How to determine and check whether a type in assembly is Custom type or Primitive type using reflection in .NET? Pin
Not Active4-Sep-10 5:30
mentorNot Active4-Sep-10 5:30 
AnswerRe: How to determine and check whether a type in assembly is Custom type or Primitive type using reflection in .NET? Pin
dan!sh 4-Sep-10 5:33
professional dan!sh 4-Sep-10 5:33 
AnswerRe: How to determine and check whether a type in assembly is Custom type or Primitive type using reflection in .NET? Pin
PIEBALDconsult4-Sep-10 5:59
mvePIEBALDconsult4-Sep-10 5:59 
GeneralRe: How to determine and check whether a type in assembly is Custom type or Primitive type using reflection in .NET? Pin
dan!sh 4-Sep-10 7:41
professional dan!sh 4-Sep-10 7:41 
GeneralRe: How to determine and check whether a type in assembly is Custom type or Primitive type using reflection in .NET? Pin
PIEBALDconsult6-Sep-10 18:35
mvePIEBALDconsult6-Sep-10 18:35 
Questionhow to update listView on all clients machines when new data was added? Pin
kai-best4-Sep-10 5:06
kai-best4-Sep-10 5:06 
AnswerRe: how to update listView on all clients machines when new data was added? Pin
Not Active4-Sep-10 5:41
mentorNot Active4-Sep-10 5:41 

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.