Solved

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

Posted on 2001-06-09
9
262 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
 
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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 

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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article shows how to make a Windows 7 gadget that extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
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…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

744 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now