|
i'm on 98 not NT and if you can send to mu e-mail some code examples it will be very good.
Thierry
|
|
|
|
|
Hi all,
I am writing a MDI application, which views are derivated
by CRichEditView. In the status bar, I want to display the
current position of the caret. The line number is easy to get,
just call GetRichEditCtrl().LineFromChar(-1), but how to determine the column?
Thanks in advance,
Thömmi
|
|
|
|
|
Thömmi,
You are actualy very close to the solution to this problem.
To get the caret position within current line you will have to look at two CRichEditCtrl member functions.
GetSel - if you are not handling the 'EN_SELCHANGE' notification than use this function to get current position of the caret. Vales returned contain character position from the beginning of the rich edit string.
Use the LineIndex function to get total number of characters before current line.
By subtracting chars before line from the caret position you will get column index in current line.
void CRichEditTestDlg::OnSelchangeRichedit(NMHDR* pNMHDR, LRESULT* pResult)
{
SELCHANGE *pSelChange = reinterpret_cast<selchange *="">(pNMHDR);
CString tempStr;
tempStr.Format( "ln: %d, col: %d",
m_richEdit.LineFromChar( -1 ),
pSelChange->chrg.cpMin - m_richEdit.LineIndex( -1 ));
SetDlgItemText( IDC_POS, tempStr );
*pResult = 0;
}
Peter Zajac
Dundas Software
==================
The original message was:
Hi all,
I am writing a MDI application, which views are derivated by CRichEditView. In the status bar, I want to display the current position of the caret. The line number is easy to get, just call GetRichEditCtrl().LineFromChar(-1), but how to determine the column?
Thanks in advance, Thömmi
|
|
|
|
|
Hi all,
I am writing a MDI application, which views are derivated
by CRichEditView. In the status bar, I want to display the
current position of the caret. The line number is easy to get,
just call GetRichEditCtrl().LineFromChar(-1), but how to determine the column?
Thanks in advance,
Thömmi
|
|
|
|
|
long startChar, endChar;
GetRichEditCtrl().GetSel(startChar, endChar);
startChar marks the start of the selection and endChar the end. If there is no current selection then the two values will be the same and will indicate the position of the caret.
|
|
|
|
|
Hi,
Does anyone know how to redirect cerr to a string stream?
Thank you
Hung
|
|
|
|
|
Hi Hung!
You can use the assignment operator of the cere.
Here is the small example which can help you:
#include "stdafx.h"
#include <iostream.h>
#include <strstrea.h>
char szBuffer[1024];
ostrstream cstr(szBuffer, sizeof(szBuffer)-1);
int main(int argc, char* argv[])
{
// put something in the output streams
cout << "Standart Output\n";
cerr << "Standart Error\n";
cstr << "***Our String**\n";
// use the assignment operator to change the cerr
cerr = cstr;
cout << "Standart Output\n";
cerr << "Standart Error After Assigment\n";
// show the content of our cstr
//cout << cstr.str();
cout << endl << "Preess ENTER to exit" << endl;
getchar();
return 0;
}
Alex Gorev,
Dundas Software.
==================
The original message was:
Hi,
Does anyone know how to redirect cerr to a string stream?
Thank you
Hung
|
|
|
|
|
hi all,
Could someone tell me how to remove the scroll bars in Chris Maunder's Grid Control?
Thanks in advance!
Jason
|
|
|
|
|
The autosize functions need some tweaking which I will do in the next release. This should solve the problem.
cheers,
Chris
==================
The original message was:
hi all,
Could someone tell me how to remove the scroll bars in Chris Maunder's Grid Control?
Thanks in advance! Jason
|
|
|
|
|
Hi!
We have a multi-threaded application, and want to use HTML Help, so we link with htmlhelp.lib. And run in the error with the LIBCMT lib. I changed the project settings to ignore it. But doesn't this affect the multi-threading of the app?
One solution mentioned in the MSKB is to link with hhctrl.lib. Okay, but where can I find it?
Martin
|
|
|
|
|
I'm not sure if this will help, but we are using Html Help that calls up a .chm file and I just do a ShellExecute on hh.exe and pass it the appropriate page that is supposed to go to. I do this in the OnHelpInfo function for every dialog. If you need more information let me know.
Carole
==================
The original message was:
Hi!
We have a multi-threaded application, and want to use HTML Help, so we link with htmlhelp.lib. And run in the error with the LIBCMT lib. I changed the project settings to ignore it. But doesn't this affect the multi-threading of the app?
One solution mentioned in the MSKB is to link with hhctrl.lib. Okay, but where can I find it?
Martin
|
|
|
|
|
Hi Carole,
thanks for your reply, but calling HtmlHelp via ShellExecute was not an option, because I want to handle it in one place, in CWinApp::WinHelp. But the problem is solved now. Downloading the newest version of the HTML Help Workshop from the microsoft site solved the problem.
Martin
|
|
|
|
|
I want to use MAPI32.DLL to send/receive email.
First, I'm success to send e-mail by MAPISendMail function. (refernced by CDocument::OnFileSendMail())
But I fail to received the mail. I guess the receiving flow below.
MAPILogon call(Session establish)->MAPIFindNext call(mail search)->MAPIReadMail(mail read)->MAPILogoff(session cut off)->MAPIFreeBuffer(message struct memory release)
Well, I don't know this flow is right.
Anyway, I'm success to call MAPILogon function. but second calling (MAPIFindNext) is failed (MAPI_E_FAILURE)
Help me!
|
|
|
|
|
VC6, MFC, Win95/98
I have a question that I can not seem to find an answer or sample code. I want the following behavior:
The first opened child windows, w1, fills the CMDIFrameWnd Client window from corner to corner. If the user opens a second window, w1 and w2 tile vertically. If a third child window is opens, w1 and w2 stay side by side at the top half and w3 tiles bellow w1 and w2 from far left to right. If a fourth window opens, child w3 moves over to the left 1/2 and child w4 takes it place bellow w2 and to the right of w3. The end result equals four child windows; w1 upper/left, w2 upper/right, w3 lower/left, w4 lower/right. As the end user closes the windows, I want to reverse the open process. What is the best way to achieve my goal? Is there any source code showing how to do this? All suggestion welcome and source greatly appreciated
|
|
|
|
|
1) Write a window class dervied from CWnd.
class MdiClient : public CWnd
{
DECLARE_DYNAMIC( MdiClient )
public:
// Construction/Destruction
MdiClient();
protected:
// ClassWizard generated message map functions
//{{AFX_MSG( MdiClient )
//}}AFX_MSG
afx_msg LRESULT OnMDICreate( WPARAM, LPARAM lParam );
afx_msg LRESULT OnMDIDestroy( WPARAM wParam, LPARAM );
DECLARE_MESSAGE_MAP()
int m_nMDICount;
};
IMPLEMENT_DYNAMIC( MdiClient, CWnd )
// Construction/Destruction
MdiClient::MdiClient()
: m_nMDICount( 0 )
{
}
// ClassWizard generated message map functions
BEGIN_MESSAGE_MAP( CLASS, BASE )
//{{AFX_MSG_MAP( MdiClient )
//}}AFX_MSG_MAP
ON_MESSAGE( WM_MDICREATE, OnMDICreate )
ON_MESSAGE( WM_MDIDESTROY, OnMDIDestroy )
END_MESSAGE_MAP()
LRESULT MdiClient::OnMDICreate( WPARAM, LPARAM lParam )
{
LPMDICREATESTRUCT lpmdic = (LPMDICREATESTRUCT)lParam;
HWND hwndMDIChild = (HWND)CWnd::DefWindowProc( WM_MDICREATE, 0L, (LRESULT)lpmdic );
if ( hwndMDIChild != NULL )
{
++m_nMDICount;
// Reposition the MDI childs like you want
}
return (LRESULT)hwndMDIChild;
}
LRESULT MdiClient::OnMDIDestroy( WPARAM wParam, LPARAM )
{
--m_nMDICount;
if ( m_nMDICount > 0 )
{
// Reposition the MDI childs like you want
}
return CWnd::DefWindowProc( WM_MDIDESTROY, wParam, 0L );
}
2) Derive a class from CMDIFrameWnd, and overwrite OnCreate.
int MdiFrameWnd::OnCreate( LPCREATESTRUCT lpCreateStruct )
{
if( CMDIFrameWnd::OnCreate( lpCreateStruct ) == -1 )
{
return -1;
}
m_pwndMdiClient = new MdiClient;
if( !m_pwndMdiClient->SubclassWindow( m_hWndMDIClient ) )
{
return -1;
}
return 0;
}
HTH
Martin
|
|
|
|
|
Sorry, forgot one thing. Of course you must include a data member of type MdiClient in your CMDIFrameWnd derived class.
Martin
|
|
|
|
|
Does anyone know if there is a mpeg-video decoding
class or perhaps a library.
tnx,
Kai
|
|
|
|
|
Hi,
OnDraw..., draws all the screen ?, or with InvalidateRect(...), draws only a portion of the screen ?, I call ScrollWindow ( in a scroll view), how can I get in the on Draw method the rectangle of the screen that will be new drawn ( not moved) ?
Thanks, Bye !
Braulio
|
|
|
|
|
You receive this rectangle when you call BeginPaint in your WM_PAINT message handler. The classwizard adds this function for you.
Note that your OnDraw will also be called for printing.
==================
The original message was:
Hi,
OnDraw..., draws all the screen ?, or with InvalidateRect(...), draws only a portion of the screen ?, I call ScrollWindow ( in a scroll view), how can I get in the on Draw method the rectangle of the screen that will be new drawn ( not moved) ?
Thanks, Bye ! Braulio
|
|
|
|
|
Use CDC::GetClipBox to get the area that needs to be repainted.
|
|
|
|
|
Hi,
I want to be able to print and do another things while I'm doing this ( my printing proccess is very slow), so I have made a thread that inherits from CWinThread, there I pass the handle of the printer Dc, then I convert it to a CDC and I begin to print, ... and then the program print and crashes...
With the screen painting I have used a CClientDc and it goes all right, but with the printer, I have no idea..
Anybody can help me ?, Thanks, Bye !
Braulio
|
|
|
|
|
Hi, is it possible with the CHTMLVIEW class to modify the url without the Navigate2(URL) function ?
Thierry
|
|
|
|
|
Hi,
I have a basic OOP question, I have a class ( a base class, and don't inherits from CObject), and I want to have a constructor with some parameters, I make this, but when I want to compile it without errors I have to add an empty constructor without parameters. Why must I do this ? Have I made something wrong ?
Thanks, Bye !
Braulio
|
|
|
|
|
Hello,
You should have posted some codes. From the written it seems you are using a constructor with parameters as if it is one without a parameter. For the one with the parameter, when creating an instance of the object you need to supply the parameters. For example,
class Basic
{
Basic(int nOne);
....
}
Here you cannot say...
Basic* pBasic = new Basic; // since nOne is not known
Basic theBasic;
You will have to say
Basic* pBasic = new Basic(1111); // for instance
Basic theBasic(1111);
For the definition
class Basic
{
Basic();
......
}
You can write...
Basic theBasic;
Basic* pBasic = new Basic;
OR Basic* pBasic = new Basic();
I hope this clears the problem. If it does, then consider a little more study of constructors/destructors.
Bye,
Paul.
==================
The original message was:
Hi,
I have a basic OOP question, I have a class ( a base class, and don't inherits from CObject), and I want to have a constructor with some parameters, I make this, but when I want to compile it without errors I have to add an empty constructor without parameters. Why must I do this ? Have I made something wrong ?
Thanks, Bye ! Braulio
|
|
|
|
|
Thanks but...,
Sorry, the problems that I have are with the following derived class:
class CDrawToScreenThread : public CGeneralDrawingThread
{
CDrawToScreenThread (){} // I f not, give a compiler error
CDrawToScreenThread (CWnd *pWnd, ScreenParam ScreenParams); // My constructor with params...
}
}
==================
The original message was:
Hello,
You should have posted some codes. From the written it seems you are using a constructor with parameters as if it is one without a parameter. For the one with the parameter, when creating an instance of the object you need to supply the parameters. For example,
class Basic { Basic(int nOne); .... }
Here you cannot say... Basic* pBasic = new Basic; // since nOne is not known Basic theBasic;
You will have to say Basic* pBasic = new Basic(1111); // for instance Basic theBasic(1111);
For the definition class Basic { Basic(); ...... }
You can write... Basic theBasic; Basic* pBasic = new Basic; OR Basic* pBasic = new Basic();
I hope this clears the problem. If it does, then consider a little more study of constructors/destructors.
Bye, Paul.
================== The original message was: Hi,
I have a basic OOP question, I have a class ( a base class, and don't inherits from CObject), and I want to have a constructor with some parameters, I make this, but when I want to compile it without errors I have to add an empty constructor without parameters. Why must I do this ? Have I made something wrong ?
Thanks, Bye ! Braulio
|
|
|
|
|