|
Can you explain me how to do that please?
Sorry I haven't been programming in C++ for a long while.
By the way, I've tried to add a RichEdit control instead of an EditBox but it didn't worked.
When I add one and try to execute the program, nothing/no window appears...
|
|
|
|
|
How are you loading and saving a file?
Asim Hussain
e: asim@jawache.net
w: www.jawache.net
|
|
|
|
|
To save and open I use:
int saved = 0;
CString fileinfo;
void CFastPHPDlg::OnFileSave()
{
char szFilter[]="Fichier HTML(*.html)|*.html|Fichier SHTML(*.shtml)|*.shtml|Fichier PHP(*.php)|*.php|Fichier PHP3(*.php3)|*.php3|Fichier PHP4(*.php4)|*.php4|Fichier PHTML(*.phtml)|*.phtml|";
CFileDialog dlgFile(FALSE, "html", "*.html", OFN_FILEMUSTEXIST|OFN_HIDEREADONLY, szFilter, this);
CString output;
if(saved == 0)
{
if(dlgFile.DoModal() == IDOK)
{
htmlfile = fopen(dlgFile.GetFileName(), "w+");
m_phpEdit.GetWindowText(output);
fputs(output, htmlfile);
fclose(htmlfile);
CFastPHPDlg::SetWindowText(dlgFile.GetFileName());
CFastPHPDlg::GetWindowText(fileinfo);
CFastPHPDlg::SetWindowText("FastPHP - " + dlgFile.GetFileName());
saved++;
}
}
else
{
htmlfile = fopen(fileinfo, "w+");
//CString output;
m_phpEdit.GetWindowText(output);
fputs(output, htmlfile);
fclose(htmlfile);
CFastPHPDlg::SetWindowText("FastPHP - " + fileinfo);
saved++;
}
}
void CFastPHPDlg::OnFileOpen()
{
char szFilter[]="Fichier HTML(*.html)|*.html|Fichier SHTML(*.shtml)|*.shtml|Fichier PHP(*.php)|*.php|Fichier PHP3(*.php3)|*.php3|Fichier PHP4(*.php4)|*.php4|Fichier PHTML(*.phtml)|*.phtml|";
CFileDialog dlgFile(FALSE, "html", "*.html", OFN_FILEMUSTEXIST|OFN_HIDEREADONLY, szFilter, this);
if(dlgFile.DoModal() == IDOK)
{
CString input;
char temp[200];
htmlfile = fopen(dlgFile.GetFileName(), "r+");
while(!feof(htmlfile))
{
fgets(temp, 200, htmlfile);
input=input+temp;
}
m_phpEdit.SetWindowText(input);
fclose(htmlfile);
CFastPHPDlg::SetWindowText(dlgFile.GetFileName());
CFastPHPDlg::GetWindowText(fileinfo);
CFastPHPDlg::SetWindowText("FastPHP - " + dlgFile.GetFileName());
saved++;
}
}
*Fichier = File, in french. Because my program is in french.
Thanks for helping me
|
|
|
|
|
Cerb wrote:
m_phpEdit.GetWindowText(output);
fputs(output, htmlfile);
fclose(htmlfile);
m_phpEdit.GetWindowText(output);
output.Replace(_T("\\r"),_T(""));
fputs(output, htmlfile);
fclose(htmlfile);
Cerb wrote:
m_phpEdit.SetWindowText(input);
input.Replace(_T("\\n"),_T("\\r\\n"));
m_phpEdit.SetWindowText(input);
or something along those lines i reckon should work.
Asim Hussain
e: asim@jawache.net
w: www.jawache.net
|
|
|
|
|
To use richedit you should call AfxInitRichEdit() first.
I am seeking...
For what?
Why did you ask me for what? I don't know!
|
|
|
|
|
Hi,
when the List is scrolled, i've to hide a edit control ( editable sub items ). But i can't find the scroll event message in the class wizard.
I use a scroll mouse.
Can somebody help me ?
Marco
|
|
|
|
|
I am doing something like:
std::string id=(char *)(_bstr_t)m_pRecordSet->GetCollect(L"id");
i.e I am collecting the "id" field value from record set object and assigning it to string. This works fine for me. But the problem is that the value of "id" field can be NULL. And whenever such situation appears, my program raises an exception. How can i prevent this error and copy NULL to string successfully when this situation happens.
|
|
|
|
|
std::string id=(char *)(_bstr_t)m_pRecordSet->GetCollect(L"id");
Hi I think that GetCollect returns a variant, and in case of
NULL values, this variant has a VT type of VT_NULL,you
could check for it.
|
|
|
|
|
hi all,
I am creating a web browser thing using CHtmlView. In this application I wish to get the value entered by a user in a particular text box in an HTML page which is opened in my browser. I know the url of the page. Can you help me in getting this done.
Thanking all in anticipation
Regards,
Onkar
|
|
|
|
|
Steps :
- get the current document (IHTMLDocument2)
- then get the document.forms collection
- for each IHTMLFormElement, retrieve the target IHTMLInputElement edit box by going through the .elements collection (edit box are usually identified by their names : IHTMLInputElement::get_name(BSTR* p);)
- set/get the appropriate value with IHTMLInputElement::put_value(BSTR v);
And I swallow a small raisin.
|
|
|
|
|
Hi Mr Rodriguez,
Thanks for your reply. But I guess this method is a bit tedious and also it won't solve all my purpose. So I have figured out a different approach. Can u help me in modifying the url to navigate. I have sinked the BeforNavigate2 event in my CHtmlview class. I have read in an article that I can modify the navigation by sinking event BeforeNavigate2. I have to modify the url. Pls help me with code fragment to achieve the same. I ahve seen an article in MSDN periodicals but it has a vb example. Pls help me
Regards,
Onkar
|
|
|
|
|
I want a ComboBox that doesn't accept the user typing in some data.
I'm pretty sure this is just a flag to be set on creation, WM_EX_NOINPUT or something but I can't remember which one.
Can anyone help?
Asim Hussain
e: asim@jawache.net
w: www.jawache.net
|
|
|
|
|
Apply the CBS_DROPDOWNLIST style.
STL is a religeon. Enquiries to Reverend Christian Graus
|
|
|
|
|
Bugger...
I had applied that style but to the ToolBar and not the ComboBox !!??!!
must have been late at night.
Cheers
Asim Hussain
e: asim@jawache.net
w: www.jawache.net
|
|
|
|
|
How can I add tooltip control to picture control...Because there is only one default message handler(BN_CLICKED) no WM_MOUSEMOVE...what to do?
please help me.
Prateeti
|
|
|
|
|
Niek Albers' CHoverButton [^] provides tooltips for a CButton -derived class. Maybe you can cut & paste the code to your control.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Set the notify style of the picture control. You can then add a tool tip for the control by doing th following:
call EnableToolTips()
in messge map
ON_NOTIFY_EX(TTN_NEEDTEXT, 0, OnToolTipNotify)
in header file
afx_msg BOOL OnToolTipNotify(UINT id, NMHDR * pNMHDR, LRESULT * pResult);
in .cpp file
BOOL CSamplesFloat::OnToolTipNotify(UINT /*id*/, NMHDR *pNMHDR, LRESULT * /*pResult*/)
{
TOOLTIPTEXT *pTTT = (TOOLTIPTEXT *)pNMHDR;
if (pTTT->uFlags & TTF_IDISHWND)
{
// idFrom is actually the HWND of the tool
UINT nID = ::GetDlgCtrlID((HWND)pNMHDR->idFrom);
pTTT->lpszText = "";
switch (nID)
{
case IDC_PICTURE_CONTROL :
pTTT->lpszText = "My picture control" ;
break ;
case IDC_METHODDETAILS :
pTTT->lpszText = "The selected methods details" ;
break ;
}
if (pTTT->lpszText[0] != '\0')
{
pTTT->hinst = AfxGetResourceHandle();
return TRUE ;
}
}
return FALSE ;
}
In fact this can add a tolltip for any control in a dialog/view/floating window etc that you do this for.
Roger Allen
Sonork 100.10016
I think I need a new quote, I am on the prowl, so look out for a soft cute furry looking animal, which is really a Hippo in disguise. Its probably me.
|
|
|
|
|
Good day everyone,
I would like to know how to prevent a child window from moving from its original position when interecting with a mouse/keyboard. A good example of this would be Microsoft Visual Basic (6.0) form editor. The form in the designer window allows the user to change the width or height of the window but not the X/Y psoition at 0,0 or close to it.
|
|
|
|
|
try handling WM_MOVE and simply not passing it on to the controls window procedure
|
|
|
|
|
Actualy tried that and it still allowed it to move. What I did try and seem to work is handling the WM_WINDOWPOSCHANGING and provided the X and Y attibutes a constant value.
Thanks for your reply.
|
|
|
|
|
Hi all,
How can i add a Menu Bar to my dialog based application?.
Hope that anyone will help me.
With regards
Shibu
|
|
|
|
|
Create the menu, open dialog template in the resource editor and select menu from dropdown list on 'General' page.
Tomasz Sowinski -- http://www.shooltz.com
Free your mind and your ass will follow.
|
|
|
|
|
or you can create the menu manually and call SetMenu() from within the dialogs OnInitDialog() handler.
this is useful if you intend to dynamically modify the top level menu items.
ps. whenever you call SetMenu() , msdn says you must follow up with a call to DrawMenuBar()
|
|
|
|
|
Hi all,
How can i detect mouse over a particular button say (IDC_BUTTON) programatically?
With regards
|
|
|
|
|
Handle WM_MOUSEMOVE .
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|