|
Mark, many thanks for help. I have tried to omit the last parameter, but it doesn't work .
I will try to use CButton instead of tool bar.
|
|
|
|
|
So the buttons diable but they don't look disabled?
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hi Mark,
If I ommited the last parameter, buttons are not disabled.
|
|
|
|
|
I just downloaded the source - I'll take a look.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Ok..
It all works fine in the authors demo app.
The author actually omits the last parametr in the call to CTrueColorToolBar::LoadTrueColorToolBar
for the RIGHT toolbar. So, the right toolbar shows button bitmaps grayed by the system.
For the left toolbar he uses special bitmaps for disabled buttons that don't have any color,
just white/black/grays.
All the buttons except the first three on left and right are disabled. If you try to disable them
yourself they won't look any different
To enable them, you can add command enablers. For example, there's 9 buttons on the toolbars.
I enabled the 7th and 8th buttons like this (in MainFrm.cpp/.h):
afx_msg void OnUpdateButton32777(CCmdUI* pCmdUI);
afx_msg void OnUpdateButton32778(CCmdUI* pCmdUI);
ON_UPDATE_COMMAND_UI(ID_BUTTON32777, OnUpdateButton32777)
ON_UPDATE_COMMAND_UI(ID_BUTTON32778, OnUpdateButton32778)
void CMainFrame::OnUpdateButton32777(CCmdUI* pCmdUI)
{
pCmdUI->Enable(TRUE);
}
void CMainFrame::OnUpdateButton32778(CCmdUI* pCmdUI)
{
pCmdUI->Enable(TRUE);
}
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Ok...
I have dialog based MFC application
There is no ON_UPDATE_COMMAND_UI command
|
|
|
|
|
Romiks wrote: I have dialog based MFC application
Oh yeah, I forgot about that, sorry
Well I still go back to this:
// Disable button ID_BUTTON32777 in m_ToolBar
m_ToolBar.GetToolBarCtrl().EnableButton(ID_BUTTON32777, FALSE);
// Enable button ID_BUTTON32777 in m_ToolBar
m_ToolBar.GetToolBarCtrl().EnableButton(ID_BUTTON32777, TRUE);
I'm not sure why that doesn't work for you - I just tested it in a dialog toolbar here.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
If you have working dialog based project, could you please send me?
my mail:losqut@yandex.ru
As for me, buttons are not greyed
|
|
|
|
|
When using the Visual Studio Installer to create an installation, if I add a VC++ redistributable merge module (.msm) file to the solution, the installation puts the .dll(s) into the target directory.
Is there a way to have the installer put those in a subdirectory of the targetdir without having to open the .msi up with orca.exe and modifying stuff in there?
I'm trying to put those dll(s) in the equivalent of a bin directory along with my other dll(s) and ocx files.
|
|
|
|
|
While creating simple test multithreading application ,I am getting this bug.
I made function global.I dont want to declare static,I dont know whats wrong.
void CCustom1Dlg::OnButton1()
{
// TODO: Add your control notification handler code here
int m = 5;
CWinThread* tt;
tt = AfxBeginThread(Myfunc,&m,THREAD_PRIORITY_NORMAL,0,0,NULL);
}
UINT Myfunc(LPVOID pParam)
{
int* co = reinterpret_cast<int*>(pParam);
return 0;
}
Can anyone tell me,I searched many articles for bug,and all concludes that it must be
global or static,now I have global.still bug is pidding. My project settings are proper
for run time library.
|| ART OF LIVING ||
|
|
|
|
|
Do you still get the error if you declare your thread proc before the call to AfxBeginThread()?
UINT Myfunc(LPVOID pParam);
void CCustom1Dlg::OnButton1()
{
// TODO: Add your control notification handler code here
int m = 5;
CWinThread* tt;
tt = AfxBeginThread(Myfunc,&m,THREAD_PRIORITY_NORMAL,0,0,NULL);
}
UINT Myfunc(LPVOID pParam)
{
int* co = reinterpret_cast(pParam);
return 0;
}
*edit* You don't want to pass &m to your thread...m can/will go out of scope before MyFunc() uses<br />
it.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Looks like we posted a response at the same time
|
|
|
|
|
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Sorry,delayed responce,
If I made variable global ,written function declaration,where you shown but error is very same. No Change.
|| ART OF LIVING ||
|
|
|
|
|
From your posts below, it looks like you fixed it, right?
You'll still have to make sure any variables pointed to by a pointer passed to another thread
stay in existence until all threads that use the variable are done using it!
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
yes that was another mistake
|| ART OF LIVING ||
|
|
|
|
|
Give this a try: (note the placement of the Myfunc function declaration before OnButton1 handler and note the use of the _cdecl modifier)
Hope this helps
//------------------------------------------
UINT _cdecl Myfunc(LPVOID pParam);
void CCustom1Dlg::OnButton1()
{
// TODO: Add your control notification handler code here
int m = 5;
CWinThread* tt;
tt = AfxBeginThread(Myfunc,&m,THREAD_PRIORITY_NORMAL,0,0,NULL);
}
UINT _cdecl Myfunc(LPVOID pParam)
{
int* co = reinterpret_cast(pParam);
return 0;
}
|
|
|
|
|
shivditya wrote: ...it must be
global or static,now I have global.still bug is pidding.
Did you remember to remove it from CCustom1Dlg 's header file?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Sorry man I got my silly mistake ,I declared one more void MyFunc() in .h
file. I am very very sorry for wasting all of yours important time and effort
|| ART OF LIVING ||
|
|
|
|
|
you are great
|| ART OF LIVING ||
|
|
|
|
|
Hi...
Here's another CE C++ question....
I have a list control. Items are listed in bolded red as added to the control. Once a user had addressed an item, I would like to change the text of that one item to unbolded black.
In CE C++ I can find a way to change the color of all items in the list control.
I cannot find a way to bold/unbold the text for only one line of the control list.
I also cannot find a way to change the font of the text for only one line of the control list.
Can any of this be done in Window CE C++? If it can be done how... any hint would be greatly appreciated.
|
|
|
|
|
|
Hi,
I would like to change the font and size of text in static text...
I have been able to change color. here are the command lines I use to do that.
pDC->SetBkMode(TRANSPARENT);
pDC->SetTextColor(RGB(0, 0, 255));//blue
But have not found a say to set the font or font size. Is it possible to set the font size and color for a static text control in MS CE C++ (v4.0)? If it is can anyone give me a hint of how to do this?
Thanks
-- modified at 12:27 Thursday 7th June, 2007
|
|
|
|
|
Two steps are needed. First you need a font, or in the case of MFC a CFont. Then you need to select that font into the DeviceContext you already have a pointer to, pDC, before the static gets drawn. I guess in the same place as you put SetTextColor, the WM_PAINT handler.
I Can't remember off the top of my head whether you call a function on the DC pDC->SelectObject(myFont) or if you can do it the other way around myFont.Select(pDC) but you'll figure that out in no time.
Remember to record the previously selected Font which will get returned when you do the SelectObject and re-select that one back into your DC after you've finished painting or you might screw up the next guys control by drawing it with your font
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Thanks for your quick reply. Between you response and the one from Anurag Gandhi think I have the changing to static text fonts handled.
As you suggested I have a lot of studying to do on these topics. I've been developing in the UNIX/LINUX environments for years. Now they throw a an MS CE C++ project on me and want it done yesterday!!!!
I welcome the chance to learn but it’s a challenge.
Thanks!!
|
|
|
|