|
try makeing the variable static
static int nVar_Subbu = 1;
nav
|
|
|
|
|
Oh! Thanks Naveen it worked, but can you pls. explain if possible why is static needed.
Rgds,
Arun.
|
|
|
|
|
Hi,
My intention of making the shared dll was that the data or a varibale that is incremented in one exe would reflect in the other. but, making it static the varables have become independent.
Scenario:
I have two exe's accessing the same variable:
i.e "nVar_Subbu" which was initially 1, I have incremented the value of this variable in one exe to 2, when accessed from the other exe it is till showing 1 instead of 2. How to go about this, can anyone help me out pls.
Rgds,
Subbu.
|
|
|
|
|
Why don't u decleare the variable in the CPP file?
nav
|
|
|
|
|
I have used
CProgressCtrl myCtrl;
myCtrl.SendMessage(PBM_SETBARCOLOR,0,RGB(255,0,0));
to change the color of the Progress bar.
But how to change back the color to original.
(If I don't know the color of original)
Please help!
|
|
|
|
|
From the docs:Return Values
Returns the previous progress indicator bar color, or CLR_DEFAULT if the progress indicator bar color is the default color.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
The previous colour is returned by the PBM_SETBARCOLOR message
COLORREF clrPrevious = (COLORREF)myCtrl.SendMessage(PBM_SETBARCOLOR, 0, RGB(255, 0, 0)); Lookup PBM_SETBARCOLOR in MSDN.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
Thank you very much!
myCtrl.SendMessage(PBM_SETBARCOLOR, 0, CLR_DEFAULT);
It is alright now!
|
|
|
|
|
Hai
i am trying to explore a project on creating and destroying threads.in that i am not understanding how to create classes which are MFC based i.e code is written by MFC.The following are classes exists in my application.
1)class CAboutDlg : public CDialog
2)class CChildView : public CWnd
3)class CMainFrame : public CFrameWnd
4)class CThreadsApp : public CWinApp
I am not able to understand how to create these classes.
i confused in which type of project to use to explore this application.
please help me .
Thanks in advance
ravishankar
|
|
|
|
|
ravi1217 wrote: ...i am not understanding how to create classes which are MFC based...
Use ClassWizard.
ravi1217 wrote: I am not able to understand how to create these classes.
They already exist. Why would you want to re-create them?
"The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli
|
|
|
|
|
To use the class wizard first i need to create a project .
I m in confusion to use which type of project to use.
if i use MFC ApplicationWizard(exe) Single Document class
then i can get these classes as follows.
Document class,viewclass ,MainFrame class and Application class
but where as in my application All classes are MFC based.
and How can then create the following classes using class wizard in my application.
1)class CAboutDlg : public CDialog
2)class CChildView : public CWnd
3)class CMainFrame : public CFrameWnd
4)class CThreadsApp : public CWinApp
ravishankar
|
|
|
|
|
ravi1217 wrote: and How can then create the following classes using class wizard in my application.
1)class CAboutDlg : public CDialog
2)class CChildView : public CWnd
3)class CMainFrame : public CFrameWnd
4)class CThreadsApp : public CWinApp
If you create an SDI application, these classes already exist. You can, however, create other classes derived from CDialog and CWnd using ClassWizard. I'm not sure creating another class from CWinApp would be a good idea since an application only needs/uses one.
"The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli
|
|
|
|
|
I have been working on a project (c++) and have noticed that one of the com ports drops out for no reason (as far as I can see). Does anyone have any ideas to why a com port would drop out without an explicit command telling it to?
thanks,
mcb36
|
|
|
|
|
It could be faulty hardware. I've seen COM ports fail before.
Try running your app on a different PC and see if it does any better.
|
|
|
|
|
Recently I use the MFC's Spliter class to split main frame as like such layout ( |- ), left pane and right pane containing top and bottom sub-pane, but I want to fix the left pane size even thought user drags the vertical border between left pane and right pane.Has any body some ideals to perform that? thanks in advance!
|
|
|
|
|
Temp83 wrote: ...but I want to fix the left pane size even thought user drags the vertical border between left pane and right pane.Has any body some ideals to perform that?
See here.
"The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli
|
|
|
|
|
Please help me
I have problem communicating bluetooth in visual c++ MFC
|
|
|
|
|
can u detail that!where is the problem which part of teh code?
cheerz!
dont want,dont want thinking,climbing on head and jumping grass!
(venda venda ennu vicharikumbol thellayill keyaree chadunnoda pulle!)
|
|
|
|
|
mahesh_patil166 wrote: I have problem communicating bluetooth in visual c++ MFC
Hi Mahesh,
Please Elobrate your question.. How can we know which class are you using to communicate between bluetooth devices or you have proper hardware for same...
or you have get struck on a particular state!..
"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
|
|
|
|
|
It appears that when you have a scrollbar in a dialog or property page, the scrollbar steals the WM_MOUSEWHEEL messages. If you have two scrollbars it's worse. One takes most of the messages when the mouse is over the dialog window unless the mouse is hovering over the other scrollbar. Is there any way to intercept or change this?
|
|
|
|
|
hi all,
i m working on an application where i want to create two document and views and want to pass data from one documnt to another.do i need to add childframe,view,document class to the MDI .i m not getting exact idea
sourabh jain
patni computers system
|
|
|
|
|
Hi all,
first of all thanks for this great site.
It has helped me a lot in the last weeks, but now i`m stuck in
a serious problem. I have a derived class of CListCtrl
In it is a custom draw method.
void CExtendedListCtrl::OnCustomdrawList ( NMHDR* pNMHDR, LRESULT* pResult )
{
NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<NMLVCUSTOMDRAW*>( pNMHDR );
*pResult = 0;
if ( CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage )
{
*pResult = CDRF_NOTIFYITEMDRAW;
}
else if ( CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage )
{
int iRow = pLVCD->nmcd.dwItemSpec;
if ((int)GetItemData(iRow) == 1)
pLVCD->clrTextBk = RGB(60,179,113);
}
*pResult = CDRF_DODEFAULT;
}
This is working fine when i add a item to the extended ListCtrl over
m_List.InsertItem and then setting the itemData to m_List.SetItemdata(1)
Now i have a huge amount of data (>100000) in the extended ListCtrl and
the insertion is getting really slow.
So i want to use OnGetDispInfo to just draw the "visibles" entries.
void CEvtlParseDlg::OnGetdispinfoList(NMHDR* pNMHDR, LRESULT* pResult)
{
LV_DISPINFO* pDispInfo = (LV_DISPINFO*)pNMHDR;
LV_ITEM* pItem= &(pDispInfo)->item;
if(pItem->mask & LVIF_TEXT)
{
if (pItem->iSubItem == 0)
{
pItem->mask=LVIF_TEXT | LVIF_PARAM;
pDispInfo->item.lParam=1;
lstrcpyn(pItem->pszText,"TEST",pItem->cchTextMax);
}
}
*pResult = 0;
}
This nearly works. I get the "TEST" text in my ListCtrl. OnCustomDrawList of
the extended List is still called, but the GetItemData always returns 0;
I also tried to get pLVCD->nmcd.lItemlParam but this value is also always 0
So how can i set itemData in the OnGetDispinfoList or is there only the way of using
InsertItem?
thx alot
t2x
|
|
|
|
|
t2x wrote: pDispInfo->item.lParam=1;
That doesn't change the actual item data, you're just modifying an LVITEM that the control set up for you to look at.. Call SetItemData() .
--Mike--
Visual C++ MVP
LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
But SetItemData is not working.
Whenever i call it in the OnGetDispinfoList
m_List.SetItemData(pItem->iItem,1);
or in an other program part i get an ASSERTION in WINCTRL2.CPP
BOOL CListCtrl::SetItem(int nItem, int nSubItem, UINT nMask, LPCTSTR lpszItem,
int nImage, UINT nState, UINT nStateMask, LPARAM lParam)
{
ASSERT(::IsWindow(m_hWnd));
ASSERT((GetStyle() & LVS_OWNERDATA)==0); <--- This one gives me the assertion
.
.
.
I can`t imagine that there is no way to set the ItemData during the virtual ListCtrl
call OnGetdispinfoList
thx t2x
|
|
|
|
|
Oh ok, you didn't mention that you were using a virtual list control. From the docs:A virtual list-view control maintains very little item information itself. Except for the item selection and focus information, the owner of the control must manage all item information. You'll need to keep the data somewhere else, a virtual list control doesn't support per-item data.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|