|
Check the id of the button that was clicked in the OnCommand function and perform the tasks required over there .
Vision is Always important and so is your ATTITUDE.
Wishes.
Anshuman Dandekar
|
|
|
|
|
thanks , i got it from ur reply...
send reply
|
|
|
|
|
Hi maharaja pandian,
////In file h///////////////
CButton m_Button3;
afx_msg void OnBnClickedButton3();
////////In file Cpp/////////////
#define IDC_BUTTON3 12000
ON_BN_CLICKED(IDC_BUTTON3, OnBnClickedButton3)
///////In you function////////////////
m_Button3.Create("Butotn3",WS_CHILD|WS_VISIBLE|BS_NOTIFY,CRect(0,0,20,20),this,IDC_BUTTON3);
void CssDlg::OnBnClickedButton3()
{
MessageBox("button3");
}
|
|
|
|
|
thanks for ur reply,
but during the runtime only i know ,how many buttons are requried.
i created like
CButton bt[]=new CButton (noofval);
bt[0].create(....);
bt[1].create(....);
.
.
.
like that i created, but i want to add cliked event to that each button
send reply
|
|
|
|
|
You can use Oncommand in your project but if you know about buttons
you can use this code (example you created 10 buttons dynamic) then
you can use this way.I use this way and this is safe and I think it's easy
|
|
|
|
|
thanks , i got it from ur reply...
send reply
|
|
|
|
|
Does anyone know whether you can have more than one Column in a CComboBox ? Seen this in an Access App. If yes: how to do ?
Modified: Meant Column rather that row !
-- modified at 7:20 Monday 20th March, 2006
|
|
|
|
|
What do you mean by more that one row in a combo box?
Nibu thomas
Software Developer
|
|
|
|
|
All right: a ComboBox keeps al lot of items listed while opened. I used ComboBoxes a lot so far.
It´s content could look like this, just one row is keept by ComboBox Element and displayed:
Fred
Harry
Paul
Thomas
I seen this in ACCESS in a different shape:
1 Fred
2 Harry
3 Paul
4 Thomas
ACCESS is capable of holding more than one row in a ComoBox Element.
|
|
|
|
|
RadioOpa wrote: I seen this in ACCESS in a different shape:
1 Fred
2 Harry
3 Paul
4 Thomas
It is easy to display strings like this...
When you add an item make sure you get the index to the item and then use
CString's Format function.
CString str;
str.Format("%02d Fred", nIndex);
m_cmb.AddString(str);
Well to create multicolumn list box use LBS_MULTICOLUMN .
Nibu thomas
Software Developer
|
|
|
|
|
Thanks, but this is not a ListBox but a ComboBox. In a ListBox you can easily create more than one column and select items and it´s columns as
m_Liste.InsertColumn( 0, "ID");
m_Liste.SetColumnWidth( 0, 40 );
m_Liste.InsertColumn( 1, "Customer");
m_Liste.SetColumnWidth( 1, 160 );
m_Liste.InsertColumn( 2, "Country");
m_Liste.SetColumnWidth( 2, 40);
It appears that ComboBoxes do not support this feature so I need to format the string as suggested. I´ll use CString members as mid... for getting what I´m after.
|
|
|
|
|
Yeah. You are right. Subclass the combobox. And then get hold of the list box inside the combo using OnCtlColor (See my reply to NS17 down). Now modify the style of the list box. Set it to have LBS_MULTICOLUMN style.
Nibu thomas
Software Developer
|
|
|
|
|
|
Hi,
I have my MFC wizard generated applicaiton (TestPro),
one global object is created with name CTestProApp theAPP,
This constructir invokes ( CWinApp::CWinApp), from here how the control flows..
From here how will call my progam ( CTestProApp->InistInstance, run..etc) methods, b'coz I did't find any of the methods are calling from CWinApp constructor.
Code for CWinApp constructor: Could any body explain code level how it works,
----------------------------------------------------------------
CWinApp::CWinApp(LPCTSTR lpszAppName)
{
if (lpszAppName != NULL)
m_pszAppName = _tcsdup(lpszAppName);
else
m_pszAppName = NULL;
// initialize CWinThread state
AFX_MODULE_STATE* pModuleState = _AFX_CMDTARGET_GETSTATE();
AFX_MODULE_THREAD_STATE* pThreadState = pModuleState->m_thread;
ASSERT(AfxGetThread() == NULL);
pThreadState->m_pCurrentWinThread = this;
ASSERT(AfxGetThread() == this);
m_hThread = ::GetCurrentThread();
m_nThreadID = ::GetCurrentThreadId();
// initialize CWinApp state
ASSERT(afxCurrentWinApp == NULL); // only one CWinApp object please
pModuleState->m_pCurrentWinApp = this;
ASSERT(AfxGetApp() == this);
// in non-running state until WinMain
m_hInstance = NULL;
m_pszHelpFilePath = NULL;
m_pszProfileName = NULL;
m_pszRegistryKey = NULL;
m_pszExeName = NULL;
m_pRecentFileList = NULL;
m_pDocManager = NULL;
m_atomApp = m_atomSystemTopic = NULL;
m_lpCmdLine = NULL;
m_pCmdInfo = NULL;
// initialize wait cursor state
m_nWaitCursorCount = 0;
m_hcurWaitCursorRestore = NULL;
// initialize current printer state
m_hDevMode = NULL;
m_hDevNames = NULL;
m_nNumPreviewPages = 0; // not specified (defaults to 1)
// initialize DAO state
m_lpfnDaoTerm = NULL; // will be set if AfxDaoInit called
// other initialization
m_bHelpMode = FALSE;
m_nSafetyPoolSize = 512; // default size
}
---------------------------------------------------------------------------
Thanks
Siva
|
|
|
|
|
Siva Sankar Koyi wrote: From here how will call my progam ( CTestProApp->InistInstance, run..etc) methods, b'coz I did't find any of the methods are calling from CWinApp constructor.
it's all done by the frame work.
one way to look at it, is to put a break point in InitInstance, and see where it's called from.
if InitInstance is not called, I think there is a problem with you program, maybe you deleted a line or two in the generated Wizard code.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
press f9 on the codes you have typed and while running in the debugging mode, just press f5 so that it will stop in the next line of "your" code where you have set a break-point(f9). now it wont be letting you see the MFC AFX zone secrets.
VuNic
|
|
|
|
|
I developed DCOM Server and Mutltithreaded Client in VC++.
When I run client and If DCOM Service is in started state then it gives an Error "Server Execution failed".
Can Anybody help me?
Its urgent!!!
Anita
|
|
|
|
|
how do i find out if a particular process is running or not. I have the ProcessID with me for reference. I dont wanna use OpenProcess method. Is there any other way.
|
|
|
|
|
you can enumerate running processes if you have the name of the executable and match the filenames.
BTW, if you just want to check whether IE is running or not then this code snippet will work just fine
HWND hExplorer = ::FindWindow("IEFrame", NULL);
if (!hExplorer)
{
hExplorer = ::FindWindow("CabinetWClass", NULL);
}
if(hExplorer)
{
}
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
|
|
|
|
|
why not openprocess?
nave
|
|
|
|
|
you can use
hProcess = OpenProcess (PROCESS_QUERY_INFORMATION|PROCESS_VM_READ, FALSE, yourID);
openprocess/EnumProcessModules/GetModuleFileNameEx/
First you should Handle to process and then you can use this function
and other functions....
|
|
|
|
|
Hi, if you already know the ProcessID you can use EnumProcesses function, instead of OpenProcess - it will tell you if the specified process is running. Good Luck!
|
|
|
|
|
Hi all,
I set the color of combobox text in OnCtlColor. But I cannot set the color for disabled combobox text. It always comes as gray always.
How can I change the text color of disabled combobox?
Thank you.
- NS -
|
|
|
|
|
NS17 wrote: But I cannot set the color for disabled combobox text. It always comes as gray always.
How can I change the text color of disabled combobox?
This cannot be set through OnCtlColor . Subclass the combo for customized functionality.
Nibu thomas
Software Developer
|
|
|
|
|
Thank you for your replay.
How can I do that? Can you give me a little bit explanation?
I am confused, about where should we write the code to set the color?
- NS -
|
|
|
|