|
Hi all:
My listctrl has a BMP background and one of its subitem has icon.
What the problem is that the subitem which has icon only looks transparent againt listctrl BK when the system under the default setting for "window color" which is white, once I change the default setting the subitem not transparent anymore, what's the cause?
|
|
|
|
|
How are you creating the ImageList? How are you adding the images to it? Are you adding icons or bitmaps?
I'm not sure, but your problem might be because your image list isn't a masked one.
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
Jose Lamas Rios wrote:
How are you creating the ImageList?
m_imgSmallList.Create(16, 16, ILC_COLORDDB | ILC_MASK, 6, 1);
bitmap.LoadBitmap(IDB_COMMON_ICON);
m_imgSmallList.Add(&bitmap, RGB(255, 255, 255));
Jose Lamas Rios wrote:
Are you adding icons or bitmaps?
Adding bitmaps here
|
|
|
|
|
I can't see anything wrong, unless the bitmap isn't using an exact white for the areas intended to be transparent...
Just a wild guess, but try calling SetBkColor(CLR_NONE) on the list control and see if it makes any difference.
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
No difference spotted!
After little study, I found out that the LVS_EX_FULLROWSELECT and LVS_EX_SUBITEMIMAGES seems to be mutual exclusive regarding the problem I just stated!For transparency If I specify the former property then the subitem image must be removed, If I specify the later property then the full row select property must be romoved!How come?
|
|
|
|
|
Here's the code snippet I used to populate the list control!
m_cListCtrl.DeleteAllItems();
m_cListCtrl.SetExtendedStyle(LVS_EX_SUBITEMIMAGES );
m_cListCtrl.SetTextBkColor(CLR_NONE);
LVITEM lvi;
CString strItem;
for (int i = 0; i < m_nItems; i++)
{
lvi.mask = LVIF_IMAGE | LVIF_TEXT;
strItem.Format(_T("Item %i"), i);
lvi.iItem = i;
lvi.iSubItem = 0;
lvi.pszText = (LPTSTR)(LPCTSTR)(strItem);
lvi.iImage = i%8;
m_cListCtrl.InsertItem(&lvi);
strItem.Format(_T("%d"), 10*i);
lvi.iSubItem =1;
lvi.pszText = (LPTSTR)(LPCTSTR)(strItem);
lvi.iImage = i%8;
m_cListCtrl.SetItem(&lvi);
strItem.Format(_T("%s"), COleDateTime::GetCurrentTime().Format(_T("Created: %I:%M:%S %p, %m/%d/%Y")));
lvi.iSubItem =2;
lvi.pszText = (LPTSTR)(LPCTSTR)(strItem);
m_cListCtrl.SetItem(&lvi);
}
Leave the line #2 comment there transparency was gained, once comment out it, the subitem with icon is not tranparent!But the question is I want the both list properties!
Pls note: The system is not under default "window color"!
Same problem happens regardless what the system "window color" is!
|
|
|
|
|
YongSheng Li wrote:
m_cListCtrl.SetTextBkColor(CLR_NONE);
Just in case, what I suggested was SetBkColor . Did you try with that too?
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
Jose Lamas Rios wrote:
what I suggested was SetBkColor
m_cListCtrl.DeleteAllItems();
m_cListCtrl.SetTextBkColor(CLR_NONE);
m_cListCtrl.SetBkColor(CLR_NONE);
Is that what you recommanded!
The problem remains, All the subitem with icon still opaque and consistent the system "window color"!
|
|
|
|
|
YongSheng Li wrote:
Is that what you recommanded!
Yes.
YongSheng Li wrote:
The problem remains, All the subitem with icon still opaque and consistent the system "window color"!
All right, I'm lost. I can't think of anything else to try...
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
Jose Lamas Rios wrote:
All right, I'm lost. I can't think of anything else to try...
Thank you!anyway!
|
|
|
|
|
hI guys..
i have a bit of back ground in c and now is given a project on vbC++.. i was suppose to create a program for my com to connect to a PLC(programmeable logic control) the progam is suppose to give me the status on the relay swithces status for my plc.. Any idea guys on how to start doing it?
|
|
|
|
|
cue_ball wrote:
i have a bit of back ground in c and now is given a project on vbC++..
Is that VB or VC++ ? What version of VC ?
cue_ball wrote:
i was suppose to create a program for my com to connect to a PLC(programmeable logic control) the progam is suppose to give me the status on the relay swithces status for my plc..
How does it connect to the PC ? If via parallel or serial ports, there are articles on this site on how to listen/speak to both of these.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
IT visual c++..
im using vc++ 6.0
|
|
|
|
|
And the interface to this device ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
im using a rs232c cable..
the plc im using is from matsushita modal fp2 and joined by et-lan.
|
|
|
|
|
RS232 is serial, right ? Search this site in the search box above for 'serial port' and you'll find heaps of code.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
YUp.. 232 is serial..
thanks will try searchin first
|
|
|
|
|
hi guys.
i know it kinda of hard to explain to a newbies. how to write a serial port pro .. i try readin it up.. n down load some sample code.. but i just dont know where to use it..
basiclly i just need to come up with a simple dialog interface that .. will sent what i type in a textbox out thought a serial port.. and hint guys..
|
|
|
|
|
I am currently integrating a correctly running windows service and a win32 application into a windows service which will listening to certain sockets with specified port. Individually, both of them works fine.
When i replace the endlessloop of the windows service with a segment of code which creates a socket instance, the service failed to start.
Can anybody explain to me the reason or suggest some rational modification that i should make to solve the problem...
Thanks for any help in advance!
|
|
|
|
|
zhaopi wrote:
When i replace the endlessloop of the windows service with a segment of code which creates a socket instance, the service failed to start.
What does "failed to start" means exactly?
zhaopi wrote:
Can anybody explain to me the reason or suggest some rational modification that i should make to solve the problem...
It's hard to do that with the info you provide.
Perhaps if you give more details about the error and post a code snippet showing what you are doing, someone may suggest something useful.
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
Heck - I like your answer better than mine (see below) - we must have been sending a response at roughly the same time ..
'G'
|
|
|
|
|
Garth J Lancaster wrote:
Heck - I like your answer better than mine (see below)
I don't think mine is better. I think they complement each other.
Cheers,
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
Do you do any logging of the service startup and your own code ?
If the service was working before you added your code, then obviously its something in the socket init sequence thats doing it - so you need to put logging steps around this area of your code - did you test the code that creates the socket instance OUTSIDE the service ?? its easier to test such things from a standalone exe first, THEN add them to a service (imho)
Either way, you should be using the Application Event log (judiciously) and other logging methods when you're in the service.
'G'
|
|
|
|
|
Thanks for all your help,
i have checked my code and the problem has been solved.
|
|
|
|
|
I used nmake command to make a lib file, such as a.lib, and it's used in a project which include the "a.h". when I compile this project, there are such errors as follow:
Linking...
libcmtd.lib(crt0dat.obj) : error LNK2005: _exit already defined in msvcrtd.lib(MSVCRTD.dll)
libcmtd.lib(crt0dat.obj) : error LNK2005: __exit already defined in msvcrtd.lib(MSVCRTD.dll)
libcmtd.lib(fpinit.obj) : error LNK2005: __ldused already defined in a previous module
libcmtd.lib(fpinit.obj) : error LNK2005: __fltused already defined in a previous module
libcmtd.lib(crt0init.obj) : error LNK2005: ___xc_z already defined in msvcrtd.lib(cinitexe.obj)
libcmtd.lib(crt0init.obj) : error LNK2005: ___xc_a already defined in msvcrtd.lib(cinitexe.obj)
libcmtd.lib(crt0init.obj) : error LNK2005: ___xi_z already defined in msvcrtd.lib(cinitexe.obj)
libcmtd.lib(crt0init.obj) : error LNK2005: ___xi_a already defined in msvcrtd.lib(cinitexe.obj)
libcmtd.lib(winxfltr.obj) : error LNK2005: __XcptFilter already defined in msvcrtd.lib(MSVCRTD.dll)
libcpmtd.lib(locale.obj) : error LNK2005: "public: class std::locale & __thiscall std::locale::_Addfac(class std::locale::facet *,unsigned int,unsigned int)" (?_Addfac@locale@std@@QAEAAV12@PAVfacet@12@II@Z) already defined in msvcprtd.lib(MSVCP60D.d
ll)
libcpmtd.lib(locale.obj) : error LNK2005: "public: __thiscall std::_Locinfo::_Locinfo(char const *)" (??0_Locinfo@std@@QAE@PBD@Z) already defined in msvcprtd.lib(MSVCP60D.dll)
libcpmtd.lib(locale.obj) : error LNK2005: "public: __thiscall std::_Locinfo::~_Locinfo(void)" (??1_Locinfo@std@@QAE@XZ) already defined in msvcprtd.lib(MSVCP60D.dll)
libcpmtd.lib(locale0.obj) : error LNK2005: "public: class std::locale::facet const * __thiscall std::locale::_Getfacet(unsigned int,bool)const " (?_Getfacet@locale@std@@QBEPBVfacet@12@I_N@Z) already defined in msvcprtd.lib(MSVCP60D.dll)
libcpmtd.lib(locale0.obj) : error LNK2005: "public: bool __thiscall std::locale::_Iscloc(void)const " (?_Iscloc@locale@std@@QBE_NXZ) already defined in msvcprtd.lib(MSVCP60D.dll)
libcpmtd.lib(locale0.obj) : error LNK2005: "private: static class std::locale::_Locimp * __cdecl std::locale::_Init(void)" (?_Init@locale@std@@CAPAV_Locimp@12@XZ) already defined in msvcprtd.lib(MSVCP60D.dll)
libcpmtd.lib(ios.obj) : error LNK2005: "public: void __thiscall std::ios_base::clear(int,bool)" (?clear@ios_base@std@@QAEXH_N@Z) already defined in msvcprtd.lib(MSVCP60D.dll)
libcpmtd.lib(ios.obj) : error LNK2005: "public: virtual __thiscall std::ios_base::~ios_base(void)" (??1ios_base@std@@UAE@XZ) already defined in msvcprtd.lib(MSVCP60D.dll)
libcpmtd.lib(ios.obj) : error LNK2005: "protected: void __thiscall std::ios_base::_Addstd(void)" (?_Addstd@ios_base@std@@IAEXXZ) already defined in msvcprtd.lib(MSVCP60D.dll)
libcpmtd.lib(ios.obj) : error LNK2005: "protected: void __thiscall std::ios_base::_Init(void)" (?_Init@ios_base@std@@IAEXXZ) already defined in msvcprtd.lib(MSVCP60D.dll)
libcpmtd.lib(iostream.obj) : error LNK2005: "public: __thiscall std::ios_base::Init::Init(void)" (??0Init@ios_base@std@@QAE@XZ) already defined in msvcprtd.lib(MSVCP60D.dll)
libcpmtd.lib(iostream.obj) : error LNK2005: "public: __thiscall std::ios_base::Init::~Init(void)" (??1Init@ios_base@std@@QAE@XZ) already defined in msvcprtd.lib(MSVCP60D.dll)
libcpmtd.lib(xwctomb.obj) : error LNK2005: __Getcvt already defined in msvcprtd.lib(MSVCP60D.dll)
msvcrtd.lib(MSVCRTD.dll) : error LNK2005: __setmbcp already defined in libcmtd.lib(mbctype.obj)
LINK : warning LNK4098: defaultlib "msvcrtd.lib" conflicts with use of other libs; use /NODEFAULTLIB:library
msvcrtd.lib(cinitexe.obj) : warning LNK4098: defaultlib "libcmtd.lib" conflicts with use of other libs; use /NODEFAULTLIB:library
libcmtd.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/GATest.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
I think maybe there is conflict between my lib and VC, so how can I avoid these errors?
Thank you very much!
|
|
|
|