|
Hello all,
How can I programatically change the default push button style from one button to another button in a dialog?
|
|
|
|
|
If you want to copy a button's style to another one you can get it by using GetStyle() or GetStyleEx() that returns a DWORD and set the other button's style by using ModifyStyle or ModifyStyleEx.
Marc Soleda.
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
I mean:
<br />
DWORD dw = m_button1.GetStyle();<br />
m_button2.ModifyStyle(0, dw);<br />
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
Thank you.
But the problem is still alive.
I use the following code for show buttons which are hidden initially. If the fDefault is set TRUE that button should have default push button style. Always button[0] gets this style. I'm sure that I will set this style only to one button at a time.
void CDlg::Enable(int iBtn,LPCSTR sTxt,BOOLEAN fDefault)
{
m_button[iBtn].SetWindowText(sText);
m_button[iBtn].ShowWindow(SW_SHOWNORMAL);
if(fDefault)
m_button[iButton].ModifyStyle(0,BS_DEFPUSHBUTTON);
}
Can you help in this problem, please?
|
|
|
|
|
Use SetButtonStyle instead of ModifyStyle.
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
You can do it, at design time, in the resource editor via the button properties->tab. But I don't remember how to do it at run time.
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
|
Hi,
Iam new to win 32 programming. Currently i have a resource in a DLL consisting of dialog resouces and other. Now how do you i load the resouce in the DLL to my existing win 32 application?
Your help is greatly appreciated.
Thanks,
pradeep
|
|
|
|
|
And I need to do this at the runtime.
|
|
|
|
|
Here is an example as requested.
HMODULE hModule = LoadLibrary("C:\\another_resource.dll");
if(hModule != NULL)
{
HWND hDialog = CreateDialog(hModule, MAKEINTRESOURCE(ID_DIALOG), , );
HBITMAP hBitmap = LoadBitmap(hModule, MAKEINTRESOURCE(IDB_BITMAP);
FreeLibrary(hModule);
}
<font=arial>Weiye Chen
Life is hard, yet we are made of flesh...
|
|
|
|
|
Use the LoadLibrary method to load your dll and call LoadResource to load the resources in it.
<font=arial>Weiye Chen
Life is hard, yet we are made of flesh...
|
|
|
|
|
hai,
I am not getting selected Date
I wrote code like these.....
Here m_month --- is CMonthCalCtrl member variable
Date Field is getting error.
Month and Year fileds are getting Correctly.
Plz Help me.
This is Urgent need..,
------->
CString strDate;
CTime ct;
m_month.GetCurSel(ct);
strDate.Format("%2d-%2d-%2d",ct.GetDay(),ct.GetMonth(),ct.GetYear());
MessageBox(strDate);
---
Praveen Chowdam Kumar
|
|
|
|
|
I think it's a known issue. The way to workaround this is by using SYSTEMTIME instead of CTime:
<br />
SYSTEMTIME ct1;<br />
<br />
if( m_month.GetCurSel(&ct1) )<br />
{<br />
strDate.Format(_T("%02d-%02d-%2d"),ct1.wDay, ct1.wMonth, ct1.wYear );<br />
MessageBox(strDate);<br />
}<br />
I hope that solves your problem,
Marc Soleda
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
|
1.0 ??? Hasn't it been usefull?
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
-- modified at 6:33 Monday 29th August, 2005
|
|
|
|
|
Hi
I have developed a simple dialogue based application. This application contains only one static control in which I show some text continuously. Now I want to put a code so that when user presses some key combination like Ctrl + M, Ctrl+Alt+M or any key, it should be closed.
But my OnKeyDown() function doesn't work as I have Static Control on my dialogue and it takes the focus so all my key down event goes to static control.
Any idea what to do ?
Thankx in advance
Amarelia Maehsh
Gujarat
India
|
|
|
|
|
You can attach an accelerator resource to your dialog. In the accelerator table, you can map the key combination to some command and then add an entry to the message map to specify a command handler.
Take a look at this posts[^] for details on how to attach the accelerator.
Hope that helps,
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
Thankx a lot
It will definitely help me a lot
Once again thankx for your kind response
Amarelia Maehsh
Gujarat
India
|
|
|
|
|
You'll have to handle the WM_KEYDOWN message in PreTranslateMessage member function.
<br />
BOOL CYourDlg::PreTranslateMessage(MSG* pMsg) <br />
{<br />
if(pMsg->message == WM_KEYDOWN)<br />
{<br />
...
}<br />
return CDialog::PreTranslateMessage(pMsg);<br />
}<br />
I hope it helps,
Marc Soleda.
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
Modifing the above code can we find which particular key is pressed?
Thanx
V
|
|
|
|
|
pMsg->wParam right? GOT IT!!
Thanx
V
|
|
|
|
|
You're right !!
... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits.
|
|
|
|
|
is it possible to capture other windows' events (without using Hooks?)
Thanx
V
|
|
|
|
|
Thank you very much for spending your time to read my question.
Still to apply what you have said....but I'll definitely try this one as well
Regards
Amarelia Maehsh
Gujarat
India
|
|
|
|
|
Hello All,
I have implemented a simple "hello world" WIN 32 Application which displays a tray icon when application is running and removes tray icon when application is closed.
My problem is when i kill the applcation process from task manager, the tray icon still remains in system tray. When I move the mouse cursor over the tray icon then the tray icon is removed.
Will it be possible to remove the tray icon when application is killed from task manager.
Any help is truly appreciated?
Thanks and Regards,
Madhu
|
|
|
|