Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Urgent Help: win32 problem

  • 24-06-2004 11:08am
    #1
    Registered Users, Registered Users 2 Posts: 1,368 ✭✭✭


    hey guys,

    need some help with a win32 app.

    The application will initially draw a grid on the window.

    It will then acquire the data (fill an array)

    Then i will used use the lineto function to draw a graph of the function.

    heres what ive done so far:
    1. within

    <code>LRESULT WINAPI MainWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)</code>

    Ive put the following code to initialise the grid:

    <code>case WM_PAINT:
    hDC = BeginPaint(hwnd, &Ps);

    hPen = CreateSolidBrush(RGB(0, 0, 0));
    SelectObject(hDC, hPen);
    etc...
    </code?

    This code draws the initial grid

    2.
    The user then clicks an "acquire data" button and a settings dialog box is displayed.

    when they click ok, the data is acquired , and the wave should be drawn:

    within
    int CALLBACK AboutDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)....
    case IDOK:
    hDC = BeginPaint(hwnd, &Ps1);
    hPen = CreatePen(PS_DASHDOTDOT, 1, RGB(255, 255,0 ));
    SelectObject(hDC, hPen);

    AquireData(averages);
    for(i =0; i < 600; i++)
    {
    MoveToEx(hDC, 20+i,175+(ref_chan_average), NULL); LineTo(hDC, 21+i,175+(ref_chan_average[i+1] ));

    }

    EndPaint(hwnd, &Ps1)
    break;

    any ideas, guys,

    the arrays is filling, but no drawing?

    Thanks,
    king


Comments

  • Registered Users, Registered Users 2 Posts: 1,423 ✭✭✭Merrion


    You should add your drawing code to the WM_PAINT handler (check if the array is initialised first) - the use of BeginPaint and Endpaint outside of WM_PAINT processing is not a good idea....

    See MSDN documentation of WM_PAINT for more info, and ...

    If you must draw outside of the WM_PAINT handler use the function GetDC to get the hDC to draw on instead of BeginPaint...


Advertisement