Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2001-06-09
9
Medium Priority
?
272 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
Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

 
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 300 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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

This article shows how to make a Windows 7 gadget that accepts files dropped from the Windows Explorer.  It also illustrates how to give your gadget a non-rectangular shape and how to add some nifty visual effects to text displayed in a your gadget.…
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…
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…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

609 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