|
Did u do what manish told u to do. well DDX_Control works for me.
|
|
|
|
|
devvvy wrote: I tried DDX_Control it crashed the app
Because you failed to set LBS_OWNERDRAWFIXED and LBS_HASSTRINGS styles.
"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
|
|
|
|
|
I have the following two classes :
1) A CDialog derived CDlgClass
2) A CCmdTarget derived CAnotherClass
I am unable to disable an item of the launched context-menu.
Please follow the comments below to track the problem.
In DlgClass.cpp
ON_COMMAND(ID_MENUITEM1, OnMenuItemEdit1Clicked)
ON_UPDATE_COMMAND_UI(ID_MENUITEM1, OnUpdateMenuItemEdit1)
VOID CDlgClass::OnContextMenu(CWnd* pWnd, CPoint point)
{
m_pAnotherClass->ShowContextMenu( this, point);
}
void CDlgClass::OnMenuItemEdit1Clicked()
{
}
void CDlgClass::OnUpdateMenuItemEdit1(CCmdUI* pCmdUI)
{
pCmdUI->Enable(FALSE);
}
In AnotherClass.cpp
VOID CAnotherClass::ShowContextMenu(CWnd *pDlg, CPoint point)
{
CMenu cmCtxtMenu;
cmCtxtMenu.LoadMenu(IDR_MENU_OPTIONS);
CMenu *pcmPopupMenu = cmCtxtMenu.GetSubMenu(0);
ASSERT(pcmPopupMenu);
pcmPopupMenu->TrackPopupMenu (TPM_RIGHTBUTTON|TPM_LEFTALIGN, point.x, point.y, pDlg );
}
What could be the problem with disabling the menu item although I could actually activate the menu item handler
properly?
The function CDlgClass::OnUpdateMenuItemEdit1(CCmdUI* pCmdUI) itself is not getting called before launch of the menu,
when the menu is loaded in a different class.
What could be the reason ?
Thanks in Advance.
|
|
|
|
|
SherTeks wrote: The function CDlgClass::OnUpdateMenuItemEdit1(CCmdUI* pCmdUI) itself is not getting called
See this post[^].
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I would like to declare Estimator class a friend of YLC2Plot class. Any ideas??
Thanks in advance.
Regards: Hadi
i am using sun c++ 5.9 ( CC )
*********************************************/
#ifndef _ESTIMATOR_H
#define _ESTIMATOR_H
template <typename RadarType, typename FilterType >
class IMM: public RadarType, public FilterType {
public:
//....
protected:
//...
private:
//..
};
#endif
/******************************************/
#ifndef _YLC2PLOT_H
#define _YLC2PLOT_H
#include "Estimator.h"
class YLC2Plot : public BasePlot {
public:
friend class IMM;
protected:
//....
private:
//.....
};
#endif /* _YLC2PLOT_H */
|
|
|
|
|
What about
class YLC2Plot : public BasePlot {
template <typename RadarType, typename FilterType > friend class IMM;
};
?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I wanted to know if one exe can be controlled by another exe. for example i have 2 dialog boxes which are 2 different exes. now in the first exe i am doing a simple addition where there are 3 edit boxes and a button to calculate. now in the 2nd dialog box i only have one button "calculate". now when i click on the 2nd exes calculate button, the event on the first exes button should execute. i hope i have made my problem clear. give me some leads for this.
Thanks
|
|
|
|
|
|
If the controlled exe is a console application that uses standard input/output for communication you could use Universal Console Redirector[^]
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
Hi All,
I have referred a term "ActivexDll" I think there exist a concept called ActiveDll, if I am wrong then kindly excuse me and clarify "Difference between a Dll and ActiveX Components ".
If I am correct then can any one explain me the difference between a Dll and an ActicexDll.
Regards,
LG.
lgatcodeproject
|
|
|
|
|
DLL is just a binary file containing executable code in PE(Portable Executable) format. One can make DLL's for many purposes like ActiveX objects, COM components, or simple library of functions.
-Saurabh
|
|
|
|
|
Hi saurabh,
Thanks for the response. can you explain what is the difference between the dll and activex dll. With respect to you answer may be I would put it this way, how does a dll differ when its purpose is to serve an ActiceX Object?
Regards,
LG.
lgatcodeproject
|
|
|
|
|
Conceptually there is no difference. They both are PE files. It is same as asking what is the difference between two BMP files.
-Saurabh
|
|
|
|
|
So, when you import any dll into an ActiveXControl you can call it as ActiceXDll, am I correct?
In VC++6.0 New->Project, one can find many projects, where in there is
"MFC AppWizard (dll)"and another project called
"ATL COM AppWizard"->Dll/Service(Exe)/Executable(exe);
can you tell me what is the difference between these two projectS? when would one choose these?
I had the lead to my initial question from the above option?
Regards,
LG.
lgatcodeproject
|
|
|
|
|
Okay let me explain by an analogy.
Let's say you have 100 BMP files. If you ask what type of files I have? Then asnwer is simple they all are BMP files and are no different to each other in that sense. But you can still categorize them based on their "content". You can have family photos, vacation photos, etc.
In the same way all DLL's are PE files. But based on what they "do" you can categorize them. If a DLL contain code for acting as an ActiveX control then you can loosely call it ActiveX DLL, just as you would call a family photo. If a code contains bunch of C funcitons you might call it utility DLL.
The APP wizard's function is to generate code based on the template you choose. So if you choose MFC ActiveX Control the App Wizard will generate the code which can be compiled into a DLL which will provide the functionality of a ActiveX controls and it will use MFC as well.
Hope this clears things up.
-Saurabh
|
|
|
|
|
Thanks saurabh, your anwer added more clarity. So when I say ActiveX Dll it means I need both the functionality of COM and Dll as well. Hope I am getting it all correctly!
Regards,
LG.
lgatcodeproject
|
|
|
|
|
Yes you have got it correctly.
-Saurabh
|
|
|
|
|
Thanks for explaining with patience. Have a nice day. Bye.
ReEgards,
LG
lgatcodeproject
|
|
|
|
|
You are most welcome. You too have a nice day.
-Saurabh
|
|
|
|
|
Hi,
I've got problem with MFC. I tried to run the query like this, and I am using recordset
select count(*) from dbo.Vehicle
and how to grab the value of the count(*)?
I found one way, but its running very slow by using loop
int inc = 0;
query = select * from dbo.vehicle
while(records is not eof or record is bof)
{
inc++;
records.movenext()
}
printf("Total count is %d",inc);
do you have any idea how to grab the value using the count(*) instead of running the loop
Thanks
Arif
|
|
|
|
|
Hi,
I'm coding a small fragment which gets called when the system fails to secure a resource on the local network. (it is to replace a Retrycancel Message, with a Dialog box on a different thread, telling that the system is busy, offering a 'Cancel button. The further idea is, that when the resource becomes available, the box disappears, and normal porocess follows. The entire Project is Dialog based.
The Escence of the code is as follows:-
<br />
int ProcDlg::Do(){<br />
if(!m_bIsRunning){ <br />
AfxBeginThread(ThreadProc,this);<br />
m_bIsRunning=TRUE;<br />
return IDOK;<br />
}<br />
else if(m_bDoCancel){<br />
return EndDialog(IDCANCEL);<br />
}<br />
<br />
else return IDOK;<br />
}<br />
<br />
void WaitDlg::OnCancel(){<br />
...<br />
m_pInfo->m_bDoCancel=TRUE;<br />
}<br />
<br />
UINT ThreadProc(void* pParam){<br />
WaitDlg dlg;<br />
dlg.m_pInfo=(ProcDlg*)pParam;<br />
dlg.DoModal();<br />
return 0;<br />
}<br />
The General Idea is, that the Wait Dialog sets a Flag in the Process Dialog, which, when stumbled upon, will do the cleanup.
To make the code readable, and to get to the nubb of the problem, I left out a lot of supporting code, including Synchronisation objects.
The thread that runs the Notification Dialog, gets locked up!
It locks the thread in:
<br />
if (hWndParent != NULL && ::IsWindowEnabled(hWndParent))<br />
{<br />
::EnableWindow(hWndParent, FALSE);<br />
bEnableParent = TRUE;<br />
}<br />
in particular in ::EnableWindow.
Traceing into that in the Disassembly Window lands at an opcode 0x0F, where it stops.
What's going on here!
Bram van Kampen
|
|
|
|
|
Two things I see right away -
1) You're creating a worker thread when you need a UI thread.
2) How are you going to close the WaitDlg if it's in a modal loop?
What about using a modeless wait dialog created on the main UI thread?
The code that locks up - where is that, on what thread is it executing, and
what is hWndParent?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote: 1) You're creating a worker thread when you need a UI thread.
The Thread starts off as a worker thread, but calls it's own WinProc as part of calling the second Dlg.DoModal(). Tried this by calling a UI thread, Same result.
Mark Salsbery wrote: 2) How are you going to close the WaitDlg if it's in a modal loop?
By Setting a Flag, and, by calling EndDialog(...) for the Dlg when the next itteration of the (Not Shown) Outer loop calls the appropriate routine.
Mark Salsbery wrote: The code that locks up - where is that, on what thread is it executing, and
what is hWndParent?
The locking Code is on the Second thread, trying to run WaitDlg.DoModal()
HISTORY
Opening Files on a network, fails if already open on other app.(Data Collision) The canonical access routine contains an endless loop which tries to open, sleeps for 100 msec, and tries again. (does so with multiple filesin a predetermined order) After 50 such tries on a single File, it gives a RetryCancel MsgBox. All obvious reasons for failure have at this stage been dealt with, we're dealing with the default.Experience shows that 'Retry' will solve it. I now want to replace the box with a Dialog: System is busy, with a cancel button, and which automatically returns 'IDRETRY' after say 500 msec.
Thanks,
Bram van Kampen
|
|
|
|
|
Are you giving the second-thread dialog a parent? That can cause problems in MFC
if the parent and child were created on different threads.
Regardless, what you're doing is so much simpler using a modeless dialog on the UI thread.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote: Are you giving the second-thread dialog a parent? That can cause problems in MFC
if the parent and child were created on different threads.
Actually, No. Going to try that now. Q. In general, does the existence of a Parent CWnd Class suffice, or do we need to create the underlying window
(albeit Invisible)
Mark Salsbery wrote: Regardless, what you're doing is so much simpler using a modeless dialog on the UI thread.
Any chance of a brief outline of how to do that?
Thanks,
Bram.
Bram van Kampen
|
|
|
|