Search Results

Search found 237 results on 10 pages for 'interopservices'.

Page 1/10 | 1 2 3 4 5 6 7 8 9 10  | Next Page >

  • Please help with System.Runtime.InteropServices.SEHException: External component has thrown an excep

    - by Brandon
    My aspx page gives me this error sometimes: External component has thrown an exception. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Runtime.InteropServices.SEHException: External component has thrown an exception. Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [SEHException (0x80004005): External component has thrown an exception.] Luxand.FSDK.Initialize(String DataFilesPath) +0 WebService.onLoad() +70 WebService..ctor() +91 facematch.Page_Load(Object sender, EventArgs e) +50 System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +33 System.Web.UI.Control.OnLoad(EventArgs e) +99 System.Web.UI.Control.LoadRecursive() +47 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1436

    Read the article

  • vb.net A first chance exception of type 'System.Runtime.InteropServices.COMException' occurred in ms

    - by prasoon99
    I just installed Visual Basic 2010 Express. I created a simple console application: Module Module1 Sub Main() Dim i As Integer i = 0 End Sub End Module I'm getting the following error SIX times before I get to line "i = 0": A first chance exception of type 'System.Runtime.InteropServices.COMException' occurred in mscorlib.dll Can anyone help? Why is this happening? Is there something wrong with my configuration? -Prasoon

    Read the article

  • What is the safest way to subtract two System.Runtime.InteropServices.ComTypes.FILETIME objects

    - by Anindya Chatterjee
    I wonder what is the safest way to subtract two System.Runtime.InteropServices.ComTypes.FILETIME objects? I used the following code but sometimes it gives me ArithmaticOverflow exception due to the negative number in Low 32-bit values. I am not sure enclosing the body with unchecked will serve the purpose or not. Please give me some suggestion on how to do it safely without getting any runtime exception or CS0675 warning message. private static UInt64 SubtractTimes(FILETIME a, FILETIME b) { UInt64 aInt = ((UInt64)(a.dwHighDateTime << 32)) | (UInt32)a.dwLowDateTime; UInt64 bInt = ((UInt64)(b.dwHighDateTime << 32)) | (UInt32)b.dwLowDateTime; return aInt - bInt; }

    Read the article

  • System.Runtime.InteropServices.COMException (0x80070008): Not enough storage is available to process

    - by Darryl Braaten
    I am trying to diagnose this exception. "System.Runtime.InteropServices.COMException (0x80070008): Not enough storage is available to process this command. (Exception from HRESULT: 0x80070008) at System.Runtime.Remoting.RemotingServices.AllocateUninitializedObject(RuntimeType objectType) at System.Runtime.Remoting.RemotingServices.AllocateUninitializedObject(Type objectType) at System.Runtime.Remoting.Activation.ActivationServices.CreateInstance(Type serverType) at System.Runtime.Remoting.Activation.ActivationServices.IsCurrentContextOK(Type serverType, Object[] props, Boolean bNewObj) at Oracle.DataAccess.Client.CThreadPool..ctor() at Oracle.DataAccess.Client.OracleCommand.set_CommandTimeout(Int32 value) ... It does not look like any of the normal types of "storage" have hit any limits. The application is using about 400MB of memory, 70 threads, 2000 handles and the hard drive has many GB free. The machine is running Windows 2003 Enterprise server with 16GB of RAM so memory shouldn't be an issue. The application is running as a windows service so there are no GDI objects being used. Running out of GDI handles is a common cause of this exception. Database connections, commands & readers are all all wrapped with using blocks so they should be getting cleaned up correctly.

    Read the article

  • Getting Error System.Runtime.InteropServices.COMException

    - by Savan Parmar
    Hey All, I am using Vb.Net to Create Labels in Microsoft. For that i am using below mantioend Code. Public Sub CreateLabel(ByVal StrFilter As String, ByVal Path As String) WordApp = CreateObject("Word.Application") ''Add a new document. WordDoc = WordApp.Documents.Add() Dim oConn As SqlConnection = New SqlConnection(connSTR) oConn.Open() Dim oCmd As SqlCommand Dim oDR As SqlDataReader oCmd = New SqlCommand(StrFilter, oConn) oDR = oCmd.ExecuteReader Dim intI As Integer Dim FilePath As String = "" With WordDoc.MailMerge With .Fields Do While oDR.Read For intI = 0 To oDR.FieldCount - 1 .Add(WordApp.Selection.Range, oDR.Item(intI)) Next Loop End With Dim objAutoText As Word.AutoTextEntry = WordApp.NormalTemplate.AutoTextEntries.Add("MyLabelLayout", WordDoc.Content) WordDoc.Content.Delete() .MainDocumentType = Word.WdMailMergeMainDocType.wdMailingLabels FilePath = CreateSource(StrFilter) .OpenDataSource(FilePath) Dim NewLabel As Word.CustomLabel = WordApp.MailingLabel.CustomLabels.Add("MyLabel", False) WordApp.MailingLabel.CreateNewDocument(Name:="MyLabel", Address:="", AutoText:="MyLabelLayout") objAutoText.Delete() .Destination = Word.WdMailMergeDestination.wdSendToNewDocument WordApp.Visible = True .Execute() End With oConn.Close() WordDoc.Close() End Sub Private Function CreateSource(ByVal StrFilter As String) As String Dim CnnUser As SqlConnection = New SqlConnection(connSTR) Dim sw As StreamWriter = File.CreateText("C:\Mail.Txt") Dim Path As String = "C:\Mail.Txt" Dim StrHeader As String = "" Try Dim SelectCMD As SqlCommand = New SqlCommand(StrFilter, CnnUser) Dim oDR As SqlDataReader Dim IntI As Integer SelectCMD.CommandType = CommandType.Text CnnUser.Open() oDR = SelectCMD.ExecuteReader For IntI = 0 To oDR.FieldCount - 1 StrHeader &= oDR.GetName(IntI) & " ," Next StrHeader = Mid(StrHeader, 1, Len(StrHeader) - 2) sw.WriteLine(StrHeader) sw.Flush() sw.Close() StrHeader = "" Do While oDR.Read For IntJ As Integer = 0 To oDR.FieldCount - 1 StrHeader &= oDR.GetString(IntJ) & " ," Next Loop StrHeader = Mid(StrHeader, 1, Len(StrHeader) - 2) sw = File.AppendText(Path) sw.WriteLine(StrHeader) CnnUser.Close() sw.Flush() sw.Close() Catch ex As Exception MessageBox.Show(ex.Message, "TempID", MessageBoxButtons.OK, MessageBoxIcon.Error) End Try Return Path End Function Now when i am running the programm i am getting this error.I tried hard but not able to locate what could be the problem the error is:- System.Runtime.InteropServices.COMException --Horizontal and vertical pitch must be greater than or equal to the label width and height, respectively. Even though i tried to set the Horizontal and vertical pitch programatically but it gives same err. Plz if any one can help

    Read the article

  • InteropServices COMException when executing a .net app from a web CGI script on Windows Server 2003

    - by Kurt W. Leucht
    Disclaimer: I'm completely clueless about .net and COM. I have a vendor's application that appears to be written in .net and I'm trying to wrap it with a web form (a cgi-bin Perl script) so I can eventually launch this vendor's app from a separate computer. I'm on a Windows Server 2003 R2 SE SP1 system and I'm using Apache 2.2 for the web server and ActivePerl 5.10.0.1004 for the cgi script. My cgi script calls the vendor's app that resides on the same machine using the Perl backtick operator. ... $result = "Result: " . `$vendorsPath/$vendorsExecutable $arg1 $arg2`; ... Right now I'm just running IE web browser locally on the server machine and accessing "http://localhost/cgi-bin/myPerlScript.pl". The vendor's app fails and logs a debug message that includes the following stack trace (I changed a couple names so as to not give away the vendor's identity): ... System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException (0x80043A1D): 0x80040154 - Class not registered --- End of inner exception stack trace --- at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters) at System.RuntimeType.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParameters) at VendorsTool.Engine.Core.VendorsEngine.LoadVendorsServices(String fileName, String& projectCommPath) ... When I run the vendors app from the Windows command line on the server machine with the exact same arguments that the cgi script is passing it runs just fine, so there's something about invoking their app via the web script that is causing a problem. This problem is likely security related because the whole thing runs just fine on a Windows XP Pro machine (both command line and web invocation). I actually developed my web script there and got it completely working there before I tried moving it to the Windows Server 2003 machine. So what's different about the Windows Server 2003 machine that would keep the vendor's .net app from being executed successfully by a web cgi script? Can I fix this problem somehow to make it work on my server or will the vendor have to make a change to their .net app and ship out a new version? I'm probably the only person in the world who is trying to execute this vendor's app from a separate program, so I hate to bother the vendor with the issue if there's a workaround that I can implement myself here on my server machine. Plus, I'm in kind of a hurry and I don't want to wait 4 or 6 months for the vendor to put in a fix and deploy a new version. Thanks for any advise you can give.

    Read the article

  • SharePoint: what does "System.Runtime.InteropServices.COMException (0x81071003)" mean?

    - by kpinhack
    Hallo, i've got some code that imports documents into a SharePoint (WSS 3.0 SP1) document-library. That code works most of the time without any problems, but sometimes the document is not imported into the document-library and i get this nasty exception instead. Microsoft.SharePoint.SPException: Unable to update the information in the Microsoft Office document myFileName. ---> System.Runtime.InteropServices.COMException (0x81071003): Unable to update the information in the Microsoft Office document myFileName. bei Microsoft.SharePoint.Library.SPRequestInternalClass.AddOrUpdateItem(String bstrUrl, String bstrListName, Boolean bAdd, Boolean bSystemUpdate, Boolean bPreserveItemVersion, Boolean bUpdateNoVersion, Int32& plID, String& pbstrGuid, Guid pbstrNewDocId, Boolean bHasNewDocId, String bstrVersion, Object& pvarAttachmentNames, Object& pvarAttachmentContents, Object& pvarProperties, Boolean bCheckOut, Boolean bCheckin, Boolean bMigration, Boolean bPublish) bei Microsoft.SharePoint.Library.SPRequest.AddOrUpdateItem(String bstrUrl, String bstrListName, Boolean bAdd, Boolean bSystemUpdate, Boolean bPreserveItemVersion, Boolean bUpdateNoVersion, Int32& plID, String& pbstrGuid, Guid pbstrNewDocId, Boolean bHasNewDocId, String bstrVersion, Object& pvarAttachmentNames, Object& pvarAttachmentContents, Object& pvarProperties, Boolean bCheckOut, Boolean bCheckin, Boolean bMigration, Boolean bPublish) What does this exception mean? And why does it occur only sometimes? Thanks!

    Read the article

  • convert a class to byte array + C#

    - by Newbie
    How can I convert a Class to byte array in C#. This is a managed one so the following code is failing int objsize = System.Runtime.InteropServices.Marshal.SizeOf(objTimeSeries3D); byte[] arr = new byte[objsize]; IntPtr buff = System.Runtime.InteropServices.Marshal.AllocHGlobal(objsize); System.Runtime.InteropServices.Marshal.StructureToPtr(objTimeSeries3D, buff, true); System.Runtime.InteropServices.Marshal.Copy(buff, arr, 0, objsize); System.Runtime.InteropServices.Marshal.FreeHGlobal(buff); Thanks

    Read the article

  • How to start new browser window in cpecified location whith cpecified size

    - by Pritorian
    Hi all! I create a new instance and trying to resize new instance of browser like this: [System.Runtime.InteropServices.DllImport("user32.dll")] private static extern bool GetWindowInfo(IntPtr hwnd, ref tagWINDOWINFO pwi); [System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential)] public struct tagRECT { /// LONG->int public int left; /// LONG->int public int top; /// LONG->int public int right; /// LONG->int public int bottom; } [System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential)] public struct tagWINDOWINFO { /// DWORD->unsigned int public uint cbSize; /// RECT->tagRECT public tagRECT rcWindow; /// RECT->tagRECT public tagRECT rcClient; /// DWORD->unsigned int public uint dwStyle; /// DWORD->unsigned int public uint dwExStyle; /// DWORD->unsigned int public uint dwWindowStatus; /// UINT->unsigned int public uint cxWindowBorders; /// UINT->unsigned int public uint cyWindowBorders; /// ATOM->WORD->unsigned short public ushort atomWindowType; /// WORD->unsigned short public ushort wCreatorVersion; } [System.Runtime.InteropServices.DllImport("user32.dll")] private static extern bool MoveWindow(IntPtr hWnd, int X, int Y, int nWidth, int nHeight, bool bRepaint); [System.Runtime.InteropServices.DllImport("user32.dll")] private static extern bool UpdateWindow(IntPtr hWnd); private void button2_Click(object sender, EventArgs e) { using (System.Diagnostics.Process browserProc = new System.Diagnostics.Process()) { browserProc.StartInfo.FileName = webBrowser1.Url.ToString(); browserProc.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Minimized; int i= browserProc.Id; tagWINDOWINFO info = new tagWINDOWINFO(); info.cbSize = (uint)System.Runtime.InteropServices.Marshal.SizeOf(info); browserProc.Start(); GetWindowInfo(browserProc.MainWindowHandle, ref info); browserProc.WaitForInputIdle(); string str = browserProc.MainWindowTitle; MoveWindow(browserProc.MainWindowHandle, 100, 100, 100, 100, true); UpdateWindow(browserProc.MainWindowHandle); } } But I get an "No process is associated with this object". Could anyone help? Or mb other ideas how to run new browser window whith specified size and location?

    Read the article

  • Calling from C# to C function which accept a struct array allocated by caller

    - by lifey
    I have the following C struct struct XYZ { void *a; char fn[MAX_FN]; unsigned long l; unsigned long o; }; And I want to call the following function from C#: extern "C" int func(int handle, int *numEntries, XYZ *xyzTbl); Where xyzTbl is an array of XYZ of size numEntires which is allocated by the caller I have defined the following C# struct: [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential, CharSet = System.Runtime.InteropServices.CharSet.Ansi)] public struct XYZ { public System.IntPtr rva; [System.Runtime.InteropServices.MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.ByValTStr, SizeConst = 128)] public string fn; public uint l; public uint o; } and a method: [System.Runtime.InteropServices.DllImport(@"xyzdll.dll", CallingConvention = CallingConvention.Cdecl)] public static extern Int32 func(Int32 handle, ref Int32 numntries, [MarshalAs(UnmanagedType.LPArray)] XYZ[] arr); Then I try to call the function : XYZ xyz = new XYZ[numEntries]; for (...) xyz[i] = new XYZ(); func(handle,numEntries,xyz); Of course it does not work. Can someone shed light on what I am doing wrong ?

    Read the article

  • vb.net system beep sound on XP

    - by Toby
    Is it possible to have a vb.net program sound the PC's internal speaker? you know the one that produces C's \a BELL I have tried beep(), but this only produces the error sound on the sound card. I have also tried <Runtime.InteropServices.DllImport("KERNEL32.DLL", EntryPoint:="Beep", SetLastError:=True, _ CharSet:=Runtime.InteropServices.CharSet.Unicode, ExactSpelling:=True, _ CallingConvention:=Runtime.InteropServices.CallingConvention.StdCall)> _ Public Shared Function _ aBeep(ByVal dwFreq As Integer, ByVal dwDuration As Integer) _ As Boolean End Function With no joy apparently its only good on vista and above Any suggestions? thanks

    Read the article

  • Drag and Drop to explorer causing invalid FORMATETC (DV_E_FORMATETC) error

    - by JustABill
    I'm trying to use this excellent example to implement dropping virtual files into Windows Explorer. However, I'm stymied by this error. Towards the bottom, inside void System.Runtime.InteropServices.ComTypes.IDataObject.GetData(ref System.Runtime.InteropServices.ComTypes.FORMATETC formatetc, out System.Runtime.InteropServices.ComTypes.STGMEDIUM medium) on the first call to ((System.Runtime.InteropServices.ComTypes.IDataObject)this).GetDataHere(ref formatetc, ref medium); I'm getting back a DV_E_FORMATETC error. As far as I can tell, all the elements of the FORMATETC struct that are being passed in are valid: cfFormat is "Shell IDList Array" (-16141), ptd is 0, dwAspect is DVASPECT_CONTENT, lindex is -1, and tymed is TYMED_HGLOBAL. I'm kind of confused how there'd be a problem anyway, since this was generated by explorer. I know very little about COM interaction, so any help would be greatly appreciated.

    Read the article

  • Releasing Excel after using Interop

    - by figus
    Hi everyone I've read many post looking for my answer, but all are similar to this: http://stackoverflow.com/questions/1610743/reading-excel-files-in-vb-net-leaves-excel-process-hanging My problem is that I don't quit the app... The idea is this: If a User has Excel Open, if he has the file I'm interested in open... get that Excel instance and do whatever I want to do... But I don't to close his File after I'm done... I want him to keep working on it, the problem is that when he closes Excel... The process keeps running... and running... and running after the user closes Excel with the X button... this is how I try to do it This piece is used to know if he has Excel open, and in the For I check for the file name I'm interested in. Try oApp = GetObject(, "Excel.Application") libroAbierto = True For Each libro As Microsoft.Office.Interop.Excel.Workbook In oApp.Workbooks If libro.Name = EquipoASeccionIdSeccion.Text & ".xlsm" Then Exit Try End If Next libroAbierto = False Catch ex As Exception oApp = New Microsoft.Office.Interop.Excel.Application End Try here would be my code... if he hasn't Excel open, I create a new instance, open the file and everything else. My code ends with this: If Not libroAbierto Then libroSeccion.Close(SaveChanges:=True) oApp.Quit() Else oApp.UserControl = True libroSeccion.Save() End If System.Runtime.InteropServices.Marshal.FinalReleaseComObject(libroOriginal) System.Runtime.InteropServices.Marshal.FinalReleaseComObject(libroSeccion) System.Runtime.InteropServices.Marshal.FinalReleaseComObject(origen) System.Runtime.InteropServices.Marshal.FinalReleaseComObject(copiada) System.Runtime.InteropServices.Marshal.FinalReleaseComObject(oApp) libroOriginal = Nothing libroSeccion = Nothing oApp = Nothing origen = Nothing copiada = Nothing nuevosGuardados = True So you can see that, if I opened the file, I call oApp.Quit() and everything else and the Excel Process ends after a few seconds (maybe 5 aprox.) BUT if I mean the user to keep the file open (not calling Quit()), Excel process keeps running after the user closes Excel with the X button. Is there any way to do what I try to do?? Control a open instance of excel and releasing everything so when the user closes it with the X button, the Excel Process dies normally??? Thanks!!!

    Read the article

  • How can I get the palette of an 8-bit surface in SDL.NET/Tao.SDL?

    - by lolmaster
    I'm looking to get the palette of an 8-bit surface in SDL.NET if possible, or (more than likely) using Tao.SDL. This is because I want to do palette swapping with the palette directly, instead of blitting surfaces together to replace colours like how you would do it with a 32-bit surface. I've gotten the SDL_Surface and the SDL_PixelFormat, however when I go to get the palette in the same way, I get a System.ExecutionEngineException: private Tao.Sdl.Sdl.SDL_Palette GetPalette(Surface surf) { // Get surface. Tao.Sdl.Sdl.SDL_Surface sdlSurface = (Tao.Sdl.Sdl.SDL_Surface)System.Runtime.InteropServices.Marshal.PtrToStructure(surf.Handle, typeof(Tao.Sdl.Sdl.SDL_Surface)); // Get pixel format. Tao.Sdl.Sdl.SDL_PixelFormat pixelFormat = (Tao.Sdl.Sdl.SDL_PixelFormat)System.Runtime.InteropServices.Marshal.PtrToStructure(sdlSurface.format, typeof(Tao.Sdl.Sdl.SDL_PixelFormat)); // Execution exception here. Tao.Sdl.Sdl.SDL_Palette palette = (Tao.Sdl.Sdl.SDL_Palette)System.Runtime.InteropServices.Marshal.PtrToStructure(pixelFormat.palette, typeof(Tao.Sdl.Sdl.SDL_Palette)); return palette; } When I used unsafe code to get the palette, I got a compile time error: "Cannot take the address of, get the size of, or declare a pointer to a managed type ('Tao.Sdl.Sdl.SDL_Palette')". My unsafe code to get the palette was this: unsafe { Tao.Sdl.Sdl.SDL_Palette* pal = (Tao.Sdl.Sdl.SDL_Palette*)pixelFormat.palette; } From what I've read, a managed type in this case is when a structure has some sort of reference inside it as a field. The SDL_Palette structure happens to have an array of SDL_Color's, so I'm assuming that's the reference type that is causing issues. However I'm still not sure how to work around that to get the underlying palette. So if anyone knows how to get the palette from an 8-bit surface, whether it's through safe or unsafe code, the help would be greatly appreciated.

    Read the article

  • asp.net C# Webcam api error

    - by Eyla
    Greeting, I'm tring to use webcam api with asp.net and C#. I included all the library and reverince I needed for that. the original code I'm use was for windows application and I'm trying to convert it to asp.net web application. I have start capturing button when I click it, it should start capturing but it gives me an error. the error at this line: hHwnd = capCreateCaptureWindowA(iDevice.ToString(), (WS_VISIBLE | WS_CHILD), 0, 0, 640, 480, picCapture.Handle.ToInt32(), 0); and the error message is: Error 1 'System.Web.UI.WebControls.Image' does not contain a definition for 'Handle' and no extension method 'Handle' accepting a first argument of type 'System.Web.UI.WebControls.Image' could be found (are you missing a using directive or an assembly reference?) C:\Users\Ali\Documents\Visual Studio 2008\Projects\Conference\Conference\Conference1.aspx.cs 63 117 Conference Please advice!! ................................................ here is the complete code ........................................... using System; using System.Collections; using System.Drawing; using System.ComponentModel; using System.Windows.Forms; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; using System.Runtime.InteropServices; using System.Drawing.Imaging; using System.Net; using System.Net.Sockets; using System.Threading; using System.IO; namespace Conference { public partial class Conference1 : System.Web.UI.Page { #region WebCam API const short WM_CAP = 1024; const int WM_CAP_DRIVER_CONNECT = WM_CAP + 10; const int WM_CAP_DRIVER_DISCONNECT = WM_CAP + 11; const int WM_CAP_EDIT_COPY = WM_CAP + 30; const int WM_CAP_SET_PREVIEW = WM_CAP + 50; const int WM_CAP_SET_PREVIEWRATE = WM_CAP + 52; const int WM_CAP_SET_SCALE = WM_CAP + 53; const int WS_CHILD = 1073741824; const int WS_VISIBLE = 268435456; const short SWP_NOMOVE = 2; const short SWP_NOSIZE = 1; const short SWP_NOZORDER = 4; const short HWND_BOTTOM = 1; int iDevice = 0; int hHwnd; [System.Runtime.InteropServices.DllImport("user32", EntryPoint = "SendMessageA")] static extern int SendMessage(int hwnd, int wMsg, int wParam, [MarshalAs(UnmanagedType.AsAny)] object lParam); [System.Runtime.InteropServices.DllImport("user32", EntryPoint = "SetWindowPos")] static extern int SetWindowPos(int hwnd, int hWndInsertAfter, int x, int y, int cx, int cy, int wFlags); [System.Runtime.InteropServices.DllImport("user32")] static extern bool DestroyWindow(int hndw); [System.Runtime.InteropServices.DllImport("avicap32.dll")] static extern int capCreateCaptureWindowA(string lpszWindowName, int dwStyle, int x, int y, int nWidth, short nHeight, int hWndParent, int nID); [System.Runtime.InteropServices.DllImport("avicap32.dll")] static extern bool capGetDriverDescriptionA(short wDriver, string lpszName, int cbName, string lpszVer, int cbVer); private void OpenPreviewWindow() { int iHeight = 320; int iWidth = 200; // // Open Preview window in picturebox // hHwnd = capCreateCaptureWindowA(iDevice.ToString(), (WS_VISIBLE | WS_CHILD), 0, 0, 640, 480, picCapture.Handle.ToInt32(), 0); // // Connect to device // if (SendMessage(hHwnd, WM_CAP_DRIVER_CONNECT, iDevice, 0) == 1) { // // Set the preview scale // SendMessage(hHwnd, WM_CAP_SET_SCALE, 1, 0); // // Set the preview rate in milliseconds // SendMessage(hHwnd, WM_CAP_SET_PREVIEWRATE, 66, 0); // // Start previewing the image from the camera // SendMessage(hHwnd, WM_CAP_SET_PREVIEW, 1, 0); // // Resize window to fit in picturebox // SetWindowPos(hHwnd, HWND_BOTTOM, 0, 0, iWidth, iHeight, (SWP_NOMOVE | SWP_NOZORDER)); } else { // // Error connecting to device close window // DestroyWindow(hHwnd); } } private void ClosePreviewWindow() { // // Disconnect from device // SendMessage(hHwnd, WM_CAP_DRIVER_DISCONNECT, iDevice, 0); // // close window // DestroyWindow(hHwnd); } #endregion protected void Page_Load(object sender, EventArgs e) { } protected void btnStart_Click(object sender, EventArgs e) { int iDevice = int.Parse(device_number_textBox.Text); OpenPreviewWindow(); } } }

    Read the article

  • Webcam api error when accessed from ASP.NET Server-side code

    - by Eyla
    I'm tring to use webcam api with asp.net and C#. I included all the library and references I needed for that. the original code I'm use was for windows application and I'm trying to convert it to asp.net web application. I have start capturing button when I click it, it should start capturing but it gives me an error. the error at this line: hHwnd = capCreateCaptureWindowA(iDevice.ToString(), (WS_VISIBLE | WS_CHILD), 0, 0, 640, 480, picCapture.Handle.ToInt32(), 0); and the error message is: Error 1 'System.Web.UI.WebControls.Image' does not contain a definition for 'Handle' and no extension method 'Handle' accepting a first argument of type 'System.Web.UI.WebControls.Image' could be found (are you missing a using directive or an assembly reference?) C:\Users\Ali\Documents\Visual Studio 2008\Projects\Conference\Conference\Conference1.aspx.cs 63 117 Conference Please advice!! ................................................ here is the complete code ........................................... using System; using System.Collections; using System.Drawing; using System.ComponentModel; using System.Windows.Forms; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; using System.Runtime.InteropServices; using System.Drawing.Imaging; using System.Net; using System.Net.Sockets; using System.Threading; using System.IO; namespace Conference { public partial class Conference1 : System.Web.UI.Page { #region WebCam API const short WM_CAP = 1024; const int WM_CAP_DRIVER_CONNECT = WM_CAP + 10; const int WM_CAP_DRIVER_DISCONNECT = WM_CAP + 11; const int WM_CAP_EDIT_COPY = WM_CAP + 30; const int WM_CAP_SET_PREVIEW = WM_CAP + 50; const int WM_CAP_SET_PREVIEWRATE = WM_CAP + 52; const int WM_CAP_SET_SCALE = WM_CAP + 53; const int WS_CHILD = 1073741824; const int WS_VISIBLE = 268435456; const short SWP_NOMOVE = 2; const short SWP_NOSIZE = 1; const short SWP_NOZORDER = 4; const short HWND_BOTTOM = 1; int iDevice = 0; int hHwnd; [System.Runtime.InteropServices.DllImport("user32", EntryPoint = "SendMessageA")] static extern int SendMessage(int hwnd, int wMsg, int wParam, [MarshalAs(UnmanagedType.AsAny)] object lParam); [System.Runtime.InteropServices.DllImport("user32", EntryPoint = "SetWindowPos")] static extern int SetWindowPos(int hwnd, int hWndInsertAfter, int x, int y, int cx, int cy, int wFlags); [System.Runtime.InteropServices.DllImport("user32")] static extern bool DestroyWindow(int hndw); [System.Runtime.InteropServices.DllImport("avicap32.dll")] static extern int capCreateCaptureWindowA(string lpszWindowName, int dwStyle, int x, int y, int nWidth, short nHeight, int hWndParent, int nID); [System.Runtime.InteropServices.DllImport("avicap32.dll")] static extern bool capGetDriverDescriptionA(short wDriver, string lpszName, int cbName, string lpszVer, int cbVer); private void OpenPreviewWindow() { int iHeight = 320; int iWidth = 200; // // Open Preview window in picturebox // hHwnd = capCreateCaptureWindowA(iDevice.ToString(), (WS_VISIBLE | WS_CHILD), 0, 0, 640, 480, picCapture.Handle.ToInt32(), 0); // // Connect to device // if (SendMessage(hHwnd, WM_CAP_DRIVER_CONNECT, iDevice, 0) == 1) { // // Set the preview scale // SendMessage(hHwnd, WM_CAP_SET_SCALE, 1, 0); // // Set the preview rate in milliseconds // SendMessage(hHwnd, WM_CAP_SET_PREVIEWRATE, 66, 0); // // Start previewing the image from the camera // SendMessage(hHwnd, WM_CAP_SET_PREVIEW, 1, 0); // // Resize window to fit in picturebox // SetWindowPos(hHwnd, HWND_BOTTOM, 0, 0, iWidth, iHeight, (SWP_NOMOVE | SWP_NOZORDER)); } else { // // Error connecting to device close window // DestroyWindow(hHwnd); } } private void ClosePreviewWindow() { // // Disconnect from device // SendMessage(hHwnd, WM_CAP_DRIVER_DISCONNECT, iDevice, 0); // // close window // DestroyWindow(hHwnd); } #endregion protected void Page_Load(object sender, EventArgs e) { } protected void btnStart_Click(object sender, EventArgs e) { int iDevice = int.Parse(device_number_textBox.Text); OpenPreviewWindow(); } } }

    Read the article

  • .NET Framework generates strange DCOM error

    - by Anders Oestergaard Jensen
    Hello, I am creating a simple application that enables merging of key-value pairs fields in a Word and/or Excel document. Until this day, the application has worked out just fine. I am using the latest version of .NET Framework 4.0 (since it provides a nice wrapper API for Interop). My sample merging method looks like this: public byte[] ProcessWordDocument(string path, List<KeyValuePair<string, string>> kvs) { logger.InfoFormat("ProcessWordDocument: path = {0}", path); var localWordapp = new Word.Application(); localWordapp.Visible = false; Word.Document doc = null; try { doc = localWordapp.Documents.Open(path, ReadOnly: false); logger.Debug("Executing Find->Replace..."); foreach (Word.Range r in doc.StoryRanges) { foreach (KeyValuePair<string, string> kv in kvs) { r.Find.Execute(Replace: Word.WdReplace.wdReplaceAll, FindText: kv.Key, ReplaceWith: kv.Value, Wrap: Word.WdFindWrap.wdFindContinue); } } logger.Debug("Done! Saving document and cleaning up"); doc.Save(); doc.Close(); System.Runtime.InteropServices.Marshal.ReleaseComObject(doc); localWordapp.Quit(); System.Runtime.InteropServices.Marshal.ReleaseComObject(localWordapp); logger.Debug("Done."); return System.IO.File.ReadAllBytes(path); } catch (Exception ex) { // Logging... // doc.Close(); if (doc != null) { doc.Close(); System.Runtime.InteropServices.Marshal.ReleaseComObject(doc); } localWordapp.Quit(); System.Runtime.InteropServices.Marshal.ReleaseComObject(localWordapp); throw; } } The above C# snippet has worked all fine (compiled and deployed unto a Windows Server 2008 x64) with latest updates installed. But now, suddenly, I get the following strange error: System.Runtime.InteropServices.COMException (0x80080005): Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE)). at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache) at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache) at System.Activator.CreateInstance(Type type, Boolean nonPublic) at Meeho.Integration.OfficeHelper.ProcessWordDocument(String path, List`1 kvs) in C:\meeho\src\webservices\Meeho.Integration\OfficeHelper.cs:line 30 at Meeho.IntegrationService.ConvertDocument(Byte[] template, String ext, String[] fields, String[] values) in C:\meeho\src\webservices\MeehoService\IntegrationService.asmx.cs:line 49 -- I googled the COM error, but it returns nothing of particular value. I even gave the right permissions for the COM dll's using mmc -32, where I allocated the Word and Excel documents respectively and set the execution rights to the Administrator. I could not, however, locate the dll's by the exact COM CLSID given above. Very frustrating. Please, please, please help me as the application is currently pulled out of production. Anders EDIT: output from the Windows event log: Faulting application name: WINWORD.EXE, version: 12.0.6514.5000, time stamp: 0x4a89d533 Faulting module name: unknown, version: 0.0.0.0, time stamp: 0x00000000 Exception code: 0xc0000005 Fault offset: 0x00000000 Faulting process id: 0x720 Faulting application start time: 0x01cac571c4f82a7b Faulting application path: C:\Program Files (x86)\Microsoft Office\Office12\WINWORD.EXE Faulting module path: unknown Report Id: 041dd5f9-3165-11df-b96a-0025643cefe6 - 1000 2 100 0x80000000000000 2963 Application meeho3 - WINWORD.EXE 12.0.6514.5000 4a89d533 unknown 0.0.0.0 00000000 c0000005 00000000 720 01cac571c4f82a7b C:\Program Files (x86)\Microsoft Office\Office12\WINWORD.EXE unknown 041dd5f9-3165-11df-b96a-0025643cefe6

    Read the article

  • MODI leaking memory

    - by Khragg
    I have an app where I'm using MODI 2007 to OCR several multi-page tiff files. I have found that when I kick it off on a directory that contains several good tiffs but also some tiffs that cannot be opened in Windows Picture and Fax Viewer, then MODI also fails to OCR those "bad" tiffs. When this happens, the app is unable to reclaim any of the memory that was used by MODI to OCR those tiffs. After the tool tries to OCR too many of these "bad" tiffs, the machine runs out of memory and the app crashes. I have tried several code fixes from the web that supposedly fix any MODI memory leaks, but so far none have worked for me. I am pasting in the part of the code below that does the OCRing: StringBuilder strRecText = new StringBuilder(10000); MODI.Document doc1 = new MODI.Document(); doc1.Create(name); try { doc1.OCR(MODI.MiLANGUAGES.miLANG_ENGLISH, true, true); // this will ocr all pages of a multi-page tiff file } catch (Exception e) { doc1.Close(false); // clean up if (doc1 != null) { GC.Collect(); GC.WaitForPendingFinalizers(); GC.Collect(); GC.WaitForPendingFinalizers(); System.Runtime.InteropServices.Marshal.FinalReleaseComObject(doc1); doc1 = null; } } MODI.Images images = doc1.Images; for (int imageCounter = 0; imageCounter < images.Count; imageCounter++) { if (imageCounter > 0) { if (!noPageBreakFlag) { strRecText.Append((char)pageBreakChar); } } MODI.Image image = (MODI.Image)images[imageCounter]; MODI.Layout layout = image.Layout; strRecText.Append(layout.Text); GC.Collect(); GC.WaitForPendingFinalizers(); GC.Collect(); GC.WaitForPendingFinalizers(); if (layout != null) { System.Runtime.InteropServices.Marshal.FinalReleaseComObject(layout); layout = null; } if (image != null) { System.Runtime.InteropServices.Marshal.FinalReleaseComObject(image); image = null; } } File.AppendAllText(ocrFile, strRecText.ToString()); // write the OCR file out to disk GC.Collect(); GC.WaitForPendingFinalizers(); GC.Collect(); GC.WaitForPendingFinalizers(); if (images != null) { System.Runtime.InteropServices.Marshal.FinalReleaseComObject(images); images = null; } GC.Collect(); GC.WaitForPendingFinalizers(); GC.Collect(); GC.WaitForPendingFinalizers(); doc1.Close(false); // clean up if (doc1 != null) { System.Runtime.InteropServices.Marshal.FinalReleaseComObject(doc1); doc1 = null; } GC.Collect(); GC.WaitForPendingFinalizers(); GC.Collect(); GC.WaitForPendingFinalizers();

    Read the article

  • Why Exception occured getting address of COM function ?

    - by Usman
    I am getting address of COM function by loading type library (TLB) and iterating over types using ITypeLib and ITypeInfo. After calling AddressOfMember function of ITypeInfo I am facing the following exception: System.Runtime.InteropServices.COMException (0x800288BD): Wrong module kind for the operation. (Exception from HRESULT: 0x800288BD (TYPE_E_BADMODULEKIND)) at System.Runtime.InteropServices.ComTypes.ITypeInfo.AddressOfMember(Int32 memid, INVOKEKIND invKind, IntPtr& ppv). Any idea how to get rid of this excpetion?

    Read the article

  • Convert between python array and .NET Array

    - by dungema
    I have a python method that returns a Python byte array.array('c'). Now, I want to copy this array using System.Runtime.InteropServices.Marshal.Copy. This method however expects a .NET array. import array from System.Runtime.InteropServices import Marshal bytes = array.array('c') bytes.append('a') bytes.append('b') bytes.append('c') Marshal.Copy(bytes, dest, 0, 3) Is there a way to make this work without copying the data? If not, how do I convert the data in the Python array to the .NET array?

    Read the article

  • Excel process not ending in Cluster environment

    - by Vasanth
    When we try to close excel object, it fails to close to cluster environment. The same is working fine in QA and UAT environment. public bool KillExcelProcess() { try { object misValue = System.Reflection.Missing.Value; wbObj.Save(); wbObj.Close(true, misValue, misValue); appC.Workbooks.Close(); appC.Quit(); System.Runtime.InteropServices.Marshal.ReleaseComObject(objSheet); System.Runtime.InteropServices.Marshal.ReleaseComObject(wbObj); System.Runtime.InteropServices.Marshal.ReleaseComObject(appC); wbObj = null; appC = null; } catch (Exception ex) { //throw ex; } finally { System.Threading.Thread.Sleep(5000); GC.Collect(); } return true; Calling function #endregion try { log.Info("CloseExcelService (MeasureSavingsComputeBO) Starts ..."); exConverter.KillExcelProcess(); while (true) { try { File.Delete(strFilename); break; } catch (Exception ex) { } }

    Read the article

  • Powershell import-module webadministration

    - by David
    Every time I execute this command invoke-command -computername REMOTEPC -scriptblock { import-module WebAdministration; new-item "$env:systemdrive\inetpub\testsite" -type directory; New-WebSite -Name TestSite -Port 81 -PhysicalPath "$env:systemdrive\inetpub\testsite" } I get the following error Invalid class string (Exception from HRESULT: 0x800401F3 (CO_E_CLASSSTRING)) + CategoryInfo : NotSpecified: (:) [Get-ChildItem], COMException + FullyQualifiedErrorId : System.Runtime.InteropServices.COMException,Microsoft.PowerShell.Commands.GetChildItemCommand The website is created successfully as far as I can see. The following command gives the same error when enumerating the testsite Invoke-Command -computername REMOTEPC { import-module webadministration; dir -path IIS:\Sites\ } Name ID State Physical Path Bindings PSComputerName Default Web Site 1 Started http *:80: REMOTEPC Invalid class string (Exception from HRESULT: 0x800401F3 (CO_E_CLASSSTRING)) + CategoryInfo : NotSpecified: (:) [Get-ChildItem], COMException + FullyQualifiedErrorId : System.Runtime.InteropServices.COMException,Microsoft.PowerShell.Commands.GetChildItemCo mmand Any suggestions would be appreciated

    Read the article

  • "powershell has stopped working" on PS exit after creating IIS User

    - by Nick Jones
    On a Windows Server 2012 box, I'm using PS to create a new IIS User (for automated deployments using MSDeploy). The command itself appears to work fine -- the user is created -- but as soon as I exit my PowerShell session (typing exit or just closing the command window), a dialog is displayed stating "powershell has stopped working", with the following details: Problem signature: Problem Event Name: PowerShell NameOfExe: powershell.exe FileVersionOfSystemManagementAutomation: 6.2.9200.16628 InnermostExceptionType: Runtime.InteropServices.InvalidComObject OutermostExceptionType: Runtime.InteropServices.InvalidComObject DeepestPowerShellFrame: unknown DeepestFrame: System.StubHelpers.StubHelpers.GetCOMIPFromRCW ThreadName: unknown OS Version: 6.2.9200.2.0.0.400.8 Locale ID: 1033 The PS commands in question are: [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Web.Management") [Microsoft.Web.Management.Server.ManagementAuthentication]::CreateUser("Foo", "Bar") Why is this happening and how can I avoid it? EDIT: I've also confirmed this be a problem with PowerShell 4.0, so I've added that tag. I've also submitted it on Connect. UPDATE: It appears that Windows Server 2012 R2 does not have this same bug.

    Read the article

1 2 3 4 5 6 7 8 9 10  | Next Page >