Solved

How can i create a user drawn window, like Sonique?

Posted on 2001-06-09
9
264 Views
Last Modified: 2013-12-03
There are many softwares with great looking skins, among which are: Sonique, WinAmp, ZoneAlarm, etc.
I wish to create my own skinned window/software.
NOTE: I do not wish to overwrite the default window, but rather create a new one from scratch, and with any shape i choose.

Thank you, Bitwize.
0
Comment
Question by:Bitwize
  • 4
  • 4
9 Comments
 
LVL 5

Expert Comment

by:djbusychild
ID: 6175835

you could try looking into Mozilla's use of XUL

http://www.mozilla.org/xpfe/aom/AOM.html#xul_intro

too bad you're not on GNOME or KDE.. ^^;
0
 
LVL 1

Expert Comment

by:rgoerdes
ID: 6176291
you can create a window you like. you just have to create a window with correct styles and properties. without title, borders, min-max buttons ... perhaps transparent. and you have to do the right things answering to the messages WM_PAINT, NC-messages and so on. f.e. showing a bitmap. just create a basic windows application and play a little bit with the styles of the main-window and the WM_PAINT - message. you will see what i mean. i don't know if it's possible using delphi or cbuilder, but it's easy using legacy windows programming.
0
 

Author Comment

by:Bitwize
ID: 6187774
I have already played quite a lot with the CreateWindow function and its styles... perhaps something is eluding me... would you be so kind to display the necessary code?
0
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
LVL 1

Expert Comment

by:rgoerdes
ID: 6195895
Well, i try to copy parts of a project, maybe i deleted to much. in this project i created a bitmap-resource, which is to be used as backgroud-image of the window.
At first the main. look at --->>>. the bitmap is loaded there.

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLine, int iCmdShow) {
    MSG msg;
    WNDCLASSEX wc;
    HINST = hInstance;

    wc.style=CS_HREDRAW|CS_VREDRAW;
    wc.lpfnWndProc=(WNDPROC)WndProc;
    wc.cbClsExtra=0;
    wc.cbWndExtra=0;
    wc.hInstance = hInstance;
    wc.hIcon = NULL;
    wc.hCursor = LoadCursor(NULL,IDC_ARROW);
    wc.hbrBackground = NULL;
    wc.lpszMenuName = NULL;
    wc.lpszClassName = "MAIN";
    wc.cbSize=sizeof(WNDCLASSEX);
    wc.hIconSm = wc.hIcon;
    if (!RegisterClassEx(&wc)) {return FALSE;}
   
     HWND_MAIN = CreateWindowEx(NULL, "MAIN", "", WS_POPUP, 0, 0, 640, 480, NULL, NULL, HINST, NULL);

       --->>> HBITMAP_BACK = LoadBitmap(HINST, MAKEINTRESOURCE(IDB_BACK));
        SetWindowPos(HWND_MAIN, NULL, 0, 0, 0, 0,SWP_SHOWWINDOW|SWP_NOSIZE|SWP_NOMOVE);

         while(GetMessage(&msg, NULL, 0, 0)) {
          TranslateMessage(&msg); DispatchMessage(&msg);
    }
    return(msg.wParam);
}




and now the WM_PAINT

case WM_PAINT: {
            PAINTSTRUCT ps;
            HDC h = BeginPaint(hWnd, &ps);
            SelectObject(h, HFONT_BASIC);
            SetTextColor(h, RGB(255, 255, 255));
            SetBkColor(h, 0);
               if (h == NULL) {return 0;}
            if (HDC_MEM == 0) {
                HDC_MEM = CreateCompatibleDC(h);
           
                SelectObject(HDC_MEM, HBITMAP_BACK);
                BitBlt(h, ps.rcPaint.left, ps.rcPaint.top, ps.rcPaint.right - ps.rcPaint.left, ps.rcPaint.bottom - ps.rcPaint.top, HDC_MEM, ps.rcPaint.left, ps.rcPaint.top, SRCCOPY);
            }

Nothing else than copying the bitmap to client-rect of the window. Now you can BitBlt other things, f.e. your special controls ...........
0
 

Author Comment

by:Bitwize
ID: 6198402
Yes my friend, you have deleted too much.
It seems to me, this fragment of code is designed to put a bitmap as a window background but does not put it INSTEAD of the window (which is what i look for).
0
 
LVL 1

Expert Comment

by:rgoerdes
ID: 6201346
you should describe what you want. do you want to have an exclusive screen? then you should have a look at direct draw etc. if you want to have a user-designed window, which can be put in the foreground, background, can be moved around and so on, you should create a simple window and only alter the appearance and the behaviour. and that's what i did. or do you want to have a window with a user defined shape? f.e. a circle?


0
 

Author Comment

by:Bitwize
ID: 6215666
In simple words:
  1. A user defined shape.
  2. Appearance is 100% user made.
  3. The ability to move it around the screen.

For example:
  Draw a triangular bitmap on screen, move it, resize it, make it ACT like a window.
0
 
LVL 1

Accepted Solution

by:
rgoerdes earned 100 total points
ID: 6217251
you still should create a window in the normal way, no borders and so on. then you must reduce painting and user interaction to the region you want. it can be done using the region-api-calls. it's an exhausting job - but works.
0
 

Author Comment

by:Bitwize
ID: 6221445
Well, i'm gonna try again according to your advice.
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Windows Drag & Drop Location 2 100
MS Access (Newest One): Pulling Data out of a MS SQL DB 1 47
What are the big features of MVC5? 4 85
VS2015 Redefinition errors 4 51
In this article, I will show how to use the Ribbon IDs Tool Window to assign the built-in Office icons to a ribbon button.  This tool will help us to find the OfficeImageId that corresponds to our desired built-in Office icon. The tool is part of…
As more and more people are shifting to the latest .Net frameworks, the windows presentation framework is gaining importance by the day. Many people are now turning to WPF controls to provide a rich user experience. I have been using WPF controls fo…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question