|
Now CWnd::HtmlHelp(HH_DISPLAY_TOPIC, NULL);
-- modified at 4:23 Wednesday 10th May, 2006
exapmle from MSDN
HWND hwnd =
HtmlHelp(
GetDesktopWindow(),
"c:\\Help.chm::/Intro.htm>Mainwin",
HH_DISPLAY_TOPIC,
NULL) ;
::HtmlHelp(hwndhandle,file,HH_DISPLAY_TOPIC,15);
|
|
|
|
|
Hi, and thanks for the help.
I am sorry but I don't follow what you mean.
I have changed my line of code to:-
HtmlHelp(HH_DISPLAY_TOPIC, NULL);
And now it compiles and runs, but when I click the 'Help' button it does not work, it says 'Failed to Launch help".
I suppose it doesn't know what the name of the help file is? I guess I've got to do something else, but what?
Thanks for your help,
Ali
|
|
|
|
|
#include htmlhelp.h
you get error LNK2019 because you need to
import
htmlhelp.lib
i use this way and its work without error Failed
HWND hwnd = ::HtmlHelp(::GetDesktopWindow(),
"c:\\2.chm",HH_DISPLAY_TOPIC,NULL) ;
|
|
|
|
|
Thank You
I copied htmlhelp.lib into the project & then added it to the linker dependencies and it compiles & links now with errors.
Cheers,
Ali
|
|
|
|
|
Hi,
We are trying to establish connection between Delegate client and server.
we able to set Delegate server. we are having problem to set Delegate client.
If we try to establish connection, following error occur
1) unknown parameter: -P8021 FCL
2) NIS not available
3) ## cannot load z
pls provide soln for above problem. so we are able to establish connection.
regards
Girish
Software Developer
|
|
|
|
|
|
|
write smth like it
class MyClass : public CObject{
public:
MyClass();
virtual ~MyClass();
virtual void Serialize(CArchive& ar);
COleDateTime m_tmDate;
};
ar<<m_tmdate.m_dt;
ar<<(int)m_tmdate.m_status;
ar>>m_tmDate.m_dt;
ar>>(int)m_tmDate.m_status;
as result: error C2679: binary '>>' : no operator found which takes a right-hand operand of type 'int' (or there is no acceptable conversion)
|
|
|
|
|
NoName II wrote: ar<<m_tmdate.m_dt;
ar<<(int)m_tmdate.m_status;
ar>>m_tmDate.m_dt;
ar>>(int)m_tmDate.m_status;
ar<<m_tmDate;
ar>>m_tmDate; Tell the class to do the stuff. You are trying to help too much!
Nibu thomas
Software Developer
Faqs by Michael dunn
|
|
|
|
|
what's mean
"An attempt was made to access an unnamed file past its end
CFile file;
if(!file.Open(_T("persons.dat"),CFile::modeRead)){
AfxMessageBox(_T("Unable to open the file"));
exit(-1);
}
CArchive arr(&file,CArchive::load);
m_obDebtors.Serialize(arr);
arr.Close();
file.Close();
|
|
|
|
|
what's mean
"An attempt was made to access an unnamed file past its end
CFile file;
if(!file.Open(_T("persons.dat"),CFile::modeRead)){
AfxMessageBox(_T("Unable to open the file"));
exit(-1);
}
CArchive arr(&file,CArchive::load);
m_obDebtors.Serialize(arr);
arr.Close();
file.Close();
|
|
|
|
|
what's mean
"An attempt was made to access an unnamed file past its end
CFile file;
if(!file.Open(_T("persons.dat"),CFile::modeRead)){
AfxMessageBox(_T("Unable to open the file"));
exit(-1);
}
CArchive arr(&file,CArchive::load);
m_obDebtors.Serialize(arr);
arr.Close();
file.Close();
|
|
|
|
|
NoName II wrote: "An attempt was made to access an unnamed file past its end
I never heard about this error. It's perhaps because you try to load more objects than the file contains. So, you try to read after the end of the file. Can you confirm that your load and save parts serialize exactly the same objects in the same order ?
|
|
|
|
|
Hi,
would you please give a hand?
how to create a batch of button(more than 200) in the code?
use the array?
And then mapping the messages to one function onButtonClick()?
void onButtonClick(){
....// differentiate the buttons?
....//
}
..
-- modified at 3:12 Wednesday 10th May, 2006
|
|
|
|
|
Store these buttons inside a CTypedPtrMap or CTypedPtrList based on your requirements. Map requires key value pairs. For key you can use the Id of the button.
Override OnCommand to dynamically handle messages from these buttons instead of providing message map entries.
Nibu thomas
Software Developer
Faqs by Michael dunn
|
|
|
|
|
thank you for your kindness.
I'm afraid I don't know the way of "Store these buttons inside a CTypedPtrMap or CTypedPtrList based on your requirements. Map requires key value pairs. For key you can use the Id of the button."
would you show me the simple code?
and another base-question is dynamically creating button:
I wrote the (a) and (b) in function OnInitDialog()
(a)
CButton btn;
btn.Create("Hi,World",WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON,CRect(10,20,80,40),this,104);
(b)
CButton *btn = new CButton;
btn->Create("Hi,World",WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON,CRect(10,20,80,40),this,104);
it seems that the (a) can't work, but (b) is ok.
is there any different using pointer or not?
|
|
|
|
|
zeus_master wrote: it seems that the (a) can't work, but (b) is ok.
is there any different using pointer or not?
Yes, in your case: you are probably declaring the CButton inside the OnInitDialog function, so its scope is limited to the function. Once the function is finished, the CButton destructor will be called, thus removing the button from the dialog. You won't have the problem if it's a member variable of the class.
To store the buttons, you can also simply store them in a vector or list. Don't forget to change the ID of each button also (and be sure the range of ID's you are using is 'reserved' in the resource.h file, otherwise, some other controls could take the same id and you will be in troubles).
|
|
|
|
|
thank you again for your timely teaching.
I wrote it like this, but it was faild:
CButton * btn[5];// = new 5 CButton
int i =1;
CString str;
for (i=0;i<5;i++) {
str.Format("%0x",i); // for set button caption
btn[i]->Create(str,WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON,CRect(10,20+30*i,80,40+30*i),this,104+i);
}
|
|
|
|
|
Try to use vector or list from the STL instead. In your class, delcare a member variable (don't forget to include vector):
#include <vector>
CMyClass
{
private:
std::vector<CButton> m_MyButtons;
};
Then in OnInitDialog (or where you create the buttons):
std::vector<CButton>:iterator iter = m_MyButtons.begin()
for(iter; iter!=m_MyButtons.end();iter++)
{
(*iter).Create(str,WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON,CRect(10,20+30*i,80,40+30*i),this,104+i);
}
I didn't test the code so there are perhaps some errors.
I strongly suggest you read some tutorials on the use of containers of the STL (list, vectors, ...). They are VERY usefull and much more safer than dynamic arrays. There is some tutorials on this website.
|
|
|
|
|
is it std::vector<cbutton>::iterator?
how to initialize m_MyButtons?
std::vector<cbutton> m_MyButtons(0,5);?
I think my stupid project/question have made you crazy,sorry again.
|
|
|
|
|
zeus_master wrote: is it std::vector::iterator?
Yes sorry, it was a typo. (I suppose the < and > were removed in your post because you didn't check the 'Ignore HTML tags' check box).
zeus_master wrote: how to initialize m_MyButtons?
You don't initialize them. The constructor of the class is called and after that, you just need to call Create for all the button (see the code I posted).
|
|
|
|
|
Ooops, sorry, I just realized there is something missing in the code: buttons are never added in the vector (so basically what you have now is an empty vetor, not very usefull isn't ?).
So, to do that remove the code with the iterator and replace everything by this:
for (int i=0;i<10;i++)
{
CButton NewButton;
NewButton.Create(str,WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON,CRect(10,20+30*i,80,40+30*i),this,104+i);
m_MyButtons.push_back(NewButton);
}
So, this will create 10 buttons and add them to the vector. Then, afterwards, if you need to access the buttons again, you can use the code I previously posted (with the iterator): it is used to retrieve data from the vector.
Hope this help, sorry to have forgotten that
|
|
|
|
|
I met compiler error below:
c:\program files\microsoft visual studio\vc98\include\xutility(39) : error C2582: 'CButton' : 'operator =' function is unavailable
c:\program files\microsoft visual studio\vc98\include\vector(170) : see reference to function template instantiation 'void __cdecl std::fill(class CButton *,class CButton *,const class CButton &)' being compiled
c:\program files\microsoft visual studio\vc98\include\xutility(25) : error C2582: 'CButton' : 'operator =' function is unavailable
c:\program files\microsoft visual studio\vc98\include\vector(174) : see reference to function template instantiation 'class CButton *__cdecl std::copy_backward(class CButton *,class CButton *,class CButton *)' being compiled
c:\program files\microsoft visual studio\vc98\include\xmemory(34) : error C2558: class 'CButton' : no copy constructor available
c:\program files\microsoft visual studio\vc98\include\xmemory(66) : see reference to function template instantiation 'void __cdecl std::_Construct(class CButton *,const class CButton &)' being compiled
Error executing cl.exe.
|
|
|
|
|
Operator = ?? What are you doing with this operator ?
Can you post the code ?
|
|
|
|
|
I didn't do anything.
I just creat a new dialog based project named stl.
and according your mean,add the code in the place your said:
stldlg.h
<code>// stlDlg.h : header file
//
#if !defined(AFX_STLDLG_H__0E3FD69C_3BD2_48E1_B6A9_3C850CD124FA__INCLUDED_)
#define AFX_STLDLG_H__0E3FD69C_3BD2_48E1_B6A9_3C850CD124FA__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include <vector>
/////////////////////////////////////////////////////////////////////////////
// CStlDlg dialog
class CStlDlg : public CDialog
{
// Construction
public:
CStlDlg(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CStlDlg)
enum { IDD = IDD_STL_DIALOG };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CStlDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
private:
std::vector<CButton> m_MyButtons;
// Implementation
protected:
HICON m_hIcon;
// Generated message map functions
//{{AFX_MSG(CStlDlg)
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STLDLG_H__0E3FD69C_3BD2_48E1_B6A9_3C850CD124FA__INCLUDED_)
</code>
then add the initialization in BOOL CStlDlg::OnInitDialog()
<code>
// TODO: Add extra initialization here
CString str="stlbtn";
for (int i=0;i<10;i++)
{
CButton NewButton;
NewButton.Create(str,WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON,CRect(10,20+30*i,80,40+30*i),this,104+i);
m_MyButtons.push_back(NewButton);
}
</code>
|
|
|
|
|