Click here to Skip to main content
15,884,176 members
Home / Discussions / Windows Development
   

Windows Development

 
AnswerRe: Check if .exe-file, WITH A PATH(!!!), is running, from within a bat-file? Pin
arnold_w11-May-21 22:35
arnold_w11-May-21 22:35 
GeneralRe: Check if .exe-file, WITH A PATH(!!!), is running, from within a bat-file? Pin
Victor Nijegorodov11-May-21 22:47
Victor Nijegorodov11-May-21 22:47 
GeneralRe: Check if .exe-file, WITH A PATH(!!!), is running, from within a bat-file? Pin
arnold_w11-May-21 23:18
arnold_w11-May-21 23:18 
GeneralRe: Check if .exe-file, WITH A PATH(!!!), is running, from within a bat-file? Pin
Victor Nijegorodov11-May-21 23:49
Victor Nijegorodov11-May-21 23:49 
GeneralRe: Check if .exe-file, WITH A PATH(!!!), is running, from within a bat-file? Pin
arnold_w12-May-21 0:38
arnold_w12-May-21 0:38 
GeneralRe: Check if .exe-file, WITH A PATH(!!!), is running, from within a bat-file? Pin
Eddy Vluggen21-May-21 11:22
professionalEddy Vluggen21-May-21 11:22 
QuestionNeed Suggestions For Uninstalling Avast Secure Browser Pin
Gregorio Pollich19-Feb-21 2:51
Gregorio Pollich19-Feb-21 2:51 
QuestionGDI drawing Pin
David Crow7-Jan-21 10:24
David Crow7-Jan-21 10:24 
In playing around with some basic GDI stuff, I had the need to draw an object in the middle of the main window and then when a button is clicked, draw that object progressively closer to some corner (in my code below, the object moves to the lower right corner, but ultimately I'd like it to move to any corner). So my question is: how to calculate those new X/Y coordinates with each button click?

The initial X/Y coordinates are calculated in response to WM_SIZE like:
case WM_SIZE:
    nScreenWidth  = LOWORD(lParam);
    nScreenHeight = HIWORD(lParam);

    // the window is not being resized right now, so these two variables aren't being recalculated.
    nX = (nScreenWidth - nObjectWidth) / 2;
    nY = (nScreenHeight - nObjectHeight) / 2;

    break;
When the button is clicked, new X/Y coordinates are "calculated" like:
case WM_COMMAND:
    if (LOWORD(wParam) == ID_BUTTON)  
    {
        nX += 20;
        nY += 10;
        InvalidateRect(hWnd, NULL, TRUE);
    }
    break;
The object is drawn in response to WM_PAINT like:
case WM_PAINT:
    {
        PAINTSTRUCT ps;
        HDC hdc = BeginPaint(hWnd, &ps);

        // draw object at nX, nY

        EndPaint(hWnd, &ps);
    }
    break;
You can count on one hand how many GDI projects I've done in the past (and have fingers left over) so I'm walking in somewhat uncharted territory for me. As a visual aide, if you envision a straight line drawn from the middle of the screen to one of its corners, each pixel of that line is on an X/Y coordinate. What would that calculation look like?

Thank you.
DC

"One man's wage rise is another man's price increase." - Harold Wilson

"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles



modified 11-Jan-21 15:00pm.

AnswerRe: GDI drawing Pin
Richard MacCutchan7-Jan-21 21:23
mveRichard MacCutchan7-Jan-21 21:23 
GeneralRe: GDI drawing Pin
David Crow8-Jan-21 2:07
David Crow8-Jan-21 2:07 
GeneralRe: GDI drawing Pin
Richard MacCutchan8-Jan-21 2:48
mveRichard MacCutchan8-Jan-21 2:48 
GeneralRe: GDI drawing Pin
Richard MacCutchan8-Jan-21 4:18
mveRichard MacCutchan8-Jan-21 4:18 
QuestionLabview Development Pin
MarcusCole683310-Dec-20 11:18
professionalMarcusCole683310-Dec-20 11:18 
AnswerRe: Labview Development Pin
Pete O'Hanlon10-Dec-20 23:37
mvePete O'Hanlon10-Dec-20 23:37 
QuestionHelp me! Pin
Member 1492738231-Aug-20 8:33
Member 1492738231-Aug-20 8:33 
AnswerRe: Help me! Pin
Mycroft Holmes31-Aug-20 12:18
professionalMycroft Holmes31-Aug-20 12:18 
AnswerRe: Help me! Pin
RedDk1-Sep-20 8:03
RedDk1-Sep-20 8:03 
QuestionHow to check retrived IP address from DHCP server for conflict ? Pin
Eugene Pustovoyt1-Aug-20 8:01
Eugene Pustovoyt1-Aug-20 8:01 
AnswerRe: How to check retrived IP address from DHCP server for conflict ? Pin
Dave Kreskowiak1-Aug-20 8:42
mveDave Kreskowiak1-Aug-20 8:42 
GeneralRe: How to check retrived IP address from DHCP server for conflict ? Pin
Eugene Pustovoyt1-Aug-20 20:05
Eugene Pustovoyt1-Aug-20 20:05 
GeneralRe: How to check retrived IP address from DHCP server for conflict ? Pin
Dave Kreskowiak2-Aug-20 5:32
mveDave Kreskowiak2-Aug-20 5:32 
GeneralRe: How to check retrived IP address from DHCP server for conflict ? Pin
Eugene Pustovoyt2-Aug-20 6:34
Eugene Pustovoyt2-Aug-20 6:34 
GeneralRe: How to check retrived IP address from DHCP server for conflict ? Pin
Dave Kreskowiak2-Aug-20 9:38
mveDave Kreskowiak2-Aug-20 9:38 
GeneralRe: How to check retrived IP address from DHCP server for conflict ? Pin
Eugene Pustovoyt3-Aug-20 4:59
Eugene Pustovoyt3-Aug-20 4:59 
GeneralRe: How to check retrived IP address from DHCP server for conflict ? Pin
Dave Kreskowiak3-Aug-20 5:07
mveDave Kreskowiak3-Aug-20 5:07 

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.