| |

VerySource

 Forgot password?
 Register
Search
View: 795|Reply: 6

Questions about grabbing windows and sending messages in C #

[Copy link]

2

Threads

5

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-2-12 12:00:01
| Show all posts |Read mode
A guy told me that in Win32, I can use Findwindow to grab a window, and SendMessage to send a message to the captured window. I ca n’t find these two functions in C #. Are they changed now? I thank you.
Reply

Use magic Report

0

Threads

13

Posts

11.00

Credits

Newbie

Rank: 1

Credits
11.00

 Singapore

Post time: 2020-4-9 12:15:01
| Show all posts
No change, first declare
Reply

Use magic Report

0

Threads

13

Posts

9.00

Credits

Newbie

Rank: 1

Credits
9.00

 China

Post time: 2020-4-9 13:30:01
| Show all posts
Introduce winapi
Reply

Use magic Report

0

Threads

13

Posts

11.00

Credits

Newbie

Rank: 1

Credits
11.00

 Singapore

Post time: 2020-4-10 09:45:01
| Show all posts
using System.Runtime.InteropServices;

[DllImport ("Uer32")]
        public static extern void Findwindow (String strClassName, String strWindowsName);

[DllImport ("Uer32")]
        public static extern int SendMessage (IntPtr hwnd, int wMsg, IntPtr wParam, IntPtr lParam);
Reply

Use magic Report

0

Threads

13

Posts

11.00

Credits

Newbie

Rank: 1

Credits
11.00

 Singapore

Post time: 2020-4-10 11:45:01
| Show all posts
Wrong writing, yes
[DllImport ("user32.dll")]
Reply

Use magic Report

2

Threads

5

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

 Author| Post time: 2020-4-12 14:15:01
| Show all posts
My question now is: the standard print dialog has an "OK" button. How do I grab this print dialog and send a message to it, which is equivalent to manually clicking the "OK" button? Thank you!
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-4-13 09:45:02
| Show all posts
zorrozhou() A friend wrote it right, but the parameters in the second SENDMESSAGE API can define multiple types of data types!
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list