.net-4.0

Getting AccessViolation Exception when returning a bool from C++ to C#

て烟熏妆下的殇ゞ 提交于 2019-12-25 18:34:38
问题 I am using a third-party, proprietary DLL for which the source code is not available to me. Wrapper code that appears to have been auto-generated using SWIG 1.3.39 is, however, available to me. The wrapper code consists of a C++ file that compiles (using some headers that describe the DLL) to a DLL and of a C# project that makes PInvoke calls to the C++ wrapper DLL. After inspecting the StackTrace I got the following information: at org.doubango.tinyWRAP.tinyWRAPPINVOKE.MediaSessionMgr

Reading PDF file?

与世无争的帅哥 提交于 2019-12-25 16:57:30
问题 This will be my first time reading a PDF. I was searching around and found so options to do that with C# and choose to use iTextSharp. So far I've done just the basic like reading the file and getting the content without issues. PdfReader reader = new PdfReader(iPDF.Text); for (int x = 2; x <= reader.NumberOfPages; x++) { iResult.Text = Encoding.UTF8.GetString(reader.GetPageContent(x)); break; } As you can see it is a very very basic code just to read the 2nd page of the PDF into a text file

Why does GetWindowThreadProcessId return 0 when called from w3wp.exe

核能气质少年 提交于 2019-12-25 14:17:12
问题 When running the following code, GetWindowThreadProcessId returns 0. I've read about the same problem happening with a service, but this code is being run as an Application Pool in IIS (namely, w3wp.exe). Also, both w3wp.exe and the EXCEL.EXE it is trying to kill are running in the same session (session 0), and as the same user. if (appClassXls != null) { IntPtr processId = default(IntPtr); GetWindowThreadProcessId(appClassXls.Hwnd, out processId); Process processXls = Process.GetProcessById

Using ClickOnce getting two instances of the program after update

℡╲_俬逩灬. 提交于 2019-12-25 09:50:07
问题 I've started getting ClickOnce setup and using the code below after calling Application.Restart(); I end up with two instances of the application (the newly updated one and the previous version). private static void CheckForUpdate() { ApplicationDeployment updateCheck = ApplicationDeployment.CurrentDeployment; UpdateCheckInfo info = updateCheck.CheckForDetailedUpdate(); if(info.UpdateAvailable) { updateCheck.Update(); MessageBox.Show( "The application has been upgraded, and will now restart."

How should a Thread notify its parent that it ended unexpectedly

◇◆丶佛笑我妖孽 提交于 2019-12-25 09:31:01
问题 I have a thread that is listening on a socket and forwarding on the messages it receives to processing engine. If something untoward happen (such as the socket is unexpectedly closed) how should that thread notify it's "parent" that it's about to end? UPDATE: For example, here's a simple illistration of the issue: class Program { private static BlockingCollection<string> queue = new BlockingCollection<string>(); static void Main(string[] args) { Thread readingThread = new Thread(new

How to XML serialize and deserialize an instance of Dictionary <type, List<Action<T>>>?

情到浓时终转凉″ 提交于 2019-12-25 06:55:26
问题 I want to serialize and deserialize my dictionary object of type Dictionary <type, List<Action<T>>> . I tried using XMLserializer - it fails. Cannot serialize member MyClass.MyDictionary of type System.Collections.Generic.Dictionary‘2[[System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], because it implements IDictionary. I am using .NET framework 4.0. What is

Setting user's password via System.DirectoryServices.Protocols in AD 2008 R2

做~自己de王妃 提交于 2019-12-25 04:56:27
问题 I am connecting to a Microsoft Active Directory server in a DMZ from my .net application (asp.net VB .net 4.0). I need to create a new "inetorgperson" in an orgunit called "SingleCustomerAccount". I have had to use the System.DirectoryServices.Protocols namespace for all the work, because the ADSI classes (System.DirectoryServices namespace) wouldn't work across the DMZ properly. Anyway it's been working fine connecting to Active Directory on Windows Server 2003 R2; however we're running

Make same app compatible for Net3.5 & 4.0

白昼怎懂夜的黑 提交于 2019-12-25 04:56:09
问题 I have a set of applications as a single Project developed in C# using .NET3.5. The app doesn't work in PC with NET4, I added and testing to see all functionality is working in NET4 or not. Changed the Net framework to 4.0 instead of 3.5. The same app got compiled & build without a single error in NET4. The app contains UserSettings in Properties.Settings. I changed the version in to 4.0.0 from 2.0.0 and now app starts its execution. My QUESTION: The code is compatible for NET3.5 & 4.0. But

Using Java .jar package in asp.net 4.0 application?

我只是一个虾纸丫 提交于 2019-12-25 04:31:39
问题 I have a jar file exporting some functions which i want to use in my asp.net application. How can i achieve this? Will anything change if i use it in an windows azure application? 回答1: You might be able to use IKVM to compile the jar into a .Net assembly and then use it in your asp.net application. 来源: https://stackoverflow.com/questions/4683257/using-java-jar-package-in-asp-net-4-0-application

DataGrid clickable row

橙三吉。 提交于 2019-12-25 03:58:25
问题 I'm looking for a way for my users to click on a row on my DataGrid where if that click anyway they would pick up the UniqueID column, and then open an new page which would be called "uniqueidview.aspx" that uses the UniqueID as it's primary key in a MySQL query. I'm able to do the MySQL part but i can't find a walk-through or guide on how to do this using a DataGrid, i've found a few using DataView, any help would be awesome. Thanks! 回答1: 4 Guys From Rolla posted an article Creating a Row