Solved

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

Posted on 2001-06-09
9
267 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
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…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

726 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