|
I think the suggested static modifier should prevent name collisions.
|
|
|
|
|
Hi,
I am adding somedetails of a page like page no.page title..etc..
and then im getting value from the same CptrList.
My problem is when adding to list the correct value is entered.But i get the value from list,at that time it shows wrong value.Pls help me..i ll show the code
For adding value to list..
POSITION hPos = GrPageList.GetHeadPosition();
while(hPos)
{
SGraphicsDet *pData = (SGraphicsDet *)GrPageList.GetNext(hPos);
}
pDet->iPageNo = iSelPg;//checked here..its correct
GrPageList.AddTail(pDet);
To get the value:
SGraphicsDet *pGrPgConf;
POSITION pos = GrPageList.GetHeadPosition();
while(pos)
{
pGrPgConf = (SGraphicsDet*)GrPageList.GetNext(pos);
if(pGrPgConf->iPageNo == (giSchPNo + 1))
SetSoftKeys(pGrPgConf,giSchPNo);
}
here pGrPgConf->iPageNo shows the wrong value.
For example in adding the PageNo is 1,but in getting this value it shows 0.
|
|
|
|
|
Anyway I dint go through the entire code. I suggest you to use CPtrArray instead because it is indexed. But the insertion will be much slower than List.
See the difference between the different template classes.
List
The list class provides an ordered, nonindexed list of elements, implemented as a doubly linked list. A list has a "head" and a "tail," and adding or removing elements from the head or tail, or inserting or deleting elements in the middle, is very fast.
Array
The array class provides a dynamically sized, ordered, and integer-indexed array of objects.
Map (also known as a dictionary)
A map is a collection that associates a key object with a value object.
See MSDN for more information.
SaRath.
"Where I am from, there is no plan B. So, take advantage of today becuase tomorrow is not promised. - 50 Cent"
<blink>My Blog | Understanding State Patte
|
|
|
|
|
Hi,
I created a dialog using createdialog() in win32 program .And in that in created a edit box using createwindow.
I have handled WM_CTLCOLOREDIT like this
case WM_CTLCOLOREDIT:
hdc = (HDC)wParam;
SetTextColor(hdc, RGB(0,0,255));
hdc3 = GetDC(c_hwnd);//c_hwnd is handle to button
crBkgnd = GetBkColor(hdc3);
SetBkColor(hdc,crBkgnd);
GetSysColorBrush(COLOR_3DHILIGHT);
break;
here only i can see the change of color in text but background color is not changing to button default color (color is specified in code using crBkgnd)..
whenever text appears background color will be white...
Thanking you
Manjunath S
GESL
Bangalore
|
|
|
|
|
u should return abrush by which u want to draw the background...
case WM_CTLCOLOREDIT:<br />
<br />
<br />
hdc = (HDC)wParam;<br />
SetTextColor(hdc, RGB(0,0,255));<br />
<br />
hdc3 = GetDC(c_hwnd);
<br />
crBkgnd = GetBkColor(hdc3);<br />
SetBkColor(hdc,crBkgnd);<br />
return (LRESULT)GetSysColorBrush(COLOR_3DHILIGHT);
nave
|
|
|
|
|
I have created an edit control like the following ,But when i try to changes to readonly by adding ES_READONLY to edit control .but both text color and background color is changing to default(i.e text to black and background in not changing)when i add ES_READONLY.
c_hwnd = CreateWindowEx(0, "Edit", NULL,WS_CHILD,320, 220,318, 238,
d_hnd, NULL, hInst, NULL);
if(c_hwnd == NULL) {
MessageBox(NULL, "could not create window", "Error", MB_ICONERROR);
return 0;
}
Manjunath S
GESL
Bangalore
|
|
|
|
|
ok..When u add the ES_READONLY style, instead of WM_CTLCOLOREDIT, handle WM_CTLCOLORSTATIC
nave
|
|
|
|
|
See MSDN,
From the MSDN
Read-only or disabled edit controls do not send the WM_CTLCOLOREDIT message; instead, they send the WM_CTLCOLORSTATIC message.
whitesky
|
|
|
|
|
for this work you need to return brush else system use from defalt brush
whitesky
|
|
|
|
|
How I can create a win32 DLL Project in Visual Studio 2003?
Regards
Abhi Lahare
|
|
|
|
|
New Project --> C++ folder --> Win32 Console Application
Then a wizard window will pop up, go to settings and mark the DLL checkbox.
goodluck
|
|
|
|
|
Thanks Alon
Regards
Abhishake
|
|
|
|
|
|
Hai
How can we set images for items on CtreeCtrl
Thanks in advance.
|
|
|
|
|
SetItem( TVITEM* pItem )
Regards
Abhi Lahare
|
|
|
|
|
you need to use
CImageList* SetImageList( CImageList * pImageList, int nImageListType );
before you do insertitem and in that pass the index in the imagelist you need to display .
Regards,
FarPointer
Blog:FARPOINTER
|
|
|
|
|
See SetItem and SetImageList
whitesky
|
|
|
|
|
Thanks for your reply.I got it.
But when I insert items I am getting all the items as root items.How can I insert child items in to the tree
-- modified at 3:02 Monday 10th July, 2006
|
|
|
|
|
Can you show how you to use this function
whitesky
|
|
|
|
|
BOOL CBmDialog::OnInitDialog()
{
CDialog::OnInitDialog();
CImageList list;
list.Create(16, 16, ILC_COLOR8, 0, 4);
CBitmap bm;
bm.LoadBitmap(IDB_BITMAP1);
list.Add(&bm, RGB(0, 0, 0));
m_tree1.SetImageList(&list,TVSIL_NORMAL);
m_tree1.InsertItem("Image1");
m_tree1.InsertItem("Image2");
HTREEITEM h1,h2;
h2=m_tree1.GetNextItem(h1,TVGN_FIRSTVISIBLE);
m_tree1.SetItemImage(h2,0,0);
return TRUE;
}
|
|
|
|
|
I test this code and it work (you need to a resource(bitmap))
<code>
TVINSERTSTRUCT TreeCtrlItem;
CBitmap Bmp;
CImageList *m_ImageList;
HTREEITEM hTreeItem1;
m_ImageList = new CImageList();
m_ImageList->Create(50,50, ILC_COLORDDB,0,0);
Bmp.LoadBitmap(IDB_BITMAP1);
m_ImageList->Add(&Bmp,RGB(155,155,155));
TreeCtrlItem.hParent = TVI_ROOT;
TreeCtrlItem.hInsertAfter = TVI_LAST;
TreeCtrlItem.item.mask = TVIF_TEXT |TVIF_IMAGE|TVIF_SELECTEDIMAGE;
TreeCtrlItem.item.pszText = CA2T("(A)");;
TreeCtrlItem.item.lParam = 0;
TreeCtrlItem.item.iImage=0;
TreeCtrlItem.item.iSelectedImage=0;
hTreeItem1 = m_Tree1.InsertItem(&TreeCtrlItem);
m_Tree1.SetImageList(m_ImageList, LVSIL_NORMAL);
TreeCtrlItem.hParent = hTreeItem1;
TreeCtrlItem.item.pszText = CA2T(" (B)");
TreeCtrlItem.item.lParam = 1;
TreeCtrlItem.item.iImage=1;
TreeCtrlItem.item.iSelectedImage=1;
m_Tree1.InsertItem(&TreeCtrlItem);
m_Tree1.SetImageList(m_ImageList, LVSIL_NORMAL);
whitesky
|
|
|
|
|
Thank you very much
|
|
|
|
|
I have an application that uses threads. The purpose of one thread is to Listen for any communication request from other machines. This has an infinite while loop. There have to be 2 stopping conditions for the same. One is when it receives a Stop boolean variable, it stops the whole application.
The other condition I want to add is that if it sees a global boolean variable is set (which needs to be set by some other thread of the same application) it should end that particular listen thread only (not the whole application). If I use _endthreadex() how will the other thread form which the boolean variable was set know that the listen thread has actually ended?
I was using TerminateThread() to end the Listen thread because it accepts the handle of the thread as an argument so that I was able to end the thread from some other thread but I see it is not cleaning up after Terminating the thread.
|
|
|
|
|
Programmer Anju wrote: The other condition I want to add is that if it sees a global boolean variable is set (which needs to be set by some other thread of the same application) it should end that particular listen thread only (not the whole application). If I use _endthreadex() how will the other thread form which the boolean variable was set know that the listen thread has actually ended?
program listen thread something line this
g_bEndListenThread=FALSE;
while(1)
{
if(g_bEndApplication==TRUE)
// End listen thread
return 0; or _endthreadex();
if(g_bEndListenThread==TRUE)
// End listen thread
return 0; or _endthreadex();
// Do normal functioning
}
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Programmer Anju wrote: The other condition I want to add is that if it sees a global boolean variable is set (which needs to be set by some other thread of the same application) it should end that particular listen thread only (not the whole application). If I use _endthreadex() how will the other thread form which the boolean variable was set know that the listen thread has actually ended?
program listen thread something line this
g_bEndListenThread=FALSE;
while(1)
{
if(g_bEndApplication==TRUE)
// End listen thread
return 0; or _endthreadex();
if(g_bEndListenThread==TRUE)
// End listen thread
return 0; or _endthreadex();
// Dyour Thread functioning
}
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|