Click here to Skip to main content
15,902,114 members
Home / Discussions / C#
   

C#

 
GeneralRe: Using A Generic Class with a Type Constraint Pin
Richard Andrew x6430-May-17 1:13
professionalRichard Andrew x6430-May-17 1:13 
AnswerRe: Using A Generic Class with a Type Constraint Pin
Pete O'Hanlon29-May-17 23:48
mvePete O'Hanlon29-May-17 23:48 
GeneralRe: Using A Generic Class with a Type Constraint Pin
Richard Andrew x6430-May-17 1:14
professionalRichard Andrew x6430-May-17 1:14 
AnswerRe: Using A Generic Class with a Type Constraint Pin
Gerry Schmitz30-May-17 13:08
mveGerry Schmitz30-May-17 13:08 
GeneralRe: Using A Generic Class with a Type Constraint Pin
Richard Andrew x6430-May-17 14:30
professionalRichard Andrew x6430-May-17 14:30 
QuestionWinform taskbar thumbnail problem Pin
Member 1322816728-May-17 21:37
Member 1322816728-May-17 21:37 
QuestionRe: Winform taskbar thumbnail problem Pin
Maciej Los29-May-17 2:31
mveMaciej Los29-May-17 2:31 
AnswerRe: Winform taskbar thumbnail problem Pin
Dave Kreskowiak29-May-17 2:41
mveDave Kreskowiak29-May-17 2:41 
Questioncalling a string variable in "proc.StartInfo.Arguments" Pin
Member 1322808028-May-17 20:02
Member 1322808028-May-17 20:02 
AnswerRe: calling a string variable in "proc.StartInfo.Arguments" Pin
OriginalGriff28-May-17 20:25
mveOriginalGriff28-May-17 20:25 
GeneralRe: calling a string variable in "proc.StartInfo.Arguments" Pin
Member 1322808028-May-17 20:40
Member 1322808028-May-17 20:40 
AnswerRe: calling a string variable in "proc.StartInfo.Arguments" Pin
Ralf Meier28-May-17 21:13
mveRalf Meier28-May-17 21:13 
GeneralRe: calling a string variable in "proc.StartInfo.Arguments" Pin
OriginalGriff28-May-17 21:34
mveOriginalGriff28-May-17 21:34 
GeneralRe: calling a string variable in "proc.StartInfo.Arguments" Pin
Richard MacCutchan28-May-17 21:37
mveRichard MacCutchan28-May-17 21:37 
QuestionDeclaring a Generic Class Pin
Richard Andrew x6428-May-17 14:50
professionalRichard Andrew x6428-May-17 14:50 
AnswerRe: Declaring a Generic Class PinPopular
OriginalGriff28-May-17 19:28
mveOriginalGriff28-May-17 19:28 
GeneralRe: Declaring a Generic Class Pin
Richard Andrew x6429-May-17 2:09
professionalRichard Andrew x6429-May-17 2:09 
GeneralRe: Declaring a Generic Class Pin
OriginalGriff29-May-17 2:26
mveOriginalGriff29-May-17 2:26 
QuestionMessage Closed Pin
28-May-17 9:06
Member 1308759428-May-17 9:06 
AnswerRe: Why still get empty list? Pin
Pete O'Hanlon28-May-17 9:13
mvePete O'Hanlon28-May-17 9:13 
QuestionAbout the WM_LBUTTONDOWN Pin
Member 1322740128-May-17 6:15
Member 1322740128-May-17 6:15 
The question is simple, I have a code that's using the PostMessage function like so :

public enum WMessages : int
        {
            WM_MOUSEMOVE=                    0x0200,

            WM_LBUTTONDOWN = 0x201,
            WM_LBUTTONUP = 0x202,
            WM_RBUTTONDOWN = 0x0204,
            WM_RBUTTONUP = 0x0205,

            WM_KEYDOWN = 0x100,
            WM_KEYUP = 0x101,

            WH_KEYBOARD_LL = 13,
            WH_MOUSE_LL = 14,
        }
[DllImport("User32.Dll", EntryPoint = "PostMessageA")]
        static extern bool PostMessage(IntPtr hWnd, uint msg, int wParam, int lParam);
        private int MAKELPARAM(int p, int p_2)
        {
            return (p_2 * 0x10000 + p);
        }
        public void SendClick(WMessages type, Point pos, IntPtr hwnd)
        {
            switch (type)
            {
                case WMessages.WM_LBUTTONDOWN:
                    PostMessage(hwnd,
                        (int)0x201, 1,
                        MAKELPARAM(pos.X, pos.Y));//(IntPtr)((pos.Y << 16) | (pos.X & 0xFFFF)));
                    return;
                case WMessages.WM_LBUTTONUP:
                    PostMessage(hwnd,
                        (int)WMessages.WM_LBUTTONUP, 0, // <--(2) but you are telling to do WM_LBUTTONDOWN
                        MAKELPARAM(pos.X, pos.Y));//(IntPtr)((pos.Y << 16) | (pos.X & 0xFFFF)));
                    return;
                default:
                    return;
            }
        }


The only problem is that it clicks in a wrong place. For example, if i input the point 50,50 it'll click in 70,70 for example, offsetted to the window handle.

I wonder why it happens? Hope to get an answer.

Thanks in advance.

Example :

IntPtr atat = (IntPtr)0x00010870;
SendRClick(WMessages.WM_RBUTTONDOWN, new Point(50, 50), atat);
SendRClick(WMessages.WM_RBUTTONUP, new Point(50, 50), atat);


Edit :

I've found something interesting, apparently it happens only in 1 of my screens (I have 2), in the other one its not happening.

The screen that it happens in's resolution is 1920/1080, the screen that does it correctly's resolution is 1280/1024 (my main screen, does it correctly).

Edit 2 :

Also another thing that I've forgot to mention, the ratio between the resulted point to the inserted point is 1.5 in X and also in Y.

For example, if I've entered X=100,Y=100, it'll be resulted in 150 X and 150 Y offset from the window handle.

Edit 3 :

An alternative would be to devide the x and y by 1.5 and then it'll be multiplied again by default... but its not really an answer
AnswerRe: About the WM_LBUTTONDOWN Pin
Gerry Schmitz28-May-17 9:51
mveGerry Schmitz28-May-17 9:51 
AnswerRe: About the WM_LBUTTONDOWN Pin
raddevus29-May-17 4:42
mvaraddevus29-May-17 4:42 
QuestionPOST JSON Request to a RESTful service + server deployment Pin
Code_Project_127-May-17 9:07
Code_Project_127-May-17 9:07 
QuestionDislaying 3D model in C# winform Pin
Member 1301708227-May-17 0:11
Member 1301708227-May-17 0:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.