
linesh
Avatar/Signature-
Posts
37 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by linesh
-
Trouble calling COM object from CSharp
linesh replied to linesh's topic in Interoperation / Office Integration
Yes i did. Currently i am trying to use "Unsafe" keyword and trying to use that to sort of replicate the c++ code. Its not giving the COMException always now, but i am still not getting the desired result. -
Trouble calling COM object from CSharp
linesh replied to linesh's topic in Interoperation / Office Integration
I would rather not write the RCW manually :) -
Trouble calling COM object from CSharp
linesh replied to linesh's topic in Interoperation / Office Integration
Another thought i have is if i would have to generate the entire RCW manually? That would be a lot more effort than i estimated initially (and would be a repeat of what tlbimp.exe does i suppose). http://msdn2.microsoft.com/en-us/library/x8fbsf00(VS.71).aspx Here are some other links that i had looked at previously: Editing An Interop Assembly: http://msdn2.microsoft.com/en-us/library/8zbc969t(vs.71).aspx -
Trouble calling COM object from CSharp
linesh replied to linesh's topic in Interoperation / Office Integration
Thanks for your response. I tried to use VS to generate the wrapper first by adding a reference to the COM dll into the csharp project. But when invoking the function it gives a COMException in the VS generated Interop. So i tried to use ildasm to create the MSIL manually then edit the MSIL after creating it by adding "preservesig" and then generate the Interop using ilasm. So to answer your question i tried both. I think csharp does not like the Int32& parameter in the function. In the actual code, this is a long * variable as you can see. But again i might be mistaken in how i am calling the wrapper that was generated. -
Trouble calling COM object from CSharp
linesh replied to linesh's topic in Interoperation / Office Integration
Should pinvoke.net be used instead? -
I have a COM object written in C++ whose class has functions that i am trying to invoke. I am able to instantiate the object and call some functions on it. However, I am stuck at calling one function which keeps giving me a COMException. Looks like it does not like the signature created in the Interop. I tried creating an IL manually from the type library dll, editing it by adding "preservesig" and readding it, but does not help. I have included the actual source, the IL equivalent and the CSharp code for it. In the original source code: HRESULT Read([in] LPUNKNOWN pPos, [in] long pBuffer, [in] long lBufferLen, [out] long * pData, [in] LPUNKNOWN pInfo) This is how it looks in IL. .method public hidebysig newslot virtual instance void Read([in] object marshal( iunknown ) pdb, [in] int32 pBuffer, [in] int32 lBufferLen, [out] int32& pData, [in] object marshal( iunknown ) pdbImg) runtime managed internalcall I think I know the iunknown objects, but i am unsure of the int32& parameter and how to call it from csharp. I tried InPtr (maybe i am using it incorrectly). Here is the CSharp code (just renamed the library names): using MyCOMLib; Int32 buffer = 0; Int32 frameData; int bufferLen = 256; MyComObj MyCOMObjInstance = new MyComObj(); MyCOMLib.MyCOMPosInfo oPosInfo = new MyCOMLib.MyCOMPosInfo(); MyCOMLib.MyCOMObjInfo oInfo = new MyCOMLib.MyCOMObjInfo(); MyCOMObjInstance.Read(oPosInfo, buffer, bufferLen, out frameData, oInfo) It keeps giving me a COMException with a certain HRESULT. Is there something with the way I am calling it in CSharp or does it need a fix in the IL? Any help or pointers would be greatly appreciated. Thanks in advance, Linesh
-
Hi, I am trying to create a custom trackbar in vb.net and wondering if there is a way to show only certain ticks whereas hide other tick marks from appearing? Either that or if there is a way to modify the color for certain ticks alone. Any pointers regarding this would be greatly appreciated. Thanks in advance! Linesh
-
Hi, I have applications in vb.net 2003 and csharp 2003 developed using .net framework 1.1. developed with regular windows xp environment. I would like to deploy them on Embedded XP platform. I know people have tried developing appications using compact framework and try installing it on regular systems and it runs fine. I am trying the opposite. I have not tried deploying it on windows xp embedded platform. Can the applications be directly deployed to the embedded platform or are there any changes that would need to be made? Are there any tools that would help make the process easier? Any pointers on this topic would be appreciated. Thanks in advance, Linesh
-
I have a native C++ (not COM) DLL that has classes in it. I would like to call it from csharp - create class objects, and invoke functions. What is the best way of approaching this. I donot have access to the source, all i have is the .h files and the dlls. I am not really very familiar with P/Invoke - is that the only option? Thanks in advance! Linesh
-
I finally found the cause of the problem. It was the "Hardware Acceleration" settings in Windows (under Display Settings). It was set to "Full". Changing it one of the medium settings stopped the flicker completely. The problem occurs more frequently on systems with the NVidia display adapters.
-
Is there any tutorial/help on using NGEN to pre-compile an assembly at installation? Here is a link from Microsoft but this is kind of confusing. http://msdn2.microsoft.com/en-us/library/3hwzzhyd(VS.80).aspx
-
Cags, Thanks for the response. No, I am not really using the OnPaint control. I will see if I can use it. I just have the function overrriden, but there is no code inside it. Same for OnPaintBackground(). //OnPaint in Overridden here so that it doesnt call paint protected override void OnPaint(PaintEventArgs pevent) { } //OnPaintBackground in Overridden here so that it doesnt call //paintbackground to clear the background protected override void OnPaintBackground(PaintEventArgs pevent) { } I do paint over the entire control. I also tried putting a picturebox into the control,setting its dock property to Fill and painting over it, but i get the same effect. You mentioned calling Graphics.Clear(). In this case, where should i try adding Graphics.Clear()?
-
Hi All, I am trying to paint a sequence of images on a usercontrol using the CSharp Graphics() object and this usercontrol is embedded in a windows forms application. The image painting part of it works fine but the screen(monitor) seems to flicker every once in a while. It looks like its being forced to refresh periodically by the application. Here is the code: Bitmap bm = new Bitmap(BMImageBuffer); GLiveGraphics.DrawImage(bm,destRect,srcRect,GraphicsUnit.Pixel); The drawing in continuously done by a drawing thread..at the rate of 10-15 FPS. I tried setting double-buffering options-it only prevented flicker inside the control but not the entire screen refresh. IS there anyway to prevent a monitor refresh()? Thanks in advance Linesh
-
Still searching, no concrete solutions found yet, more R&D required i guess.. :rolleyes:
-
I am looking to create a movie file (any format MPEG, AVI, etc) from a set of jpg files. Is there a way to achieve this in .NET? I know the JMF (Java Media Framework) has some support for this. Is there any equivalent in .net? Thanks in advance!
-
That is interesting Marble. I am very familiar with Try..Catch() blocks. I think the Finally block is similar to the Resume Next block little bit. However, one has to be sure no errors will occur inside the Finally block.
-
In VB6, there is an option "On Error goto " ..followed by "Resume Next" which is very useful to let the application continue to run and return to the very next line of code though an exception is caught. Is this possible in vb.net or c# within the "Try..Catch" construct?
-
"192 GB of Ram!!" or is it 192 MB ?. If its the former, then we are all way too short of the requirement!!
-
I also implement remove/re-add tab internally. There are a lot of controls placed on my tabs, and the removal-readd 'workaroud' does not look visually as good as it used to be in VB 6.0. Anyways, that is the only way available currently. I heard in VB 2005 (have not tried it) that the "Generated code" sections of code would be inaccessible. Is this correct?
-
Tab Control Bugs (that were not in vb 6 but are in vb 2003): 1) At design time, the tab pages get reordered automatically without any user action! For eg, in a control with 5 tab pages, the 3 would become the 4th and 4th would go 5 and so on. 2) The enabled/disabled properties for tab pages does not work. 3) The hide/show property (visible) does not work for tab pages. So one is forced to have workarounds/hacks for these bugs. "VB 2005 is bug free but it crashes". Thats not very encouraging now, is it? Linesh
-
Hi All, We all know that the VS.NET 2003 IDE and the framework had a lot of bugs (like many other languages) in it. Just wondering if there is a listing of the different issues noticed in .NET 2003 that are fixed in the 2005 release? I am more specifically looking for fixes in the TabControl (w.r.t. random tab reordering, enabling/disabling tab pages, etc.). I know there is a host of other bugs as well and would be interesting to know which ones have been fixed. Any links ?? Thanks Linesh
-
Yes there is no way to step into that piece of code. Marble you are correct. I found out a solution (workaround) for the problem. I added a Sub Main to the Main Form and then instantiated the Splash screen from the Main form. Then after showing the Splash screen for about 2 seconds, I hid that (using a timer) and then loaded the Main Form by doing an "Application.Run(MainForm). So the code looks like this: Dim frmStart as New frmSplash Dim mainFrm as New frmMain frmStart.showDialog(mainfrm) Application.Run(mainFrm) For some reason, this works! I think the error had to with how the objects on the main form get loaded and drawn. Having my own "Main Sub" instead of starting the Splash form helped. Again, the exact logic beats me, but the application runs and i no longer get the error message. Thanks a lot all for your replies guys.
-
Hi Everyone, I keep getting this exception for quite sometime and maybe someone could give me some pointers. This occurs sporadically. My application has a splash screen(form) that loads a main form. This error occurs when the main form is being loaded. The splash has a timer and after 2 seconds the main form is loaded and the splash form is hidden. The main form has some controls which are custom-drawn (tabs, buttons). It also contains some VB6 activex controls (Interop). I get the following errors one after another: An unhandled exception of type 'System.NullReferenceException' occurred in system.drawing.dll Additional information: Object reference not set to an instance of an object. An unhandled exception of type 'System.InvalidOperationException' occurred in system.drawing.dll Additional information: The object is currently in use elsewhere. Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object. at System.Drawing.SafeNativeMethods.IntGdipDisposeImage(HandleRef image) at System.Drawing.SafeNativeMethods.GdipDisposeImage(HandleRef image) at System.Drawing.Image.Dispose(Boolean disposing) at System.Drawing.Image.Finalize()The program '[2356] ZView.exe' has exited with code 0 (0x0). Has anyone seen/experienced this before? Any suggestions would be welcome. Thanks in advance, Linesh
-
No i dont do anything with the form. There are some controls such as panels, labels, buttons inside the user control itself and i play around with the Z-order for these. But why does the tooltip appear partially behind the form? Linesh
-
I have a usercontrol written in C#. The usercontrol is added to a form. There are buttons inside the usercontrol and i have set the tooltip for it. But for somereason the tooltips seem to go behind the form and only show up partially. The screenshot is attached below. Is this a bug in .NET (C#) ? Any workarounds? Thanks in advance Linesh