|
Well, sadly, no, i have no links, if i had one i would have posted it the first time, what i thought of is that you could try drawing the menubar yourself similarry to how you draw the menu items, it can be tricky but i think it can be done. Sorry, i have no better idea right now. If you could determine the menubar area you could in the call to WM_NCPAINT exclude this area from the update region (you get the update region as a parameter with WM_NCPAINT (i think it can also be NULL which means everything needs to be repainted)), call __super::OnNcPaint, this should leave the menubar area unpainted (but draw the rest, like borders, caption bar, ...) and then try to paint it yourself using GetMenuItemRect() to determine where the menu items are, however, this might prove problematic (i don't know how you can draw a menu item which is selected, etc...) and it is also probably reinventing the wheel...but you said you didn't find anything out there to do what you want. Or how about doing this: catch he WM_NCPAINT, determine the menu bar region, paint it to your chosen color, and then let WM_NCPAINT be handled by super, maybe it doesn't erase the menubar background in that call just draws the items over what is there. Maybe worth a try...
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
|
|
|
|
|
To change the background color of MenuBar, simply add below's line of code, beginning of mainframe OnCreate
CBrush* NewBrush;
NewBrush = new CBrush;
NewBrush->CreateSolidBrush(RGB(139,137,137));
MENUINFO MenuInfo = {0};
MenuInfo.cbSize = sizeof(MenuInfo);
MenuInfo.hbrBack = *NewBrush; // Brush you want to draw
MenuInfo.fMask = MIM_BACKGROUND;
MenuInfo.dwStyle = MNS_AUTODISMISS;
CMenu* pMenu = this->GetMenu();
if(IsMenu(pMenu->m_hMenu))
{
SetMenuInfo(pMenu->m_hMenu, &MenuInfo);
}
As for Toolbar's background color, create OnNotify at MainFrame, put below's code
LPNMHDR pnmh = (LPNMHDR) lParam;
if(pnmh->hwndFrom == m_wndToolBar.m_hWnd)
{
LPNMTBCUSTOMDRAW lpNMCustomDraw = (LPNMTBCUSTOMDRAW) lParam;
CRect rect;
m_wndToolBar.GetClientRect(rect);
FillRect(lpNMCustomDraw->nmcd.hdc, rect, (HBRUSH)GetStockObject(GRAY_BRUSH));
}
return CFrameWnd::OnNotify(wParam, lParam, pResult);
Thanks for those who helped me. I'm giving out the solution i've got.
good
|
|
|
|
|
I'm using VC++ .NET 2005.
I want to know how i can know the architecture of remote machine.That if it is 32bit machine or 64 bit machine.
Please help.
|
|
|
|
|
That shouldnt be an issue. Design an interface which will be portable.
Greetings from Germany
|
|
|
|
|
roshan_nikam wrote: I want to know how i can know the architecture of remote machine
Which remote machine ? The target machine on which you want to deploy your application ? What do you mean exactly ?
|
|
|
|
|
Actually i want to get information of architecture of remote machine.
then based on it's architecture i.e. (32bit or 64bit) , I will deploy
my application which is specific for specific machine(32bit or 64bit).
|
|
|
|
|
Again, the question of "what do you mean by remote host"?
If you are writing your own client server, then just make the protocol so that you don;t care.
If it is some webserver thingy, where you want to provide an appropriate executable, isn;t the OS info in the html header?
Iain.
|
|
|
|
|
I m using multimedia timer in my application but problem is ..application do not reponde to any click event /slow to respond .wht should i do?????
thanks
|
|
|
|
|
anilaabc wrote: wht should i do?????
At least provide much more informations because with the info you gave, it is almost impossible to help you.
Are you doing heavy processing in the main thread ? Remember that if your main thread is busy, it won't be able to process messages, which means that your UI will not respond.
|
|
|
|
|
i m doing some calculations in a separate thread after a particalar interval .for this i m using a flag that is set to true in timeproc.I want that UI must repond quickly .I m not doing anything in main thread.
Is it enough info ?
Thanks in advance
|
|
|
|
|
anilaabc wrote: Is it enough info ?
I'm afraid not
anilaabc wrote: i m doing some calculations in a separate thread after a particalar interval .for this i m using a flag that is set to true in timeproc.
Ok, so when are you starting your processing ? When the user clicks on a button ? If yes, can you post the code for the button click handler (please use the "code block" tag to format your code).
Could you describe exactly what happens ? User interaction, when does the UI becomes unresponsive, .. Is the UI completely frozen for a while or just slow ?
I think you will need to post relevant part of your code for us to be able to help.
|
|
|
|
|
run is set to true.
on click i set run=false; to stop thread.
when i click run is not set to true and keep on alive to thread
void method()
{
while(run)
{
if(Draw)
{
//doing some calculations here
}
Draw=0;
greating_time_id=timeSetEvent(100, 0, GreatingResume_t, (DWORD)this,TIME_ONESHOT);
}
}
}//while end
}//end method
void CALLBACK GreatingResume_t(UINT uID, UINT uMsg, DWORD dwUser, DWORD dw1, DWORD dw2)
{
if(uID==greating_time_id)
{
Draw=1;
timeKillEvent(greating_time_id);
}
}
|
|
|
|
|
Just for a test, run "Task Manager" and check "Performance", does your CPU seem overloaded (100% CPU usage)? If so, check "Processes" and see if your process is the one consuming all the CPU time, if so, you have there a run away thread probably. Try putting a Sleep(1) (or maybe Sleep(0)?) in your thread (inside that while-loop) and check if anything changes.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
modified on Thursday, December 4, 2008 7:08 AM
|
|
|
|
|
Maybe your code is doing something else: posting messages from from control to one other or drawing itself again and again. Make debug out or disable main portions of your code.
Greetings from Germany
|
|
|
|
|
|
Hi All
I have a problem to show dialog in Taskbar.I have a dialog A. And i also added two dialog B and C. Now i am facing problem to show dialog B in taskbar.Plz help me.
Thanks in advance
|
|
|
|
|
Try to set WS_EX_APPWINDOW style, provided the dialog is not a child window.
|
|
|
|
|
Am not sure what kind of problem you are facing there but try adding the WS_EX_APPWINDOW style to your dialogs...
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
|
|
|
|
|
Hi,
I need to exceute an Exe when the postgres service starts . Is it possible to configure in registry or is there any other means to launch an exe when service starts.
Thanks
|
|
|
|
|
There's one simple and dirty way to achieve it.
It's to make a postgress service wrapper program and replace the original service with new one. Then you can detect the time when the service started.
|
|
|
|
|
match the prameter (LPCTSTR lpBinaryPathName) of API CreateService()
You know some birds are not meant to be caged, their feathers are just too bright.
|
|
|
|
|
Posting this again ..... please help
**********************************************
I have created Property Sheet and Pages using Win32 SDK. Now I need to modify a edit box on a Page. The piece of code is
HWND hPropSheet = GetActiveWindow();
HWND hPropPage0=PropSheet_GetCurrentPageHwnd(hPropSheet );
SetDlgItemText(hPropPage0,IDC_EDIT1,(LPCWSTR)szBuffer);
Is this correct? I am not able to get the Handle to window to the Property Sheet ..... Please help
|
|
|
|
|
koumodaki wrote: Is this correct?
Shouldn't you be answering that question? Does the code compile? Does it produce the expected results?
koumodaki wrote: I am not able to get the Handle to window to the Property Sheet
So if GetActiveWindow() is not returning the correct handle, why bother calling PropSheet_GetCurrentPageHwnd() and SetDlgItemText() ?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Hello !
I have some hexadecimal data, say
0x0A, 0x1F, 0x33 ...
Now what is the easiest way to caculate 2's complement of the above?
i know the procedure:
add all the numbers in binary fomat, take ones complement , add 1 to it.
but how to add them in binary format ??
Thanks !
|
|
|
|
|
If you want to calculate it in 32bit, you just use shift and or operator.
BYTE b[] = { 0x0a, 0x1f, 0x33, ... };
DWORD value = (b[0] << 24) | (b[1] << 16) | (b[2] << 8) | (b[3])
or
DWORD value = 0;
for(int i=0; i<4; ++i)
{
value <<= 8;
value |= b[i];
}
|
|
|
|