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
J

jimjo

@jimjo
About
Posts
4
Topics
2
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Path of current project.
    J jimjo

    Hi, Can you please specify what did you mean by 'currently open project'? Do you want to know the physical path in Visual Studio .Net? or when you are running the application? Jim Work smart, not hard ;)

    C# csharp question

  • Add help text to custom functions in Excel
    J jimjo

    Hi gurus, I have an automation add-in created using C# for Excel, in which I am exposing a number of functions. Is there any way I can add help-text the way excel does for other categories like Financial, Statistical, etc. The place I want my help-text to be available is in the Insert->Function. Here, we can select a category and function. The corresponding help text is displayed. Now, my automation add-in is also listed in this categories. I want help text to be displayed when a user selects my add-in and functions in it. I tried the MacroOptions method, but it is raising an exception. This is the code I tried (I tried both early binding and late binding): early binding: code: _excelApplication.MacroOptions("Report_Alloc", "custom description", Missing.Value, Missing.Value, Missing.Value, Missing.Value, "Report.Report", Missing.Value, Missing.Value, Missing.Value); Exception Message: "Exception from HRESULT: 0x800A03EC." StackTrace " at Microsoft.Office.Interop.Excel._Application.MacroOptions(Object Macro, Object Description, Object HasMenu, Object MenuText, Object HasShortcutKey, Object ShortcutKey, Object Category, Object StatusBar, Object HelpContextID, Object HelpFile)\r\n at ....... late binding: code: object[] parameters = new object[10]; parameters[0] = "Report_Alloc"; parameters[1] = "Some sample description..."; parameters[2] = Missing.Value; parameters[3] = Missing.Value; parameters[4] = Missing.Value; parameters[5] = Missing.Value; parameters[6] = "Report.Report"; parameters[7] = Missing.Value; parameters[8] = Missing.Value; parameters[9] = Missing.Value; _excelApplication.GetType().InvokeMember("MacroOptions", BindingFlags.InvokeMethod | BindingFlags.Public | BindingFlags.Instance, null, _excelApplication, parameters, new System.Globalization.CultureInfo("en-US")); Exception Message: "Exception has been thrown by the target of an invocation." StackTrace " at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters)\r\n at System.RuntimeType.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParameters)\r\n at ...... Inner Exception Message: "MacroOptions method of Application class failed" Any help would be appreciated..... Jim

    C# csharp wpf wcf com testing

  • I get an error when my textbox has texts with html tags
    J jimjo

    Hi, When browser back button is clicked, no new request is sent to browser, I think(unless we expire the page programmatically). Most probably, you have written a Response.Redirect in your asp button click, right? So, the html code gets posted to the server and server generates the error. You can either call History.Back(or something like that in javascript) in your button click or you can set ValidateRequest = "True" Regards, Jim

    C# help csharp html question

  • PInvoke issue
    J jimjo

    am porting a vb library to vb.net. The vb library has an external call to an unmanaged dll. Existing code: //External function declaration Private Declare Function Uncompress& Lib "COMPR.DLL" (ByVal SrcSt$, ByVal SrcLen&, Dest As Any, ByVal DestLen&) //Invocation of external function lReturn = Uncompress(sCompressedResult, Len(sCompressedResult), aResults(ARRAY_START), ByVal lNewLength) [where aResults is a double array. The COMPR.Uncompress function basically uncompress a string 'sCompressedResult' and fills the array aResults. The array is initialized before calling the external function] My understanding is that( Please correct me if I am wrong): a. The third parameter in declaration 'Dest as Any' means a parameter of variant type. b. At invocation, the first element of the double array is passed. i.e., a pointer to the first element in the double array is passed to the external function. c. The Uncompress function expands the compressed data, fills/replaces the double array with values. d. The changed values are available to the caller after the Uncompress function has returned. Now, I have to call the COMPR.Uncompress method from Vb.Net. >From browsing the net, I got a lot of information regarding this( Please correct me if I am wrong): a. We have to mark the parameter as InAttribute(), Out(). b. We should pin the object so that GC does not change address. c. We should pass a pointer TO THE FIRST OBJECT OF THE ARRAY to the native function. d. Array of type double is non-blittable and so we have to do the marshaling. This is the code I wrote: //External method declaration _ Public Shared Function UnCompress(ByVal compressedResult As String, ByVal length As Long, ByRef destinationArrayElement As Object, ByVal newLength As Long) As Long End Function //Invocation 'Pin the object Dim resultsHandle As GCHandle resultsHandle = GCHandle.Alloc(aResults(ARRAY_START), GCHandleType.Pinned) Dim resultsPointer As IntPtr = resultsHandle.AddrOfPinnedObject() 'Invoke returnValue = UnCompress(sCompressedResult, Len(sCompressedResult), resultsPointer, newLength) My problem is that I get the return value correctly, but the array does not get changed....I

    Visual Basic help csharp c++ data-structures
  • Login

  • Don't have an account? Register

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