示例#1
0
void update_playlistwindow(void)
{
	if(!need_update_playtree) {
		playlist->clear_playlist(playlist);
		import_playtree_into_playlist(mpctx->playtree, mconfig);
	}
	if (hPlaylistWnd) updatetracklist(hPlaylistWnd);
}
void display_playlistwindow(gui_t *gui)
{
    HWND hWnd = FindWindow(NULL, "MPlayer Playlist");
    HINSTANCE hInstance = GetModuleHandle(NULL);
    WNDCLASS wc;
    int x, y;

    if (hWnd)
    {
        SendMessage(hWnd, WM_CLOSE, 0, 0);
        return;
    }

    wc.style         = CS_HREDRAW | CS_VREDRAW;
    wc.lpfnWndProc   = PlayListWndProc;
    wc.cbClsExtra    = 0;
    wc.cbWndExtra    = 0;
    wc.hInstance     = hInstance;
    wc.hCursor       = LoadCursor(NULL,IDC_ARROW);
    wc.hIcon         = gui->icon;
    wc.hbrBackground = SOLID_GREY2;
    wc.lpszClassName = "MPlayer - Playlist";
    wc.lpszMenuName  = NULL;
    RegisterClass(&wc);
    create_playlistmenu(gui);
    x = (GetSystemMetrics(SM_CXSCREEN) / 2) - (400 / 2);   /* Erik: center popup window on screen */
    y = (GetSystemMetrics(SM_CYSCREEN) / 2) - (254 / 2);
    hWnd = CreateWindow("MPlayer - Playlist",
                        "MPlayer Playlist",
                        WS_POPUPWINDOW | WS_CAPTION | WS_MINIMIZEBOX,
                        x,
                        y,
                        400,
                        254,
                        NULL,
                        NULL,
                        hInstance,
                        NULL);
   SetWindowLongPtr(hWnd, GWLP_USERDATA, (DWORD)gui);
   updatetracklist(hWnd);
   DragAcceptFiles(hWnd,TRUE);
   ShowWindow(hWnd, SW_SHOW);
   UpdateWindow(hWnd);
}
void update_playlistwindow(void)
{
    HWND hWnd = FindWindow(NULL, "MPlayer Playlist");
    if (hWnd) updatetracklist(hWnd);
}
static LRESULT CALLBACK PlayListWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
{
    HWND wdg;
    POINT cursor;
    gui_t *gui = (gui_t *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
    playlist_t *pl = gui ? gui->playlist : NULL;
    switch (iMsg)
    {
        case WM_CREATE:
        {
            wdg = CreateWindow("button", "Play",
                               WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
                               4, 10, 80, 25, hwnd,
                               (HMENU) ID_PLAY,
                               ((LPCREATESTRUCT) lParam) -> hInstance,
                               NULL);
            SendMessage(wdg, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);

            wdg = CreateWindow ("button", "Up",
                                WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
                                4, 37, 80, 25, hwnd,
                                (HMENU) ID_UP,
                                ((LPCREATESTRUCT) lParam) -> hInstance,
                                NULL);
            SendMessage(wdg, WM_SETFONT,(WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);

            wdg = CreateWindow ("button", "Down",
                                WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
                                4, 64, 80, 25, hwnd,
                                (HMENU) ID_DOWN,
                                ((LPCREATESTRUCT) lParam) -> hInstance,
                                NULL);
            SendMessage(wdg, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT),0);

            wdg = CreateWindow ("button", "Remove",
                                WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
                                4, 91, 80, 25, hwnd,
                                (HMENU) ID_REMOVE,
                                ((LPCREATESTRUCT) lParam) -> hInstance,
                                NULL);
            SendMessage(wdg, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT),0);

            wdg = CreateWindow ("button", "Load",
                                WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
                                4, 118, 80, 25, hwnd,
                                (HMENU) ID_PLAYLISTLOAD,
                                ((LPCREATESTRUCT) lParam) -> hInstance,
                                NULL);
            SendMessage(wdg, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT),0);

            wdg = CreateWindow ("button", "Save",
                                WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
                                4, 145, 80, 25, hwnd,
                                (HMENU) ID_PLAYLISTSAVE,
                                ((LPCREATESTRUCT) lParam) -> hInstance,
                                NULL);
            SendMessage(wdg, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT),0);

            wdg = CreateWindow ("button", "Close",
                                WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
                                4, 193, 80, 25, hwnd,
                                (HMENU) ID_CLOSE,
                                ((LPCREATESTRUCT) lParam) -> hInstance,
                                NULL);
            SendMessage(wdg, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT),0);

            wdg = CreateWindow ("listbox", "tracklist", WS_CHILD | WS_VISIBLE | LBS_NOTIFY | WS_VSCROLL |
                               WS_HSCROLL | LBS_DISABLENOSCROLL, 92, 10, 300, 208, hwnd, (HMENU) ID_TRACKLIST,
                               ((LPCREATESTRUCT) lParam) -> hInstance, NULL);
            SendMessage(wdg, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
            SendMessage(wdg, LB_SETHORIZONTALEXTENT, MAX_PATH*4, 0);
            break;
        }
        case WM_CONTEXTMENU:
        {
            GetCursorPos(&cursor);
            SetForegroundWindow(hwnd);
            TrackPopupMenu(gui->playlistmenu, 0, cursor.x, cursor.y, 0, hwnd, NULL);
            break;
        }
        case WM_COMMAND:
        {
            int selected = 0;
            int i;
            for (i=0; i<pl->trackcount; i++)
                if(0 < SendDlgItemMessage(hwnd, ID_TRACKLIST, LB_GETSEL, i, 0)) selected = i + 1;
            switch (LOWORD(wParam))
            {
                case ID_CLOSE:
                    DestroyWindow(hwnd);
                    return 0;
                case ID_TRACKLIST:
                    if(HIWORD(wParam) == LBN_DBLCLK)
                    {
                case ID_PLAY:
                        if(selected) pl->current = selected - 1;
                        mplSetFileName(NULL, pl->tracks[pl->current]->filename, STREAMTYPE_STREAM);
                        gui->startplay(gui);
                    }
                    return 0;
                case ID_UP:
                {
                    if(selected) pl->moveup_track(pl, selected);
                    selected--;
                    break;
                }
                case ID_DOWN:
                {
                    if(selected) pl->movedown_track(pl, selected);
                    selected++;
                    break;
                }
                case ID_REMOVE:
                    if(selected) pl->remove_track(pl, selected);
                    break;
                case ID_ADDFILE:
                {
                    if(guiIntfStruct.StreamType == STREAMTYPE_DVD ||
                       guiIntfStruct.StreamType == STREAMTYPE_DVDNAV) return 0;
                    display_openfilewindow(gui, 1);
                    break;
                }
                case ID_ADDURL:
                {
                    if(guiIntfStruct.StreamType == STREAMTYPE_DVD ||
                       guiIntfStruct.StreamType == STREAMTYPE_DVDNAV) return 0;
                    display_openurlwindow(gui, 1);
                    break;
                }
                case ID_CLEAR:
                {
                    if(!gui->playlist->trackcount) return 0;
                    gui->playlist->clear_playlist(gui->playlist);
                    break;
                }
                case ID_PLAYLISTLOAD:
                {
                    if(guiIntfStruct.StreamType == STREAMTYPE_DVD ||
                       guiIntfStruct.StreamType == STREAMTYPE_DVDNAV) return 0;
                    display_loadplaylistwindow(gui);
                    break;
                }
                case ID_PLAYLISTSAVE:
                {
                    /* no point saving an empty playlist */
                    if(!gui->playlist->trackcount ||
                        guiIntfStruct.StreamType == STREAMTYPE_DVD ||
                        guiIntfStruct.StreamType == STREAMTYPE_DVDNAV)
                        return 0;
                    display_saveplaylistwindow(gui);
                    break;
                }
            }
            updatetracklist(hwnd);
            if(selected < 1) selected = 1;
            else if(selected>pl->trackcount) selected = pl->trackcount;
            SendDlgItemMessage(hwnd, ID_TRACKLIST, LB_SETCURSEL, selected - 1, 0);
            return 0;
        }
        case WM_DROPFILES:
        {
            char file[MAX_PATH];
            int filecount = DragQueryFile((HDROP) wParam, -1, file, MAX_PATH);
            int i;
            for (i=0; i<filecount; i++)
            {
                DragQueryFile((HDROP) wParam, i, file, MAX_PATH);
                if(!parse_filename(file, playtree, mconfig, 0))
                    pl->add_track(pl, file, NULL, NULL, 0);
            }
            DragFinish((HDROP) wParam);
            updatetracklist(hwnd);
        }
            break;
    }
    return DefWindowProc(hwnd, iMsg, wParam, lParam);
}
示例#5
0
static LRESULT CALLBACK PlayListWndProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam)
{
	HWND wdg;
	POINT cursor;
	playlist_t *pl = playlist;
	switch (iMsg)
	{
		case WM_CREATE:
		{
			RECT r;
			LOGFONT lf;
			memset(&lf,0, sizeof(LOGFONT));
			strcpy(lf.lfFaceName,"MS Shell Dlg");
			lf.lfHeight = -10;
			lf.lfWeight = FW_NORMAL;
			HFONT   hFont=CreateFontIndirect(&lf);
			wdg = CreateWindow("button", BottonPlayAll,
							   WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
							   4, 10, 80, 22, hwnd,
							   (HMENU) ID_PLAY,
							   ((LPCREATESTRUCT) lParam) -> hInstance,
							   NULL);
  			SendMessage(wdg,   WM_SETFONT,   (WPARAM)hFont,   0);

			wdg = CreateWindow ("button", BottonUp,
								WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
								4, 35, 80, 22, hwnd,
								(HMENU) ID_UP,
								((LPCREATESTRUCT) lParam) -> hInstance,
								NULL);
			SendMessage(wdg,   WM_SETFONT,   (WPARAM)hFont,   0);

			wdg = CreateWindow ("button",BottonDown,
								WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
								4, 60, 80, 22, hwnd,
								(HMENU) ID_DOWN,
								((LPCREATESTRUCT) lParam) -> hInstance,
								NULL);
  			SendMessage(wdg,   WM_SETFONT,   (WPARAM)hFont,   0);

			wdg = CreateWindow ("button", BottonRemove,
								WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
								4, 85, 80, 22, hwnd,
								(HMENU) ID_REMOVE,
								((LPCREATESTRUCT) lParam) -> hInstance,
								NULL);
  			SendMessage(wdg,   WM_SETFONT,   (WPARAM)hFont,   0);

			wdg = CreateWindow ("button", BottonAdd,
								WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
								4, 110, 80, 22, hwnd,
								(HMENU) ID_ADDFILE,
								((LPCREATESTRUCT) lParam) -> hInstance,
								NULL);
  			SendMessage(wdg,   WM_SETFONT,   (WPARAM)hFont,   0);

			wdg = CreateWindow ("button", BottonSave,
								WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
								4, 135, 80, 22, hwnd,
								(HMENU) ID_PLAYLISTSAVE,
								((LPCREATESTRUCT) lParam) -> hInstance,
								NULL);
  			SendMessage(wdg,   WM_SETFONT,   (WPARAM)hFont,   0);

			wdg = CreateWindow ("button", BottonClose,
								WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
								4, 185, 80, 22, hwnd,
								(HMENU) ID_CLOSE,
								((LPCREATESTRUCT) lParam) -> hInstance,
								NULL);
  			SendMessage(wdg,   WM_SETFONT,   (WPARAM)hFont,   0);

			GetClientRect(hwnd, &r);
			wdg = CreateWindowEx(WS_EX_CLIENTEDGE, "SysListView32", "tracklist",
					WS_CHILD | WS_VISIBLE | LVS_SINGLESEL | LVS_REPORT | LVS_SHOWSELALWAYS | LVS_NOSORTHEADER /*| LVS_NOCOLUMNHEADER*/,
					90, 7, r.right-90, r.bottom-7, hwnd, (HMENU) ID_TRACKLIST, ((LPCREATESTRUCT) lParam) -> hInstance, NULL);

  			SendMessage(wdg, WM_SETFONT, (WPARAM)hFont, 0);
			wdgProc = SetWindowLong(wdg, GWL_WNDPROC, (LONG)ListProc);
			LV_COLUMNA lvc, lvc1, lvc2;
			ZeroMemory(&lvc, sizeof(LV_COLUMNA));
			ZeroMemory(&lvc1, sizeof(LV_COLUMNA));
			ZeroMemory(&lvc2, sizeof(LV_COLUMNA));
			lvc.mask = LVCF_WIDTH;
			lvc.cx = 24;
			lvc1.mask = LVCF_WIDTH;
			lvc1.cx = 700;
			lvc2.mask = LVCF_WIDTH;
			lvc2.cx = 500;
			SendMessage(wdg, LVM_INSERTCOLUMN,0, &lvc);
			SendMessage(wdg, LVM_INSERTCOLUMN,1, &lvc1);
			SendMessage(wdg, LVM_INSERTCOLUMN,2, &lvc2);
			SendMessage(wdg, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT);
			break;
		}
		case WM_CONTEXTMENU:
		{
			GetCursorPos(&cursor);
			SetForegroundWindow(hwnd);
			TrackPopupMenu(playlistmenu, 0, cursor.x, cursor.y, 0, hwnd, NULL);
			break;
		}
		case WM_NOTIFY:
		{
			if(wParam == ID_TRACKLIST) {
				NMHDR *nmhdr = (NMHDR *)lParam;
				if(nmhdr && nmhdr->code == NM_DBLCLK) {
					int selected = SendDlgItemMessage(hwnd, ID_TRACKLIST, LVM_GETSELECTIONMARK, 0, 0);
					if(0 <= selected) {
						pl->current = selected;
						playtree_update_play(mpctx, pl->current);
						return 0;
					}
				} else if(nmhdr && nmhdr->code == NM_CLICK)
					button_down = FALSE;
			}
			break;
		}
		case WM_LBUTTONDOWN:
			PostMessage(hwnd, WM_NCLBUTTONDOWN, HTCAPTION, MAKELPARAM(LOWORD(lParam), HIWORD(lParam)));
			break;
		case WM_NCLBUTTONUP:
		case WM_LBUTTONUP:
			button_down = FALSE;
			break;
		case WM_KEYDOWN:
			switch (wParam)
			{
				case VK_ESCAPE:
					ShowWindow(hwnd, SW_HIDE);
					break;
			}
			break;
		case WM_COMMAND:
		{
			int selected = 0;
			int i = SendDlgItemMessage(hwnd, ID_TRACKLIST, LVM_GETSELECTIONMARK, 0, 0);
			if(0 <= i) selected = i + 1;
			switch (LOWORD(wParam))
			{
				case ID_CLOSE:
					if(SetLayeredWinAttributes) {
						if(transparent) {
							transparent = 0;
							SetLayeredWinAttributes(hPlaylistWnd, 0, 255, 2);
						} else {
							transparent = 1;
							SetLayeredWinAttributes(hPlaylistWnd, 0, controlbar_alpha, 2);
						}
					}
					break;
				case ID_PLAY:
					if(selected) {
						pl->current = selected - 1;
						playtree_update_play(mpctx, pl->current);
					} else
						playtree_update_play(mpctx, 0);
					return 0;
				case ID_UP:
					if(selected) pl->moveup_track(pl, selected);
					selected--;
					up_list_item(hwnd, selected);
					need_update_playtree = 1;
					return 0;
				case ID_DOWN:
					if(selected) pl->movedown_track(pl, selected);
					down_list_item(hwnd, selected-1);
					selected++;
					need_update_playtree = 1;
					return 0;
				case ID_REMOVE:
					if(selected) pl->remove_track(pl, selected);
					delete_list_item(hwnd, selected-1);
					need_update_playtree = 1;
					return 0;
				case ID_ADDFILE:
					display_openfilewindow(1);
					break;
				case ID_CLEAR:
					if(!playlist->trackcount) return 0;
					playlist->clear_playlist(playlist);
					SendDlgItemMessage(hwnd, ID_TRACKLIST, LVM_DELETEALLITEMS, 0, 0);
					need_update_playtree = 1;
					return 0;
				case ID_PLAYLISTLOAD:
					display_loadplaylistwindow();
					break;
				case ID_PLAYLISTSAVE:
				{
					/* no point saving an empty playlist */
					display_saveplaylistwindow();
					break;
				}
			}
			updatetracklist(hwnd);
			if(selected < 1) selected = 1;
			else if(selected>pl->trackcount) selected = pl->trackcount;
			SendDlgItemMessage(hwnd, ID_TRACKLIST, LVM_SETSELECTIONMARK, 0, selected - 1);
			return 0;
		}
		case WM_DROPFILES:
		{
			DWORD t;
			char file[MAX_PATH];
			wchar_t tmpw[MAX_PATH], tmpshot[MAX_PATH];
			int filecount = DragQueryFile((HDROP) wParam, -1, file, MAX_PATH);
			int i;
			for (i=0; i<filecount; i++)
			{
				DragQueryFile((HDROP) wParam, i, file, MAX_PATH);
				t = GetFileAttributes(file);
				if (t & 0x10) {
					if(t == 0xFFFFFFFF) {
						DragQueryFileW((HDROP)wParam, i, tmpw, MAX_PATH);
						GetShortPathNameW(tmpw,tmpshot,MAX_PATH);
						wcstombs(file,tmpshot,MAX_PATH);
					}
					add_directory_to_playlist(file);
				} else {
					if(t == 0xFFFFFFFF) {
						DragQueryFileW((HDROP)wParam, i, tmpw, MAX_PATH);
						GetShortPathNameW(tmpw,tmpshot,MAX_PATH);
						wcstombs(file,tmpshot,MAX_PATH);
					}
					pl->add_track(pl, file, NULL, NULL, 0);
					playtree_add_file(mpctx->playtree, file);
				}
			}
			DragFinish((HDROP) wParam);
			updatetracklist(hwnd);
			break;
		}
		case WM_SIZING:
		{
			LPRECT rc = (LPRECT)lParam;
			if(rc->right - rc->left < WinWidth-100)
				rc->right = rc->left + WinWidth-100;
			if(rc->bottom - rc->top < WinHeight-30)
				rc->bottom = rc->top + WinHeight-30;
			break;
		}
		case WM_SIZE:
		{
			RECT r;
			GetClientRect(hwnd, &r);
			MoveWindow(GetDlgItem(hwnd, ID_TRACKLIST), 90, 7, r.right-90, r.bottom-7, TRUE);
			break;
		}
		case WM_SYSCOMMAND:
		{
			if (wParam == SC_MINIMIZE) {
				ShowWindow(hwnd, SW_HIDE);
				return 0;
			}
			break;
		}
		case WM_DESTROY:
			PostQuitMessage(0);
			return 0;
	}
	return DefWindowProc(hwnd, iMsg, wParam, lParam);
}
示例#6
0
static int init_playlist()
{
	WNDCLASS wc;
	HINSTANCE user32;
	LANGID _SysLangId;
	HINSTANCE hInstance = GetModuleHandle(NULL);

	if(hPlaylistWnd) {
		updatetracklist(hPlaylistWnd);
		ShowWindow(hPlaylistWnd, SW_SHOW);
		return 0;
	}

	if(sys_Language == 1) {
		LoadString(hInstance, IDS_PLAYLIST_SC, TitalPlaylist, 20);
		LoadString(hInstance, IDS_BT_PLAY_SC, BottonPlayAll, 20);
		LoadString(hInstance, IDS_BT_UP_SC, BottonUp, 20);
		LoadString(hInstance, IDS_BT_DOWN_SC, BottonDown, 20);
		LoadString(hInstance, IDS_BT_ADD_SC, BottonAdd, 20);
		LoadString(hInstance, IDS_BT_REMOVE_SC, BottonRemove, 20);
		LoadString(hInstance, IDS_BT_SAVE_SC, BottonSave, 20);
		LoadString(hInstance, IDS_BT_CLOSE_SC, BottonClose, 20);
		LoadString(hInstance, IDS_MU_ADD_SC, MenuAdd, 20);
		LoadString(hInstance, IDS_MU_REMOVE_SC, MenuRemove, 20);
		LoadString(hInstance, IDS_MU_CLEAR_SC, MenuClear, 20);
		LoadString(hInstance, IDS_MU_CLOSE_SC, MenuClose, 20);
	} else if(sys_Language == 3 || sys_Language == 4) {
		LoadString(hInstance, IDS_PLAYLIST_TC, TitalPlaylist, 20);
		LoadString(hInstance, IDS_BT_PLAY_TC, BottonPlayAll, 20);
		LoadString(hInstance, IDS_BT_UP_TC, BottonUp, 20);
		LoadString(hInstance, IDS_BT_DOWN_TC, BottonDown, 20);
		LoadString(hInstance, IDS_BT_ADD_TC, BottonAdd, 20);
		LoadString(hInstance, IDS_BT_REMOVE_TC, BottonRemove, 20);
		LoadString(hInstance, IDS_BT_SAVE_TC, BottonSave, 20);
		LoadString(hInstance, IDS_BT_CLOSE_TC, BottonClose, 20);
		LoadString(hInstance, IDS_MU_ADD_TC, MenuAdd, 20);
		LoadString(hInstance, IDS_MU_REMOVE_TC, MenuRemove, 20);
		LoadString(hInstance, IDS_MU_CLEAR_TC, MenuClear, 20);
		LoadString(hInstance, IDS_MU_CLOSE_TC, MenuClose, 20);
	} else {
		LoadString(hInstance, IDS_PLAYLIST_EN, TitalPlaylist, 20);
		LoadString(hInstance, IDS_BT_PLAY_EN, BottonPlayAll, 20);
		LoadString(hInstance, IDS_BT_UP_EN, BottonUp, 20);
		LoadString(hInstance, IDS_BT_DOWN_EN, BottonDown, 20);
		LoadString(hInstance, IDS_BT_ADD_EN, BottonAdd, 20);
		LoadString(hInstance, IDS_BT_REMOVE_EN, BottonRemove, 20);
		LoadString(hInstance, IDS_BT_SAVE_EN, BottonSave, 20);
		LoadString(hInstance, IDS_BT_CLOSE_EN, BottonClose, 20);
		LoadString(hInstance, IDS_MU_ADD_EN, MenuAdd, 20);
		LoadString(hInstance, IDS_MU_REMOVE_EN, MenuRemove, 20);
		LoadString(hInstance, IDS_MU_CLEAR_EN, MenuClear, 20);
		LoadString(hInstance, IDS_MU_CLOSE_EN, MenuClose, 20);
	}

	code_page = CP_ACP;
	_SysLangId = GetSystemDefaultLangID();
	if(PRIMARYLANGID(_SysLangId) == LANG_CHINESE) {
		if(SUBLANGID(_SysLangId) == SUBLANG_CHINESE_SIMPLIFIED)
			code_page = 936;
		else
			code_page = 950;
	}

	wc.style		 = CS_HREDRAW | CS_VREDRAW;
	wc.lpfnWndProc   = PlayListWndProc;
	wc.cbClsExtra	= 0;
	wc.cbWndExtra	= 0;
	wc.hInstance	 = hInstance;
	wc.hCursor	   = LoadCursor(NULL,IDC_ARROW);
	mplayericon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_APPICON));
	wc.hIcon		 = mplayericon;
	wc.hbrBackground = SOLID_GREY;
	wc.lpszClassName = "MPlayer - Playlist";
	wc.lpszMenuName  = NULL;
	RegisterClass(&wc);
	create_playlistmenu();
	bkgndbrush = CreateSolidBrush(RGB(236,236,236));
	if(playlist_x < 0)
		playlist_x = (GetSystemMetrics(SM_CXSCREEN) / 2) - (WinWidth / 2);   /* Erik: center popup window on screen */
	if(playlist_y < 0)
		playlist_y = (GetSystemMetrics(SM_CYSCREEN) / 2) - (WinHeight / 2);
	hPlaylistWnd = CreateWindow("MPlayer - Playlist",
						TitalPlaylist, WS_OVERLAPPEDWINDOW | WS_SIZEBOX,
						playlist_x, playlist_y, WinWidth, WinHeight,
						playlist_parent, NULL, hInstance, NULL);

	if((vo_dirver != VO_DIRV_OPENGL || is_vista) && controlbar_alpha > 0) {
		user32 = GetModuleHandle("user32.dll");
		if (user32) {
			SetLayeredWinAttributes = GetProcAddress(user32, "SetLayeredWindowAttributes");
			if(SetLayeredWinAttributes) {
				SetWindowLong(hPlaylistWnd, GWL_EXSTYLE, GetWindowLong(hPlaylistWnd ,GWL_EXSTYLE) | WS_EX_LAYERED );
				SetLayeredWinAttributes(hPlaylistWnd, 0, 255, 2);
			}
		}
	}

	DragAcceptFiles(hPlaylistWnd, TRUE);

	if(!playlist)
		playlist = create_playlist();
	if(!need_update_playtree) {
		playlist->clear_playlist(playlist);
		import_playtree_into_playlist(mpctx->playtree, mconfig);
	}
	updatetracklist(hPlaylistWnd);
	SetWindowPos(hPlaylistWnd, playlist_layer,playlist_x,playlist_y,WinWidth,WinHeight,SWP_SHOWWINDOW);

	return 1;
}