|
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
|
|
|
|
|
I suppose you get the compiler error in a IMPLEMENT_DYNCREATE macro.
When you want to be able to create the thread with AfxBeginThread, your thread gets instantiated for you and therefore MFC will call the constructor. The logic for this is in CObject//CreateObject i believe.
The MFC logic has no way to pass parameters to your c onstructor, so whenenver you use a DECLARE_DYNCREATE macro you need a default constructor.
==================
The original message was:
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
|
|
|
|
|
==================
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
Hi Braulio!
example:
Class A
{
public:
A(int x, int y)
{...}
...
}
int main()
{
A p(1,2); // Call the constructor defined
A p; // incorrect! the default constructor doesn't exist. You have to declare it.
...
}
If you defined your own constructor, you have to respect the list of arguments. Not if you add the default constructor (without argument).
Is your case?
Tchao
Sandrine
|
|
|
|
|
Hi Sandrine !
Good To hear from you here in CodeProject !
I'm not sure what have I made wrong, It was with a class that inherited from a CWinThread, and this class I declare it as a dinamyc class ( I think that is the name ), then I think the problem is that it needs a default constructor, but I'm not quite sure... ( sometimes C++ is a "pretty" maze and the easiest thing make me a little bit crazy).
Ciao !
Braulio
|
|
|
|
|
The VC++ docs say that a default constructor is generated if (and only if) no other constructor
has been defined. Once you define the constructor with parameters, you must also explicitly
define the 'default'constructor if it is needed.
==================
The original message was:
Hi Sandrine !
Good To hear from you here in CodeProject !
I'm not sure what have I made wrong, It was with a class that inherited from a CWinThread, and this class I declare it as a dinamyc class ( I think that is the name ), then I think the problem is that it needs a default constructor, but I'm not quite sure... ( sometimes C++ is a "pretty" maze and the easiest thing make me a little bit crazy).
Ciao ! Braulio
|
|
|
|
|
This is a basic C++ question, not OOP.
When ever you create a class the compiler automatically creates a default constructor and a copy constructor. The default constructor is required if you want to create objects like this:
CFoo foo;
As soon as you create ANY constructor, the compiler requires you to write ALL constructors. In other words, it no longer creates the default constructor for you. That means if you write:
struct Point
{
int x;
int y;
};
Point origin;
...but if you write this...
struct Point
{
int x;
int y;
Point(int x, int y): x(x), y(y) {}
};
...the compiler no longer generates the default constructor...
Point origin;
Point origin (12,45);
Note that a default constructor does not have to take 0 arguments, you simply must be able to call it with 0 arguments. Like this...
struct Point
{
int x;
int y;
Point(int x=0, int y=0): x(x), y(y) {}
};
Now everything's happy again...
Point origin;
Point origin (12,45);
Hope this clarifies more than it confuses!
Cheers,
Eric
|
|
|
|
|
I have found information on how to debug control panel applets using Visual C++ but I have a few question I hope you folks can help me with.
MSDN Knowledge Base article number Q166168 says to set the exectuable for the control panel as;
C:\winnt\system32\rundll32.exe
and the program arguments as;
shell32.dll,Control_RunDLL [path and name of CPL file]
The KB mentions this information is valid for all version of Windows. The instructions seems simple enough but I'm having some problems so my 2 questions are;
1. When I specify the full path to my control panel which would be in the default debug folder as set by Devstudio I can't debug the applet. When I run the project nothing seems to happen, it just exits with no error code or any other indication of a problem. If I specify the path to the Windows system folder and place the applet there it seems to work fine but ... (see problem 2)
2. I can't copy over the control panel once it's placed in the system folder and accessed. It must be kept in memory since Windows doesn't allow replacing the file. I know there is a way to force COM DLL's to unload from memory once they are not used, does anyone know if the same is possible with control panel applets? Perhaps a registry setting or some other mechanism to make the OS not cache the control panel in memory and essentially kick it out of memory.
Thanks in advance for any help ...
|
|
|
|
|
I have a code like this
CString cSQL;
CDatabase db;
db.OpenEx( NULL, CDatabase::forceOdbcDialog );
CRecordset tbl( &db );
cSQL.Format( "SELECT * FROM tablename WHERE ID = %d", nID );
tbl.Open( CRecordset::forwardOnly, cSQL );
try {
tbl.GetFieldValue( "ID", cSQL );
tbl.GetFieldValue( "ID", cSQL );
}
catch( CException* e ) {
char szCause[255];
e->GetErrorMessage( szCause, 255 );
e->Delete();
}
The first GetFieldValue() call gets appropriate value into cSQL variable.
But on the second GetFieldValue() call I get CDBException and
the value of szCause is "" - empty string and m_nRetCode member of
CException object is 100.
What is wrong in this code?
Any help would be very helpful.
Thanks in advance.
Stefan
|
|
|
|
|