.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Sending 'ctrl-c' to the datagridview row of an external application using win32 api. Please help.

Posted By:      Posted Date: August 29, 2010    Points: 0   Category :Windows Application
I'm just not able to send ctrl-c using my C# application to an external WinForm application. Here is my sequence of commands. I compared the messages using Spy++, and it matches except for my SendMessages are showing up as Send and Receive, vs. the same operation done on the WinForm is showing up as posted. My command sequence : NativeMethods.SendMessage(hwnd, WM_KEYDOWN, 0x00000011, 0x001D0001); NativeMethods.SendMessage(hwnd, WM_KEYDOWN, 0x00000043, 0x002E0001); NativeMethods.SendMessage(hwnd, WM_CHAR, 0x00000003, 0x002E0001); NativeMethods.SendMessage(hwnd, WM_KEYUP, 0x00000043, 0xC02E0001); NativeMethods.SendMessage(hwnd, WM_KEYUP, 0x00000011, 0xC01D0001); My Spy++ sequence : <00001> 0059043C S WM_LBUTTONDOWN fwKeys:MK_LBUTTON xPos:299 yPos:52 [wParam:00000001 lParam:0034012B] <00002> 0059043C R WM_LBUTTONDOWN <00003> 0059043C S WM_LBUTTONUP fwKeys:MK_LBUTTON xPos:299 yPos:52 [wParam:00000001 lParam:0034012B] <00004> 0059043C R WM_LBUTTONUP <00005> 0059043C S WM_KEYDOWN nVirtKey:VK_CONTROL cRepeat:1 ScanCode:1D fExtended:0 fAltDown:0 fRepeat:0 fUp:0 [wParam:00000011 lParam:001D0001] <00006> 0059043C R WM_KEYDOWN <00007> 0059043C S WM_KEYDOWN nVirtKey:'C' cRepeat:1 ScanCode:2E fExtended:0 fAltDown:0 fRepeat:0 fUp:0 [wParam:00000043 lParam:002E0001] <00008> 0059043C R WM_KEYDOWN <00009> 00590

View Complete Post

More Related Resource Links

trust outlook 2003 application object when sending email c#

i am using outlook 2003 to send email but this outlook version always not trust application option so that before send email, always prompt a security dialog box to ask me to send email or not. how can i trust all outlook application object using vs 2008 or set in outlook 2003 anyone help

How to embed a win32 application in a WPF application

Hi, I was wondering if it would be possible to host a win32 application into a WPF application. I don't need to interact with it at all, I just want to host it in my WPF app. For example I want to be able to host a Notepad or Command Prompt window or any other win32 app. Is there a way for me to do this? Thank you, Cristian

System.BadImageFormatException:is not a valid Win32 application

We are facing problem while migrating a .Net 2.0 application 64 Bit OS Windows Server 2003.The error is  as below:"is not a valid Win32 application. (Exception from HRESULT: 0x800700C1) " 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.BadImageFormatException: is not a valid Win32 application. (Exception from HRESULT: 0x800700C1)the application is running fine on 32 Bit OS windows Server 2003.Can any one provide any possible soution to the above problem.thanksNikhil

sending JOSON from a client application

hi Web gurusI am a c++ developer and unfortunately I have to code a small web app in which I aint got no choice to choose what tools to use. I have never worked on a web based application development. I have been asked to use Asp.net mvc 1.0 in .net 3.5 (no mvc2.0 or .net 4.0 framework) using c# and jsonthe controller sends and receives json and the client side is not a web app.. it can be a smart phone app or a desktop appI have completed some of the coding which I can send a json object to the client (contenttype :application/json  for example        public class person        {            public string name { get; set; }            public string postcode { get; set; }        }        public JsonResult test()        {            person p = new person();            p.name = "your name";            p.postcode = "your post code";            return Json(p);&nb

sending email from my asp.net application using vb.net


i used the code below to try sending an e mail but did'nt work, I've gotten the mail server and port from my host company.


  Dim message As New MailMessage("sender@address", "from@address", "Subject", "Message Text")
        Dim emailClient As New SmtpClient("Email Server Name")

Getting error when trying to start acroRd32.exe "Not a valid Win32 Application"


I am writing a .pdf file to a folder then attempting to silent print using acroRd32.exe. When I run the program I get the error 

"Not a valid win32 application"

The program is creating the pdf file correctly.


 string pathToExecutable = @"c:\Program Files\Adobe\Reader 9.0\AcroRd32.exe";

     RunExecutable(pathToExecutable, @"/t ""C:\WR014v2_.pdf""     ""//ussnadprt/USNPA039""");

 private static void RunExecutable(string executable, string arguments)
            ProcessStartInfo starter = new ProcessStartInfo(executable, arguments);
            starter.CreateNoWindow = true;
            starter.RedirectStandardOutput = true;
            starter.UseShellExecute = false;

            Process process = new Process();
            process.StartInfo = starter;

            StringBuilder buffer = new StringBuilder();

            using (StreamReader reader = process.StandardOutput)
                string line = reader.ReadLine();
                while (line != null)
                    line = reader.ReadLine();

Replace standart DispForm with my application page for External Lists



Hi all,

I'd like to use my application pages (with code behind, not modified with Sharepoint Designer pages) for View/Edit/New operations.

As I know there is an issue how to do it:



SPContentType ct=web.Lists["ListName"].ContentTypes["ContentTypeName"];



And this works fine for common Lists, but when I'm trying to do it with External List,

I have an Exception on Update method:

