|
Thanks Christian, it's good to see that some people are still considerate enough to help another person with their work.
Regards
Liam
Senior Test Engineer
GLI Australia
www.gli.com.au
|
|
|
|
|
I noticed, just today, that IE has an interesting feature when organizing your favourites list. What I noticed is a line appears under an entry when you drag over it. It appears that the line is indicating where the item will be dropped. What this means to me is that a folder can be repositioned within the list rather than becoming a child of the target. I would like to do the same thing but have no idea how. I see this same type of thing in other products, Netscape and DemoShield. Can anyone help me? Try it yourself if you have not experienced this yet!
|
|
|
|
|
Check these methods:
CTreeCtrl::SetInsertMark
CTreeCtrl::SetInsertMarkColor
They're simple wrappers around TVM_SETINSERTMARK and TVM_SETINSERTMARKCOLOR messages, supported on COMCTL version 4.71 and later. Basically this means that target machine must have IE 4.0 or later installed.
Tomasz Sowinski
http://www.shooltz.com.pl
|
|
|
|
|
does anyone know how make a window active when multiple windows are open.
in an mdi applicatin under window menu item there is a list of all open files and the active
one is checked, i want to know how that code works, so that when i click on my tree node
that window should be activated,
Thanks,
F.Dost
|
|
|
|
|
Yeah its pretty easy,
use the SetActiveWindow (hwnd ) function.. You need to get the window handle for the window you want to activate though..
Do that by
hwnd = FindWindow(NULL, "Put the window title here")
SetActiveWindow (hwnd )
|
|
|
|
|
If you are talking about the MDI "document windows", you need to send WM_MDI* messages to the "MDI client", the window that is usually in the dark gray colour.
|
|
|
|
|
Hello, the codegurus around the world.;)
I often use this function from "HOW-TO VISUAL C++ 4.0" by Scott ?
to change the active view on MDI application.
void CMainFrame::SwitchToView(CDocTemplate* pTemplate, CRuntimeClass* pViewClass)
{
CMDIChildWnd* pMDIActive = MDIGetActive();
CDocument* pDoc = pMDIActive->GetActiveDocument();
CView* pView;
POSITION pos = pDoc->GetFirstViewPosition();
while(pos != NULL)
{
pView = pDoc->GetNextView(pos);
if(pView->IsKindOf(pViewClass))
{
pView->GetParentFrame()->ActivateFrame();
return;
}
}
CMDIChildWnd* pNewFrame = (CMDIChildWnd*)
pTemplate->CreateNewFrame(pDoc, NULL);
if(pNewFrame == NULL) return;
pTemplate->InitialUpdateFrame(pNewFrame, pDoc);
}
and call this function anywhere like this.
((CMainFrame*)AfxGetMainWnd())->SwitchToView(theApp.m_pAppTemplate,
RUNTIME_CLASS(CAppView));
Have a nice day!
-Masaaki Onishi-
|
|
|
|
|
I know how to define flags...
#define FLAG1 0x00000001
#define FLAG2 0x00000002
#define FLAG3 0x00000004
#define FLAG4 0x00000008
#define FLAG5 (FLAG1|FLAG2|FLAG3|FLAG4) //for all
I would also like to have a way that FLAG1 -FLAG4 cant be ORed together expected when ORed together in FLAG5's ()
Any help...
|
|
|
|
|
hey brandon
preventing them from being or'd is simply a case of not writing code that or's them together
you can't stop certain bit combinations from appearing except by not creating them in the first place
---
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|
|
Brandon,
You can't prevent someone from creating a particular value (after all, you don't have physical control over their keyboards ). What you want is an assert in your code that checks the passed-in flags. This will tell the programmer that they have passed you an illegal combo of flags.
void CYourFunction ( DWORD dwFlags )
{
ASSERT( (dwFlags & FLAG1|FLAG2|FLAG3|FLAG4) == FLAG1|FLAG2|FLAG3|FLAG4 ||
(dwFlags & FLAG1|FLAG2|FLAG3|FLAG4) == 0 );
}
This verifies that all or none of FLAG1-4 were passed.
Use ASSERT in MFC code, ATLASSERT in ATL, and _ASSERTE for plain ol' CRT.
--Mike--
http://home.inreach.com/mdunn/
The Signature, back by popular demand: Buffy. Pajamas.
|
|
|
|
|
Thank you that is what I was looking for.
|
|
|
|
|
I would like to know if there are similar functions as clreol and gotoxy which are not supported by vc++
|
|
|
|
|
What do they do ? In GDI you have MoveTo, is that what gotoxy does ?
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
AFAIK, VC runtime library exposes no such functionality. If you really want to play with text-mode windows/menus, your only hope are low-level console APIs, like WriteConsoleOutputCharacter
Tomasz Sowinski
http://www.shooltz.com.pl
|
|
|
|
|
Hi
I am trying to create my own help topics by modifying afxcore.rtf file, but it doesn't seem to work. I can never get rid of <<add your="" application-specific="" topics="" here="">> message in the Contents tab. Does anyone know why? Could anyone please help me how to add one by one topics to this Help Topics pages?
Thank you very much for your time.
kk9
|
|
|
|
|
I have several controls derived from the COleControl class. With the installation of Office 2000 all of them fail when "inserted" into any of the office applications (Word, Excel, PowerPoint). I have spent some time trying to find what I had corrupted and find nothing wrong. They all worked fine in Office 97. My enviroment is limited to NT4 SP6 for this testing.
This morning I created a new control using the "MFC ActiveX Control Wizard" in VC6. Show as an insertable object was checked in the wizard. Compiled it (with no modification) and I find exactly the same problem. It crashes Office when inserted. The message recieved is "xx has found an error it can not correct. Save, Close and Restart."
I have steped through the initialization code and all looks fine. It never gets to the drawing code. So the failure is somewhere in between these points. From using the debug option when the failure occers it appears that the IsKindOf Function is failing. But this is really info that I can not be sure of exactly where the call is coming from.
So my question is has anyone else seen this response?
Michael A Barnhart
mabtech@swbell.net
|
|
|
|
|
Why w*fstream classes converts unicode characters to single byte before storing?
As it well known, Standard Template Library has wstring type, which operates with the unicode characters. Also there is the corresponding steams types, such as for example wofstream.
When I use the code below, resulting text file contains single byte characters (ASCII), i.e. the stream converts string from multibyte presentation to single byte. Why? I am absolutely sure that wstring contains natural unicode symbols.
std::wofstream outfile ("somefile.txt") ;
std::wstring str1 = L"Some string" ; //L translates char to wide char (MSVC)
outfile << str1 ;
outfile.close() ;
|
|
|
|
|
I am developing my first custom control, CNewEdit derived from CEdit, which will use a non-system font for display. I want to create the font and then call CWnd::SetFont() after the control's window has been created. I don't want to do this outside the CNewEdit class (by adding code to the dialog class that is containing my CNewEdit control).
My instinct is to provide a handler in CNewEdit for WM_CREATE. However, although Class Wizard allows me to define this message handler, I can't get execution to breakpoint inside CNewEdit::OnCreate(). The rest of the class is working as I have customised the background and text colours and these are ok.
I find it strange that if I add a handler for WM_DESTROY to CNewEdit I can breakpoint successfully in OnDestroy(). So why not OnCreate()?
Mark Jones
Software Engineer
Hampshire
UK
|
|
|
|
|
Is your function really CNewEdit::OnCreate()?
If so it is probably not being called. The WM_CREATE message calls.
CMyEdit::OnCreate(LPCREATESTRUCT lpCreateStruct);
I usually override the create function as shown below and add the functionality that I need. But both of the below functions are executed when created by the parent.
One other option is are you calling Create or letting teh creation in a dialog initialization call it? IF the last case it may be only calling the base class.
Header File
class CMyEdit : public CEdit
{
// Construction
public:
CMyEdit();
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMyEdit)
public:
virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CMyEdit();
// Generated message map functions
protected:
//{{AFX_MSG(CMyEdit)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
C++ file
BEGIN_MESSAGE_MAP(CMyEdit, CEdit)
//{{AFX_MSG_MAP(CMyEdit)
ON_WM_CREATE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMyEdit message handlers
// Create Message Handler
int CMyEdit::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CEdit::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: Add your specialized creation code here
return 0;
}
// Virtual Function Override.
BOOL CMyEdit::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
{
// TODO: Add your specialized code here and/or call the base class
return CWnd::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext);
}
Michael A Barnhart
mabtech@swbell.net
|
|
|
|
|
Thanks for your reply, Michael.
In answer to your first question - I am using CNewEdit::OnCreate(LPCREATESTRUCT lpCreateStruct), I was trying to be brief in my post - my mistake. I have now overrided the:
virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
function but I still cannot breakpoint in this fn or the WM_CREATE handler.
I am using the CNewEdit object in a dialog, whose resource template I have designed in the resource editor. I dragged the standard CEdit control from the resource toolbar onto the dialog. I have looked in the .rc file and have found the resource is identified as a 'EDITTEXT' control - the same as for normal CEdit controls.
I have added a CNewEdit member variable to the dialog class using class wizard. I am not calling the Create function in my code. I think the creation of the window for the CNewEdit control occurs somewhere in CDialog::OnInitDialog().
Is there another mechanism brought into play when controls are created inside dialog boxes?
Mark Jones
Software Engineer
Hampshire
UK
|
|
|
|
|
Creation of window (HWND) for your CNewEdit control occurs before CDialog::OnInitDialog. By the time CDialog::OnInitDialog is called, all child windows defined in the dialog template are already created. CDialog::OnInitDialog calls DoDataExchange, and DoDataExchange associates your CNewEdit instance with some HWND. There's no chance for OnCreate in this scenario - the window is already created.
The function to override is CWnd::PreSubclassWindow.
Tomasz Sowinski
http://www.shooltz.com.pl
|
|
|
|
|
Thanks Tomasz, that's just what I was looking for.
Mark Jones
Software Engineer
Hampshire
UK
|
|
|
|
|
I have an app that will do print preview. The problem I have is that the buttons on the print preview toolbar is not updating. When the "Next Page" button is clicked, the next page is displayed but the "Prev Page" button remain disabled. When the "Two Page" button is clicked, two pages are displayed but the button does not update to "One Page". I am not deriving a Print Preview class, I'm using the default MFC's print preview. Any help or suggestions are greatly appreciated.
|
|
|
|
|
That was also my problem. But I solved it with an plugin named
AAA EasyGrid ActiveX. A really helpful ActiveX. You may visit
http://www.share2.com/easygrid/ for more details.
|
|
|
|
|
Let me go on the record to say that the MFC print preview blows. I recommend rolling your own, which is what I ended up doing. Today is my third 16 hour day trying to get printing done by the end of the week.
Otherwise, you'll find you can get the control being shown by enumerating child windows of the window. You may also be able to get it by ID. Either way, you could nose around the MFC source to get some ideas and then enable the button yourself.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|