|
|
#1 | |
|
Junior Member
Join Date: Oct 2003
Posts: 8
|
about function "WADlg_init(hwndWinamp)" in "wa_dlg.h"
i want to create a windows in General Purpose Plugin,
but i can't use winamp skin at my windows through function "WADlg_init(hwndWinamp)" who can help me? thanks!!!!!!!! Quote:
|
|
|
|
|
|
|
#2 |
|
-
Join Date: Sep 2003
Location: UK
Posts: 22,265
|
you seem to be having problems with this window thing - i'll try and get an example up for you for tomorrow (hopefully you can wait till then
)-daz |
|
|
|
|
|
#3 |
|
-
Join Date: Sep 2003
Location: UK
Posts: 22,265
|
just a quick reply on this, for the code to compile correctly the source file you are using needs to end in *.cpp (is due to the way the header has been written)
as for an example i've got something that will have a winamp skin style in a window but it's not using a full winamp window frame at the moment will post once i've done it all (along with all my other bits to do )-daz |
|
|
|
|
|
#4 |
|
Junior Member
Join Date: Feb 2003
Posts: 48
|
Daz
did you ever get the winamp window frame working.. I think its been mentioned elsewhere, but I would really love a General plugin using the new api, with a simple "hello world" in a skinned window. kind regards G |
|
|
|
|
|
#5 |
|
-
Join Date: Sep 2003
Location: UK
Posts: 22,265
|
not forgotten
i just haven't had as much time as i wanted.i got the internal parts of a winamp style window working, it's just the outer frame to do (and i found the correct part in the headers last night). i'll try to get it done for tomorrow (may use it myself for some bit's i'm doing...) -daz |
|
|
|
|
|
#6 |
|
Junior Member
Join Date: Feb 2003
Posts: 48
|
any chance of it being MFC?
|
|
|
|
|
|
#7 |
|
-
Join Date: Sep 2003
Location: UK
Posts: 22,265
|
it's all pure 'c' at the moment. it's basically a few sendmessage calls at the end of the day. the only mfc bits would be the on_message handlers and things like that for the dialog proceedure which is fairly easy for someone else to convert over to
![]() -daz |
|
|
|
|
|
#8 |
|
Forum Pirate
Beta Team Join Date: Oct 2001
Posts: 2,032
|
never ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever ever use MFC, always use win32 api... mfc = slow and pooeh compaired to directly using the api
|
|
|
|
|
|
#9 | |
|
Junior Member
Join Date: Oct 2003
Posts: 8
|
Quote:
i am back, and very grateful after i see you article. thanks! |
|
|
|
|
|
|
#10 |
|
-
Join Date: Sep 2003
Location: UK
Posts: 22,265
|
here it is.
it's a 'c' example but read the notes in the source (should be clear) to get an idea of a few things that are needed to be done. any problems then don't hesitate to ask, enjoy ![]() -daz |
|
|
|
|
|
#11 | ||
|
Junior Member
Join Date: Oct 2003
Posts: 8
|
thanks! it run best on winamp 5
![]() but i have another question, My Code: Quote:
Quote:
but winamp base skin don't display, why? Last edited by Lemonsoft; 5th November 2003 at 02:55. |
||
|
|
|
|
|
#12 | |
|
-
Join Date: Sep 2003
Location: UK
Posts: 22,265
|
Quote:
with your problem, you need to alter the window styles used for the window you are creating. i think you need WS_CHILD and WS_VISIBLE and to change to CreateWindowEx using WS_EX_CONTROLPARENT as the extended window style. i'll check it tonight and post you a new version unless you beat me to it (the part above should be part on the way to things). also as a point of interest for you, it may be an idea to allow the ability to create a normal owner window as i think you had incase winamp is not able to return a valid window to use (such as on versions below 2.9x). -daz |
|
|
|
|
|
|
#13 |
|
Junior Member
Join Date: Feb 2003
Posts: 48
|
Bizzy D.
I'm not just usign MFC for the sheer fun of it, (in fact I'm preety sure no fun is to be gained at all) but because I need the message pump for my plugin which involves lots of two way serial communication for a remote control. Is there an easier way of doing this that I skipped over? I'm using the CSerial on codeporject at the mo. Dr. O cheers for that, I look forward to butchering your code beyong recognition. |
|
|
|
|
|
#14 | |
|
-
Join Date: Sep 2003
Location: UK
Posts: 22,265
|
Quote:
![]() as for the MFC thing i agree with Bizzy D. about it but i'm sure you can do waht you need without using MFC since at the end of the day it is just a big wrapper for the basic win32 functions (codeproject and codeguru should be able to help) -daz |
|
|
|
|
|
|
#15 |
|
Junior Member
Join Date: Feb 2003
Posts: 48
|
Dr.O sorry this is goign to be a total n00b question.
when I add another dialog box (for say a configuration screen) when I actually creat the class and .cpp file in MS visual studio. it will no longer link. I get lots of errors like "gen_test4 error LNK2005: "int __cdecl WADlg_getColor(int)" (?WADlg_getColor@@YAHH@Z) already defined in gen_test4.obj" can you help me? |
|
|
|
|
|
#16 |
|
Banned
Join Date: Jan 2001
Location: Norway
Posts: 927
|
Dialog mess...
The shit you are talking about is just some custom code
written by Nullsoft inside wa_dlg.h. It's purpose is to owner-draw (paint) various buttons and edit boxes in your dialog so they look like Winamp. When designing the dialog template remember to set the Owner-draw style for the control to on (checked). Then call WADlg_handleDialogMsgs in your WndProc like this: { int a=WADlg_handleDialogMsgs( hwnd, message, wParam, lParam); if (a) return a; } You must return from the Window Procedure if WADlg_handleDialogMsgs returns something else than NULL. I sorted this out after looking at the Media Library example (ml_ex). Have closer look at this you too (plural). Then you have the option of embedding your dialog (which must have the WS_CHILD style as its only style set) in a "General Wnd" window. To do this set up an embedWindowStruct: HWND (*embedWindow)=0; embedWindow = SendMessage(hwndWinamp, WM_WA_IPC, 0, IPC_GETEMBEDIF); embedWindowStruct ews; ews.flags = 0; SetRect(&ews.r, 0, 0, 320, 240); embedWindow(&ews); SetWindowText(ews.me, "My filthy window!"); ShowWindow(ews.me, SW_SHOW); SetParent(yourdlghandle, ews.me); Question: What I need to know is: How do Winamp paint the Scroll-bars in the Media Library. How do you owner-draw scroll-bars. Is Winamp using some custom control scroll-bar thingy?? |
|
|
|
|
|
#17 | ||
|
Junior Member
Join Date: Oct 2003
Posts: 8
|
Quote:
![]() I try your way,but CreateWindowEx Error and GetLasterror returned 1406. 1406: Cannot create a top-level child window. ERROR_TLW_WITH_WSCHILD Quote:
|
||
|
|
|
|
|
#18 |
|
-
Join Date: Sep 2003
Location: UK
Posts: 22,265
|
@gb115: the problem is that the header can only be included once - forgot to mention that, oops (is because the parts in the header are statically defined and so you get the link error).
@saivert: i'm looking into that one already at the moment for my forth coming plugin - will post what i find out -daz |
|
|
|
|
|
#19 |
|
Forum King
Join Date: Mar 2004
Location: Sweden
Posts: 2,263
|
Skin
Lemonsoft: You ever solved that? I have the same problem...
|
|
|
|
|
|
#20 |
|
-
Join Date: Sep 2003
Location: UK
Posts: 22,265
|
Joonas: there is no parent assigned to the window in Lemonsoft's CreateWindowEx(..) and that's why it fails.
-daz |
|
|
|
|
|
#21 |
|
Senior Member
|
oh... and there is a restriction (bug?) that you cannot have more than one wadlg with the same window name... otherwise, the second one will not have it's frame drawn properly... learnt the hard way... debugged for days... when i'm trying to get multiple Album List windows up...
i have some code around too... if you guys have questions still...
Album List for Winamp - Download: v1.43, v2.06, v2.07 beta Wallpaper for Playlist Editor - Download: v1.06 |
|
|
|
|
|
#22 |
|
Forum King
Join Date: Mar 2004
Location: Sweden
Posts: 2,263
|
Code!
Yeah, I would love any code on this subject. The gen_wa2dlg project is great but somewhat limited.
I also wonder if someone knows how to skin a listview control? /Jonas |
|
|
|
|
|
#23 |
|
-
Join Date: Sep 2003
Location: UK
Posts: 22,265
|
ListView_SetTextColor(enq_list,WADlg_getColor(WADLG_ITEMFG));
ListView_SetBkColor(enq_list,WADlg_getColor(WADLG_ITEMBG)); ListView_SetTextBkColor(enq_list,WADlg_getColor(WADLG_ITEMBG)); that will set the colours for the listview control though it won't do the scrollbars and header control - i'm trying to update wa_dlg.h to provide support for most controls (like the tab control, etc - as the skinned prefs plugin in my signature does) as for the example, yes it is limited but that was the best i knew at the time if i can get the time i will try to update the example with the extra fixes that are incorporated into jtfe (since the example was using the original window skinning code i was using for jtfe at the time)-daz |
|
|
|
|
|
#24 |
|
Senior Member
|
custom draw code for the header control...
PHP Code:
Album List for Winamp - Download: v1.43, v2.06, v2.07 beta Wallpaper for Playlist Editor - Download: v1.06 |
|
|
|
|
|
#25 |
|
Senior Member
|
for custom scrollbar... check this article... this is what media library is using...
http://www.codeproject.com/dialog/coolscroll.asp here is the custom draw for the "coolsb"... PHP Code:
Album List for Winamp - Download: v1.43, v2.06, v2.07 beta Wallpaper for Playlist Editor - Download: v1.06 |
|
|
|
|
|
#26 |
|
Senior Member
|
the end result will look something like this...
Album List for Winamp - Download: v1.43, v2.06, v2.07 beta Wallpaper for Playlist Editor - Download: v1.06 |
|
|
|
|
|
#27 |
|
-
Join Date: Sep 2003
Location: UK
Posts: 22,265
|
some nice little bits of code in there
![]() -daz |
|
|
|
|
|
#28 |
|
Forum King
Join Date: Mar 2004
Location: Sweden
Posts: 2,263
|
The winamp style close button
Hmm, I add my listview dynamically with CreateWindow but when I press the close button on the skinned window it just closes (or hides?) the listview. What command are being sent when I press that button? And to which window?
/Jonas |
|
|
|
|
|
#29 |
|
Forum King
Join Date: Mar 2004
Location: Sweden
Posts: 2,263
|
Two problems with Listview header skin
I posted Safai about one of these issues but I'll guess I take them both here as well.
First - The post-paint seems to erase the header controls sometimes. Often happens when the mouse is nearby...might be connected to the other issue... Which is that I am using a virtual listview but when the header control code Safai used is implemented none of the items is shown. When removed it works fine... Any help would be highly appreciated. /Jonas |
|
|
|
|
|
#30 |
|
Senior Member
|
Joonas: i got your PM... but i guess i will answer here...
1) there was an issue when reordering the headers (drag&drop the column headers) that i had recently fixed but i guess the source that i posted was not up to date... sorry about that... other than that, i have never encountered that problem... replacement code for postpaint PHP Code:
pnmh->idFrom == 0 pnmh->code == NM_CUSTOMDRAW Album List for Winamp - Download: v1.43, v2.06, v2.07 beta Wallpaper for Playlist Editor - Download: v1.06 |
|
|
|
|
|
#31 | |
|
Senior Member
|
Re: The winamp style close button
Quote:
and this is what i do in mine... PHP Code:
Album List for Winamp - Download: v1.43, v2.06, v2.07 beta Wallpaper for Playlist Editor - Download: v1.06 |
|
|
|
|
|
|
#32 |
|
-
Join Date: Sep 2003
Location: UK
Posts: 22,265
|
i've just taken this out of jtfe from my subclassed window frame proc. by catching either of the messages it's possible to allow/disallow a close and call the relevant window destructors, etccode: -daz |
|
|
|
|
|
#33 |
|
Forum King
Join Date: Mar 2004
Location: Sweden
Posts: 2,263
|
still trouble
Here is my windowproc...same problem as before though even with that new postpaint. if you have the time you could perhaps point out what I'm doing wrong...
LRESULT bleh = CallWindowProc(oProc, wnd, msg, wParam, lParam); switch (msg) { case WM_NOTIFY: { switch (((LPNMHDR)lParam)->code) { case LVN_GETDISPINFO: // dynamisk fråga om listview item som ska ritas upp { LV_DISPINFO* pDispInfo = (LV_DISPINFO*)lParam; if (pDispInfo->item.mask & LVIF_TEXT) { int index = pDispInfo->item.iItem; FILESTRUCT* t = general->getFileStruct(index); if (!general->isTagged(t)) { ID3* tag = general->getWinampInterface()->getID3(strdup(t->path.c_str())); t->title = strdup(tag->title); t->artist = strdup(tag->artist); t->album = strdup(tag->album); t->tagged = true; delete tag; } switch (pDispInfo->item.iSubItem) { case 0: strcpy(pDispInfo->item.pszText, t->title); break; case 1: strcpy(pDispInfo->item.pszText, t->artist); break; case 2: strcpy(pDispInfo->item.pszText, t->album); break; case 3: strcpy(pDispInfo->item.pszText, t->path.c_str()); break; } } // end if break; } // end case break; } // end switch case LISTVIEW: // om meddelandet gäller listview { NMCUSTOMDRAW* pCD = (NMCUSTOMDRAW*)lParam; switch (pCD->dwDrawStage) { case CDDS_PREPAINT: { if (pCD->hdr.idFrom != 0) return CDRF_NOTIFYITEMDRAW|CDRF_NOTIFYPOSTPAINT; } case CDDS_ITEMPREPAINT: { HBRUSH hbr = CreateSolidBrush(WADlg_getColor(WADLG_LISTHEADER_BGCOLOR)); FillRect(pCD->hdc, &pCD->rc, hbr); DeleteObject(hbr); HPEN pen1=CreatePen(PS_SOLID,0,WADlg_getColor(WADLG_LISTHEADER_FRAME_TOPCOLOR)); HPEN pen2=CreatePen(PS_SOLID,0,WADlg_getColor(WADLG_LISTHEADER_FRAME_MIDDLECOLOR)); HPEN pen3=CreatePen(PS_SOLID,0,0); HGDIOBJ o=SelectObject(pCD->hdc, pen1); if ((pCD->uItemState & CDIS_SELECTED) == CDIS_SELECTED) { SelectObject(pCD->hdc, pen3); MoveToEx(pCD->hdc,pCD->rc.left,pCD->rc.bottom,NULL); LineTo(pCD->hdc,pCD->rc.left,pCD->rc.top); LineTo(pCD->hdc,pCD->rc.right-1,pCD->rc.top); LineTo(pCD->hdc,pCD->rc.right-1,pCD->rc.bottom-1); LineTo(pCD->hdc,pCD->rc.left,pCD->rc.bottom-1); } else { // left, top MoveToEx(pCD->hdc,pCD->rc.left,pCD->rc.bottom,NULL); LineTo(pCD->hdc,pCD->rc.left,pCD->rc.top); LineTo(pCD->hdc,pCD->rc.right,pCD->rc.top); // right, bottom SelectObject(pCD->hdc, pen2); MoveToEx(pCD->hdc,pCD->rc.left+1,pCD->rc.bottom-2,NULL); LineTo(pCD->hdc,pCD->rc.right-2,pCD->rc.bottom-2); LineTo(pCD->hdc,pCD->rc.right-2,pCD->rc.top); // right, bottom (black line) SelectObject(pCD->hdc, pen3); MoveToEx(pCD->hdc,pCD->rc.left,pCD->rc.bottom-1,NULL); LineTo(pCD->hdc,pCD->rc.right-1,pCD->rc.bottom-1); LineTo(pCD->hdc,pCD->rc.right-1,pCD->rc.top-1); } SetTextColor(pCD->hdc, WADlg_getColor(WADLG_LISTHEADER_FONTCOLOR)); SetBkMode(pCD->hdc, TRANSPARENT); char name[MAX_PATH] = ""; HDITEM hdi; hdi.mask = HDI_TEXT|HDI_FORMAT; hdi.pszText = name; hdi.cchTextMax = MAX_PATH; Header_GetItem(pCD->hdr.hwndFrom, pCD->dwItemSpec, &hdi); RECT rcItem = pCD->rc; rcItem.left += 5; rcItem.right -= 5; rcItem.top ++; if ((pCD->uItemState & CDIS_SELECTED) == CDIS_SELECTED) { rcItem.left ++; rcItem.right ++; } int align = (hdi.fmt & HDF_JUSTIFYMASK) == LVCFMT_RIGHT ? DT_RIGHT : DT_LEFT; DrawText(pCD->hdc, hdi.pszText, -1, &rcItem, align | DT_VCENTER | DT_SINGLELINE); // clean up SelectObject(pCD->hdc, o); DeleteObject(pen1); DeleteObject(pen2); DeleteObject(pen3); return CDRF_SKIPDEFAULT; } case CDDS_POSTPAINT: { int nRight = 0; int nCount = Header_GetItemCount(pCD->hdr.hwndFrom); for (int i=0; i<nCount; ++i) { RECT rc1; Header_GetItemRect(pCD->hdr.hwndFrom, i, &rc1); nRight = max(nRight, rc1.right); } RECT rc; GetClientRect(listview->getHWND(), &rc); //listview is an object of mine that acts a wrapper for the listview control, returns the HWND for it... if (nRight < rc.right) { rc.left = nRight; rc.right += 10; HBRUSH hbr = CreateSolidBrush(WADlg_getColor(WADLG_LISTHEADER_EMPTY_BGCOLOR)); FillRect(pCD->hdc, &rc, hbr); DeleteObject(hbr); } return CDRF_DODEFAULT; } // end case NM_CUSTOMDRAW } // end switch } // end case LISTVIEW } // end case WM_NOTIFY } // end switch return bleh; |
|
|
|
|
|
#34 |
|
Forum King
Join Date: Mar 2004
Location: Sweden
Posts: 2,263
|
ehm correction
Sorry, this line is of course invalid:
if (pCD->hdr.idFrom != 0) return CDRF_NOTIFYITEMDRAW|CDRF_NOTIFYPOSTPAINT; it should only be return CDRF_NOTIFYITEMDRAW|CDRF_NOTIFYPOSTPAINT; but the problem remains... /Jonas |
|
|
|
|
|
#35 |
|
Senior Member
|
what's that LISTVIEW thing? shouldn't it be NM_CUSTOMDRAW, also, getting the CUSTOMDRAW message should be done inside the listview's window proc
assuming the code you posted is not listview's, if it is, i don't know how that LVN_GETDISPINFO notification will work in your case, cuz that should be handled in the parent of listview... Album List for Winamp - Download: v1.43, v2.06, v2.07 beta Wallpaper for Playlist Editor - Download: v1.06 |
|
|
|
|
|
#36 |
|
Forum King
Join Date: Mar 2004
Location: Sweden
Posts: 2,263
|
I don't know if I have a Listview window proc per se...I am not using MFC...I run it all through the window procedure...guess I have to try something later on..
|
|
|
|
|
|
#37 | |
|
Forum King
Join Date: Mar 2004
Location: Sweden
Posts: 2,263
|
Quote:
Thanks!/Jonas |
|
|
|
|
|
|
#38 |
|
Forum King
Join Date: Mar 2004
Location: Sweden
Posts: 2,263
|
more trouble..
Jesus...the problems never end. Bear with me for a little bit more
![]() When I add (dynamically) the listview to the window I receive back from window = (HWND)SendMessage(winampWindow, WM_WA_IPC, (WPARAM)wa_wnd, IPC_GET_EMBEDIF); everything seems well, except that when the window is moved (repainted I presume) it auto-fits the listview to cover the entire window which isn't exactly what I want...I have other controls I want to add there too...anyone knows why it does that? /Jonas |
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|