Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

SendMessage in C#

Posted on 2003-03-03
3
Medium Priority
?
449 Views
Last Modified: 2009-12-16
Hello.
I have a win application that is written by C#.
When run it, first one form with "frmAbout" name appears.
on the this form, there is a "ok" button.
we must click this button until we see another form.
I want when run program without clicking "ok" button, I see second form, I want to do it with retrieving handle of "ok" button and Sending Message to "ok" button.
please help me.
0
Comment
Question by:KawoshSoft
1 Comment
 
LVL 4

Accepted Solution

by:
Nebulus_ earned 480 total points
ID: 8056309
I'm not sure that you need to send messages to a control from a form (maybe you need a spash screen :) ) but this is, I think, what you ask:

using System.Runtime.InteropServices;

...

public const uint WM_LBUTTONDOWN = 0x201;
public const uint WM_LBUTTONUP = 0x202;

[DllImport("user32.dll", EntryPoint = "SendMessageA")]
public static extern uint SendMessage(IntPtr hWnd, uint  wMsg, uint wParam, uint lParam);

...

SendMessage(buttonOK.Handle, WM_LBUTTONDOWN, 0, 0);
SendMessage(buttonOK.Handle, WM_LBUTTONUP, 0, 0);
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question