Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
E

EdgarBM

@EdgarBM
About
Posts
30
Topics
15
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • USB port programming??
    E EdgarBM

    Hi all, I want to get some sample code or good tutorial to program the USB port. I just want to use the USB port like I could make with a serial port or an ethernet port (I think that with USB it will be the combination of both), just to send and receive information in an assyncronous way (maybe). It's easy!! ;) Do you know anyway to begin? Thank you in advance, Edgar __________________________________________ Edgar Berengena Moreno Software Engineer Appeyron Research

    C# tutorial question

  • How to "disable" GAC functionalities for a shared library?
    E EdgarBM

    Hi, I'm developping two projects which share a common library. No problem. The problem is that I would like to keep a library version, to know which features it has, but I would like that both using projects share this library (only one) without considering the version number. I mean, I would like that GAC doesn't exist! What am I doing wrong?, what should I do? Thanks in advance, Edgar __________________________________________ Edgar Berengena Moreno Software Engineer Appeyron Research

    C# dotnet help tutorial question announcement

  • Delayed QueryInterface error Exception!!!
    E EdgarBM

    Thanks for your interest, Leppie, It's said is a Microsoft bug (Q325699), althought it's not published, so it must be requested directly to Miscrosoft Support. Thank you again, Edgar __________________________________________ Edgar Berengena Moreno Software Engineer Appeyron Research

    C# c++ help csharp com question

  • Delayed QueryInterface error Exception!!!
    E EdgarBM

    Thanks, John, It's said it's a hidden bug almost solved from Microsoft. There's a hotfix still not published (Q325699) which you can ask for to Microsoft Support, but it's only available for NET english version. This bug consists of an incorrect behaviour of the garbage collector, which removes the instance of the COM objects unsued after a few time. I'll try to solve it manually until Microsoft publish the fix for my spanish version, accessing the object between short periods of times. Thank you again, Edgar __________________________________________ Edgar Berengena Moreno Software Engineer Appeyron Research

    C# c++ help csharp com question

  • Delayed QueryInterface error Exception!!!
    E EdgarBM

    Thanks, Stefan, It's said it's a hidden bug almost solved from Microsoft. There's a hotfix still not published (Q325699) which you can ask for to Microsoft Support, but it's only available for NET english version. This bug consists of an incorrect behaviour of the garbage collector, which removes the instance of the COM objects unsued after a few time. I'll try to solve it manually until Microsoft publish the fix for my spanish version, accessing the object between short periods of times. Thank you again, Edgar __________________________________________ Edgar Berengena Moreno Software Engineer Appeyron Research

    ATL / WTL / STL c++ help csharp com question

  • Delayed QueryInterface error Exception!!!
    E EdgarBM

    Hi, I'm using a VC++ 6.0 ATL COM object in a .NET code. The library is registered before usign it. Everything work correctly if the library is being accessed continuously; the problem appears when it's not accessed for a while (maybe 5 minutes, it has not been completely assumed) so when it's accessed again it returns an exception of a QueryInterface error for the library interface, although the library has not been modified, neither changed or deleted...nothing! the system only has been forgotten for a while... Any suggestion or good idea?, any knowledge about it? Thank you in advance, Edgar __________________________________________ Edgar Berengena Moreno Software Engineer Appeyron Research

    C# c++ help csharp com question

  • Delayed QueryInterface error Exception!!!
    E EdgarBM

    Hi, I'm using a VC++ 6.0 ATL COM object in a .NET code. The library is registered before usign it. Everything work correctly if the library is being accessed continuously; the problem appears when it's not accessed for a while (maybe 5 minutes, it has not been completely assumed) so when it's accessed again it returns an exception of a QueryInterface error for the library interface, although the library has not been modified, neither changed or deleted...nothing! the system only has been forgotten for a while... Any suggestion or good idea?, any knowledge about it? Thank you in advance, Edgar __________________________________________ Edgar Berengena Moreno Software Engineer Appeyron Research

    ATL / WTL / STL c++ help csharp com question

  • Creation of context menu in a simple button?
    E EdgarBM

    Hi, I would like to create a context menu when a right click on a simple button or any other control. I need this menu with few options to execute other code. Does any one have any little sample code to do this or maybe some reference? Thank you in advance, Edgar __________________________________________ Edgar Berengena Moreno Software Engineer Appeyron Research

    C# question

  • Run time compilation with ASSEMBLIES?!?
    E EdgarBM

    GREAT! Fast and simple. Thank you, Stephane. __________________________________________ Edgar Berengena Moreno Software Engineer Appeyron Research

    C# help question workspace

  • Run time compilation with ASSEMBLIES?!?
    E EdgarBM

    Hi, I'm compiling in run time with a code like this: CSharpCodeProvider codeProvider = new CSharpCodeProvider(); ICodeCompiler icc = codeProvider.CreateCompiler(); System.CodeDom.Compiler.CompilerParameters parameters = new CompilerParameters(); parameters.GenerateExecutable = false; parameters.GenerateInMemory = true; CompilerResults results = icc.CompileAssemblyFromSource(parameters, txtSource ); if (results.Errors.Count > 0) { foreach(CompilerError CompErr in results.Errors) { txtErr.Text += "Line number " + CompErr.Line + ", Error Number: " + CompErr.ErrorNumber + ", '" + CompErr.ErrorText + ";" + Environment.NewLine + Environment.NewLine; } } else { Assembly assembly = results.CompiledAssembly; Type t = assembly.GetType("MyNamespace.MyClass"); MethodInfo me = t.GetMethod("MyMethod"); object result; result = t.InvokeMember("MyMethod2", BindingFlags.Public | BindingFlags.Static | BindingFlags.InvokeMethod , null, null, null ); MessageBox.Show ( ((int)result).ToString() ); // get the result as string } } //(provided by Wiktor Zychla) The problem is: how can I specify reference assemblies to the run time compiled assembly?, is it possible? 'ReferencedAssemblies' in 'CompilerParameters' is only of read mode, so it's not possible to set them...I'm wrong? Thanks in advance, Edgar __________________________________________ Edgar Berengena Moreno Software Engineer Appeyron Research

    C# help question workspace

  • How to use scripts in my applicaction?!?
    E EdgarBM

    Hi, I have an application which part of its code should be done in script code in order to be modified by the user. I also should need to pass information to this script code, like instances of objects already created. Is there any way to do it?, is there any sample or direct reference which explains it? Thanks in advance, Edgar __________________________________________ Edgar Berengena Moreno Software Engineer Appeyron Research

    C# tools tutorial question

  • Easy:reference values after dialog show
    E EdgarBM

    Hi, I think my problem is easy to solve, but I'm giving too much time while I can solve it in other ways (uglier ones...). That's it: I've got a form which instantiates a simple form to get a user & pwd. When the Show method is finished I would like to get the values of the strings (properties) in the calling form. I can do it creating two public strings at the called form which are initialized to the Edit Controls value and read by the calling form when the Show method finishes. It's a simple solution, but I want a better one: Is it possible to pass the reference of the local strings to the constructor of the called form so when the Show method finishes the calling form already has the initialized values? I also tried to use Marshal interface and IntPtr, but the solution became uglier by moments... Does anyone know how to manage it?, is it possible?, maybe is there any similar solution which save me to create to public strings in the called form? Thank you in advance, Edgar __________________________________________ Edgar Berengena Moreno Software Engineer Appeyron Research

    C# help tutorial question

  • Array of strings to old DLL?
    E EdgarBM

    Hi, I'm trying your second code but I'm having problems and I don't know if I'm doing it quite well. That's what I'm trying now: For the double[]: IntPtr buffer = Marshal.AllocCoTaskMem( Marshal.SizeOf( cantidad ) * sVN.Length); // or Marshal.AllocHGlobal (COM or not) Marshal.Copy( sVN, 0, buffer, sVN.Length ); ...and for the string[]: IntPtr ptag = new IntPtr (); ptag = Marshal.StringToHGlobalAnsi ("maybe..."); ArrayList tags = new ArrayList(); do { string tag = Marshal.PtrToStringAnsi (ptag); //PtrToStringUni (ptag); // ptag is pointer to string[], make sure about unicode/ansi, i assume unicode if (tag == "") break; else { tags.Add(tag); ptag = new IntPtr(ptag.ToInt32() + Marshal.SizeOf(Marshal.StringToHGlobalAnsi (tag))); } }while(true); And I define the DLL Function like: Method (..., ref IntPtr sbufN, ArrayList sbufC, ...); What am I doing wrong? Thank you again for your dedication, Edgar __________________________________________ Edgar Berengena Moreno Software Engineer Appeyron Research

    C# csharp question c++ com

  • Array of strings to old DLL?
    E EdgarBM

    Thanks for your reply, Leppie. The only problem is that I'm working with string arrays too, so the Copy method of Marshall can't be applied. I can't say if it works or doesn't work because I need to manage the string array too so keeps receiving the exception...although it seems to work for the double[] (maybe I hope)!! Any idea for the string array? PS: the unmanaged DLL parameters (VC++ 6.0 DLL) are defined as SAFEARRAY FAR *doubleArray, SAFEARRAY FAR *stringArray ...these are the conflicting ones. Thank you again, Edgar Edgar Berengena Moreno Software Engineer Appeyron Research

    C# csharp question c++ com

  • Array of strings to old DLL?
    E EdgarBM

    Thank you, Stephane, but It doesn't work. I always thought this was the correct solution, but it gaves me the System.NullReferenceException exception. If you have any other idea, please let me know. Thank you, Edgar Edgar Berengena Moreno Software Engineer Appeyron Research

    C# csharp question c++ com

  • Array of strings to old DLL?
    E EdgarBM

    Thanks, ...but I can't improve anything with this! I'm trying to pass an Object[] to the library but I'm still getting the same exception. Is there anymore information or runnig sample which solves this problem?, does anyone know it?? Thank you again, Edgar Edgar Berengena Moreno Software Engineer Appeyron Research

    C# csharp question c++ com

  • Array of strings to old DLL?
    E EdgarBM

    Hi, I have an old DLL developped on VC++ 6.0. It was designed to work with VB and VC code. The problem always has been two special parameters which where an array of vaules. One was an array of doubles and the other an array of strings. It was hard, but I solved it using the SAFEARRAY structure, this way: Method (..., SAFEARRAY FAR *doubleArray, SAFEARRAY FAR *stringArray, ...) -> To call the library from VB code I only should do: Dim dbArray() as double Dim stArray() as string Redim dbArray(5) dbArray(0) = 3.4 ... 'and so to strings ->To call it from VC it was more difficult: char sMatriz[1][256/*128x2, chars doubled!*/]; strcpy (sMatriz[0], "H E L L O "); //the space represents the NULL between the string characters due to compatibility with COM ; not for doubles array LPSAFEARRAY sS = new struct tagSAFEARRAY; sS->pvData=sMatriz; sS->rgsabound->cElements = 1; //...and I passed the reference of the LPSAFEARRAY: Method (..., &sD, &sS, ...) THE PROBLEM: --------------------- Now I want this library to be used on C# or VB.NET, but I don't know the way to instantiate and pass those parameters. Any chance I get an exception like this: System.NullReferenceException Exception Details: Object reference not set to an instance of an object. I pass those parameters like: string[] sA = new string[5]; double[] dA = new double[5]; Method (..., dA, sA,...) ...and if I modify the library taking out those params (ignoring them), everything works fine. Does anyone knew how can I solve this problem? Is there any special way to pass those parameters?, anything before changing the library? I really need those params in the library! Thank you in advance, (thanks if you read all the text!) Edgar Edgar Berengena Moreno Software Engineer Appeyron Research

    C# csharp question c++ com

  • DLL Win32 types in C# ??
    E EdgarBM

    Thanks both for your fast replies. They helped a lot. Edgar Berengena Moreno Software Engineer Appeyron Research

    C# csharp question

  • DLL Win32 types in C# ??
    E EdgarBM

    Hi, does any one knows where can I find extense documentation about parameters type changing between unmanaged Win32 DLLs and NET managed code calling? ...I'm trying to call unmanaged code DLLs and I have problems of Null Reference Exceptions (in this first step, later I'll surelly have problems of type incompatibilities) Please, give me any information you can. Thank you in advance, Edgar Edgar Berengena Moreno Software Engineer Appeyron Research

    C# csharp question

  • Exception in NEt application on W98
    E EdgarBM

    Hi, thank you for your reply. I'm using API "Kernel32" the functions: WriteFile ReadFile GetLastError CloseHandle CreateEvent SetCommTimeouts GetOverlappedResult WaitForSingleObject ...but I realized that if I execute the program locally (note remotelly) it executes, although it doesn't works fine because those functions doesn't work. Do you have any idea about it? Thank you again, Edgar Edgar Berengena Moreno Software Engineer Appeyron Research

    C# help csharp c++ dotnet json
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups