Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3634270
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T00:45:29+00:00 2026-05-19T00:45:29+00:00

How to make window, or more like clipping region , where I’ll be able

  • 0

How to make window, or more like clipping region , where I’ll be able to draw pixels?
It might use WinApi, however I don’t want my project to look like winapi one, so it will have

int main(){}

instead of

int WINAPI WinMain(HINSTANCE ...

I have found an example, where I’m able to draw in console window

int main()
{
    COLORREF color = RGB(255,0,0); // COLORREF to hold the color info

    SetConsoleTitle("Pixel In Console?"); // Set text of the console so you can find the window

    HWND hwnd = FindWindow(NULL, "Pixel In Console?"); // Get the HWND
    HDC hdc = GetDC(hwnd); // Get the DC from that HWND

    for( int i = 0 ; i < 50 ; i++ )
    {
    SetPixel(hdc, 5+i, 12, color); // SetPixel(HDC hdc, int x, int y, COLORREF color)
    }
        ReleaseDC(hwnd, hdc); // Release the DC
    DeleteDC(hdc); // Delete the DC
    system("pause");
    return(0);
}

but instead of console, I want to draw on my selected region, which will hold focus ( when user clicks on it, etc ).

It would be also great to be able to handle simple keyboard/mouse events for this program, but it isn’t my primary target here, maybe some other third party libraries will help with it.

I hope I’ve explained clearly what I want to do, but English isn’t my native language, so I’m very sorry for any missunderstandings.

I will be thankfull for any help.


As I’m using this site first time, I’m sorry for little spam or messages in wrong places, as I’m not sure where to post my next messages 🙂
So what i wanted to write, is:

”
Otherwise, how does Allegro/SDL create window? They use assembler calls or shell ones? I’ll be much happier, when I’ll be able to create window from scratch, no matter how much work does it take 🙂
“

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T00:45:30+00:00Added an answer on May 19, 2026 at 12:45 am

    You won’t like this – in Windows, you have to create a window, then override WM_PAINT message, then draw what you have to draw when you are called from the system. That’s old-school way of doing things, and it isn’t so bad.

    Some interesting and relevant links:

    http://www.winprog.org/tutorial/bitmaps.html

    http://www.codeproject.com/Articles/66250/BeginPaint-EndPaint-or-GetDC-ReleaseDC.aspx

    If you are really into avoiding all that, try popcap. Learning curve involved there maybe steeper, so you probably really want to stick with GDI and HWND no matter how hard and confusing it might look in the beginning.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to make Visual Studio 2010's code completion window more like that
I can use FlashWindowEx to make a window flash in the taskbar, but what
I want to make a WPF Window that behaves like a context menu. So,
I have a Window with my user control and I would like to make
After launching an application using the Process class I'd like to make that window
I am looking to make a custom window which would look something like this
How can I make my window not have a title bar but appear in
I'm trying to make a window that closes when you click outside it ,
Is there a way to make a popup window maximised as soon as it
I need to make a pop-up window for users to log-in to my website

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.