Solved

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

Posted on 2001-06-09
9
266 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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

Suggested Solutions

With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
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…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

733 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