|
i have a split window that i put a CFormView derived view into. How can I call this view's OnFilePrint function? I have a message map in this view:
BEGIN_MESSAGE_MAP(CDisplayPrintTemplate, CFormView)
ON_WM_ERASEBKGND()
ON_COMMAND(ID_PRINT_SELECTED,CFormView::OnFilePrint)
END_MESSAGE_MAP()
how can i send a message from CMainFrame to this view to print? I have tried the following, but nothing occurs. In the class itself i have a button that i press which has the ID_PRINT_SELECTED id, and it works fine..
CDisplayPrintTemplate* pForm = (CDisplayPrintTemplate*)m_wndSplitter.GetPane(1,0);
pForm->SendMessage(ID_PRINT_SELECTED);
i will continue to look for examples, if someone notices something small could you please help me out? thanks!
-dz
|
|
|
|
|
Seems like the message is not being properly routed. Are you handling by error this command somewhere else? (like for instance in your main frame window)
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I have changed my code to where i just call a member function - CDisplayPrintTemplate::ExternalPrint()
this in turn calls CFormView::OnFilePrint().. is there anything wrong with this? I know its a protected member, but i have tried the examples on message sending and i cant get any of my test functions to ever get called.. is it necessary to send a message or is a function call ok?
-dz
|
|
|
|
|
Have you tried Patrick's advice below? I think he's definitely pinpointed your error.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I have looked at the article, and tried the following:
CMainFrame
----------
#define WM_TESTING WM_APP + 0x100 // defined above IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
...
pForm->SendMessage(WM_TESTING,1,NULL);
CDisplayPrintTemplate
---------------------
#define WM_TESTING WM_APP + 0x100
..
BEGIN_MESSAGE_MAP(CDisplayPrintTemplate, CFormView)
ON_WM_ERASEBKGND()
ON_COMMAND(ID_PRINT_SELECTED,CFormView::OnFilePrint)
ON_COMMAND(WM_TESTING, TestMe)
END_MESSAGE_MAP()
..
void CDisplayPrintTemplate::TestMe()
{
AfxMessageBox("Testme");
CFormView::OnFilePrint();
}
the message never pops up.. i am just calling the function directly now.. im trying to figure out how to keep the print dialog from popping up.. thanks for all of your help
-dz
|
|
|
|
|
Well. Commands are not messages. Commands are IDs sent along the only message WM_COMMAND . Try the following:
pForm->SendMessage(WM_COMMAND,MAKEWORD(ID_PRINT_SELECTED,0),0); Hopefully, this will work. See the difference? The command ID it's stored in the wParam arg, not in the message parameter (which must be WM_COMMAND .)
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
|
I have seen a lot of people post questions about problems sending messages to splitter windows. The problem is the frame and CSplitterWnd are not routing the message all the way down to the CView panes. Refer to the MSDN article "September 1998 Microsoft System Journal, Q&A". Just search for CSpliterWnd and it will be in the list.
This is the meat of what it says:
"... Fortunately, it's easy to let all the views in a splitter window handle commands. All you have to do is override your frame's OnCmdMsg function, like so:
BOOL CMainFrame::OnCmdMsg()
{
if (m_wndSplitter.OnCmdMsg()
return TRUE;
return CFrameWnd::OnCmdMsg();
} Then, override the splitter window's OnCmdMsg:
BOOL CMySplitterWnd::OnCmdMsg()
{
for (pView = ) {
if (pView->OnCmdMsg()
return TRUE;
}
return CSplitterWnd::OnCmdMsg();
} ..."
Note you should override CSplitterWnd. And the changes to the frame is to CMainFrame for a SDI application and to CChildFrame for a MDI application.
Hope this helps
Jonathan Craig
www.mcw-tech.com
|
|
|
|
|
Hi I have already made this post a while back,
I am trying again.
How can i get the total amount of memory used by a process at any given time?
I know about GetprocessWorkingSetSize, but this works only on Winnt and not
9x systems, also this function will give only the max and min usages.
|
|
|
|
|
I don't think you can know process's memory in Win95/98. Can task manager give you such information in those OS?
Philip Patrick
Web-site: www.stpworks.com
"Two beer or not two beer?" Shakesbeer
Need Web-based database administrator? You already have it!
|
|
|
|
|
Hi Prem. It is not easy task that you're trying to accomplish, but fortunately Keit Rule already wrote the stuff in his article Debugging & Testing Tips for Win9x (check GetHeapSize 's code.)
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi,
The Heap size is not enough for what i am trying to do.
I want to get the amount of virtual memory also,
In Winnt I can use the PSAPI function
GetProcessMemoryInfo to get the total amout of memory a process
is using.
Yeah I have looked at the ToolHelp functions already(which by the
way are not available in Winnt) do not give the Virtual memory
usage.
|
|
|
|
|
Please correct me if I'm wrong, but I'd say heaps account for all the memory available to a process (save the memory needed for the executable code.) If you know this is not so, I'd be grateful if you could ellaborate a little more.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi,
I think that the Heap is not the whole memory,
Functions using the the Virtual memory functions
might not be listed as a part of a heap, infact some
system dll's themselves are allocating using VirtualAlloc
and not calling VirtualFree in some circumstances, and
we want to test for it and force them to free it.
|
|
|
|
|
This app is a very good one.. but it's an app.. not code
TaskInfo 2000 @ www.iarsn.com
Rickard Andersson@Suza Computing
ICQ#: 50302279 (Add me!)
E-mail: nikado@pc.nu
I'm from the winter country SWEDEN!
|
|
|
|
|
Are you replying to my post? The code needed is shown in full in the article itself, you don't have to download the project.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
If he don't want to do it programmaticly (in fact he is but WTH ) I gave a good a example of an app that can show realy much info, such memory usage etc... I'm tired and can't spell or write sentences in english that is correct enough to understan (maybe)... I need my bed now...
sleep well my CP friend!
Rickard Andersson@Suza Computing
ICQ#: 50302279 (Add me!)
E-mail: nikado@pc.nu
I'm from the winter country SWEDEN!
|
|
|
|
|
sleep well my CP friend!
Sweet dreams
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
There is code which you download along with the article.
|
|
|
|
|
After looking at the MS sample ATL Server projects is it better to always
return S_OK from a method([web_method]) and pass back error information
through either an out paremeter or through a soap header?
Cheers
Ollie
|
|
|
|
|
Well, I guess yes, because if you will return something other then S_OK (like E_FAIL, whatever), the error can be intercepted before it will come to your code. Thus the result can be unknown, depending of the implemntation, maybe it will raise exception, maybe it will let it go..
Philip Patrick
Web-site: www.stpworks.com
"Two beer or not two beer?" Shakesbeer
Need Web-based database administrator? You already have it!
|
|
|
|
|
Well in my C# application that consumes the web services it raises a SOAP exception and there is no defining information in the exception that will tell me why it failed.
If I want to return rich error information from COM(i.e. IErrorInfo) then I am going to have to return this as either a parameter or a soap_header, but i do not want to specify an extra parameter in every method defined, so I am thinking of using a soap_header set as an out parameter.....
Any thoughts......
|
|
|
|
|
hi all
My program compiles ok but in run-time whenever i tried to access a function from the CListBox MFC class that is placed in a CDialog from View class, it gives me the above error. Does any one know why??
The sameple code is placed below
Dlg dialog;
CString temp[4];
for (int i = 0 ; i < 4; i++)
{
temp[i] = pDoc->A.getTeam(i);
}
dialog.SetTeam(temp);
if(dialog.DoModal()==IDOK)
{
curSelTeam1 = dialog.GetCurSelTeam1();
}
and here is my Dlg class
Dlg::Dlg(CWnd* pParent )
: CDialog(Dlg::IDD, pParent)
{
for(int i = 0; i< 4; i++)
{
team[i] = "";
}
}
const int Dlg::GetCurSelTeam1()
{
return m_team1.GetCurSel();
}
void Dlg::SetTeam(CString t[4])
{
for(int i = 0; i< 4; i++)
{
team[i] = t[i];
}
}
void Dlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_LIST4, m_team2);
DDX_Control(pDX, IDC_LIST3, m_score2);
DDX_Control(pDX, IDC_LIST2, m_score1);
DDX_Control(pDX, IDC_LIST1, m_team1);
}
BEGIN_MESSAGE_MAP(Dlg, CDialog)
END_MESSAGE_MAP()
BOOL Dlg::OnInitDialog()
{
CDialog::OnInitDialog();
for(int i = 0 ; i< 4; i++)
m_team1.AddString(team[i]);
for(int j = 0 ; j< 4; j++)
m_team2.AddString(team[j]);
for(int k = 48 ; k < 58; k++)
{
m_score1.AddString(CString(k));
}
for(int m = 48 ; m <58; m++)
{
m_score2.AddString(CString(m));
}
m_team1.SetCurSel(0);
m_team2.SetCurSel(0);
m_score1.SetCurSel(0);
m_score2.SetCurSel(0);
return TRUE;
}
Thanks for reading this everyone and hopefully you can enlighten me!
Source code of the program can be downloaed for further investigation at http://z3r0n3.hypermart.net/ass3_q1.exe
|
|
|
|
|
Once DoModal returns, the controls have been destroyed. You need to save the current control settings prior to the dialog closing.
Unfortunately, I hate DoDataExchange so I have no clue how to do it using that stuff.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
You are using Modal dialog. Any control is not exist after DoModal exits. So you should do it either modeless dialog or update some member value (like int or CString) in your dialog class in OnOK handler for example
Philip Patrick
Web-site: www.stpworks.com
"Two beer or not two beer?" Shakesbeer
Need Web-based database administrator? You already have it!
|
|
|
|