SPException: The collection cannot be modified.


I've tryied:


web.AllowUnsafeUpdates = true;


ct.ReadOnly = false;

// or
ct.Sealed = false;

and nothing of it helped me...

Is anybody knows how can I make it? May be another method to do it?

Refresh datagridview in windows form application


I am having a main which will have 2 controls namely treeview and datagridview . I will have a form to be opened when user selects an option from treeview. My treeview will be as follows





If i click on the text file that was child to the root i will show the content of that file. But what i need is if right click on child i will have an option as NEW and i will get a new form. If i enter some values and click on save i will save them to the text file which was provided in the treeview at the same time i would like to show the user in the datagridview when the second form gets hide. Like that i can have multiple child forms what ever data i give there in the forms that should be shown to datagridview when the child form gets closed or hide

Problem with Host an external application in WPF


I wanna host an external application,for example "Notepad.exe" in WPF?I use HwndHost to do so:


    class NetTermHost : HwndHost
        private IntPtr hwndHost;

        protected override HandleRef BuildWindowCore(HandleRef hwndParent)
            Process notePadProc = new Process();
            notePadProc.StartInfo.FileName = @"notepad.exe";


            hwndHost = Win32Native.FindWindow("NotePad", null);

            uint oldStyle = Win32Native.GetWindowLong(hwndHost, Win32Native.GWL_STYLE);
            Win32Native.SetWindowLong(hwndHost, Win32Native.GWL_STYLE, oldStyle | Win32Native.WS_CHILD);


            Win32Native.SetParent(hwndHost, hwndParent.Handle);


            return new HandleRef(this, hwndHost);


        protected override void DestroyWindowCore(HandleRef hwnd)

            HandleRef handleRef = new HandleRef(this, hwndHost);

            Win32Native.SendMessage(handleRef, Win32Native.WM_CLOSE, IntPtr.Zero, IntPtr.Zero);


the Notepad is displayed at my WPF form.But I cannot operate the Notepa

Displaying formatting of an Excel sheet in a datagridview within a C# application


I've successfully used the Excel COM objects in C# to extract the contents of the sheets. I then use this information in a datagridview.

Rather than just cycle through each cell for the values to build up what needs to be displayed however I used the Worksheet.UsedRange.get_value() method instead which returns a 2D array of objects containing the string values of the cells.

I've done this since going through each cell individually appears to slow things down considerably, especially when larger Excel files are being opened. I would like to also apply as much of the formatting as possible from the file too, however there doesn't appear to be a clear way to extract formatting information in a similar way to get_value. I could go back to cycling through the cells, but this would probably incur an unacceptable loss in speed as a result.

Does anybody know how to retrieve formatting information using a way that's similar in terms of output to the way that get_value works?

" is not a valid Win32 application. (Exception from HRESULT: 0x800700C1)"

I'm attempting to migrate an ASP.NET application from .NET 1.1 to 2.0 (and I'm also moving the development platform from VS.NET 2003 to VS.NET 2005). After some modification the application builds cleanly on the new platform but when I attempt to run in debug mode I see the error shown below. I'm building on a new WinXP-64 machine (AMD Athlon 64 CPU).

If I change the target platform to "x86" in the solution properties, I can't build the app (hundreds of unresolved dependencies).

Can anyone point me in the right direction to solve this problem?

Many thanks

Steve F

Server Error in '/CMISWebAdminDevelopment' Application.

is not a valid Win32 application. (Exception from HRESULT: 0x800700C1)

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.BadImageFormatException: is not a valid Win32 application. (Exception from HRESULT: 0x800700C1)

Source Error:

Problem Sending Alert to External domains from SharePoint 2007

The alerts get to the users within company just fine however alerts to partner outside compnay (to external e-mail address) does not work. I have setup relay connector on exchange server 2007 but that did not help. Any help would be greatly appreciated. For testing purpose I have created a contact in MS-Exchange 2007 with an external e-mail address and contatc is viewable at SharePoint site but not getting alert e-mails from SharePoint

Win32 exception in application



I am facing "An unhandled win32 exception occurred in ....exe". I tried to used windbg to get some information from crash dump, but it doesn't help much. Furthermore this exception comes only when application runs in release mode.

Appreciate any help in this.


- JC



Windows 2003 64 bit - Web App gives "is not a valid Win32 application. (Exception from HRESULT: 0x80


I've got an x86 deployment which is targeted at x86 and works fine on 2003 server 32 bit.

When I install on win 2003 x64, the installer works OK, but I cant get the first web page to display.

I've done a fair bit of googling but not found an answer yet

The error message is:

Server Error in '/MyCompany' Application.

is not a valid Win32 application. (Exception from HRESULT: 0x800700C1)
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.BadImageFormatException: is not a valid Win32 application. (Exception from HRESULT: 0x800700C1)

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:

[BadImageFormatException:  is not a valid Win32 application. (Exception from HRESULT: 0x800700C1)]
   System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean thro

Creating a SharePoint 2010 External List Application Using VS 2010

to create an External List using Business Data. I noticed that they showed methods for the code but showed no foundation or a Use Case, nor did it discuss the LOB System and how the class entity relationship is defined.

Microsoft's Collaborative Application Markup Language (CAML) Loop

discovered an interesting error recently while working with Microsoft's Collaborative Application Markup Language (CAML) that, surprisingly, had received no ink. Partly what surprises me about this is that the error may require you to rewrite large sections of your code if you haven't previously considered this SharePoint limitation. I'll start with some context, but first of all the error is:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend