|
Hi Experts,
I m using CRichEditCtrl for my application.
in which I paste the clipboard data using program.
but there is limitation of Data displayed and copied..
for example > If I copy a file data of size about 65KB then it works fine..
but when I copy full file ( more than 65 KB about 120 KB size)
then it takes only 65 KB and remaining data is neglected.....
so
plz Help me I want to increase my Rich edit's capacity or suggest any
other control that have more ability.
ur reply matters me....
I m waiting.,..
Thanks in advance.
|
|
|
|
|
please use "EM_EXLIMITTEXT"
EM_EXLIMITTEXT message sets an upper limit to the amount of text the user can type or paste into a rich edit control.
Yes U Can ...If U Can ,Dream it , U can do it ...ICAN
|
|
|
|
|
Hello dear friends,
I've added a tab control in a dialogbox and I want to make this tab
control looks like XP style tab control.
How can I achieve this?
Thanks in advance to all of you.
ritz1234
|
|
|
|
|
ritz1234 wrote: How can I achieve this?
You need to add manifest file to your application for this. Read this for more details Using Windows XP Visual Styles[^]
|
|
|
|
|
Thanks for the help Naveen,
I've added the manifest file as shown below
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly
xmlns="urn:schemas-microsoft-com:asm.v1"
manifestVersion="1.0">
<assemblyIdentity
processorArchitecture="x86"
version="1.0.0.0"
type="win32"
name="qpOffice"/>
<description>nnnn</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.2600.2180"
publicKeyToken="6595b64144ccf1df"
language="*"
processorArchitecture="x86"/>
</dependentAssembly>
</dependency>
</assembly>
Still the problem is the dialogbox which contains the tab control has
effect of visual style.But the Tab Control reamins the BTN_FACE color.
Means the color of the tab control doesn't get changed it remains as it
was.I've also used the EnableThemeDialogTexture function of uxtheme.dll.
tell me what is the problem?
ritz1234
|
|
|
|
|
ritz1234 wrote: BTN_FACE color
Sorry I didnt understant that.
Can you show how you create the tab? Is it placed in the resource or dynamically created??
|
|
|
|
|
1)I've included the tab control on the dialogbox.
2)In class that implements the the dialogbox has a member CTabCtrl m_Tab.
3)The .cpp class of this dialogbox has following code.
CoInitialize(NULL); <br />
<br />
EnableThemeDialogTexture(GetSafeHwnd());<br />
<br />
<br />
char szBuffer1[50];<br />
char szBuffer2[50];<br />
<br />
strcpy(szBuffer1,"Login");<br />
strcpy(szBuffer2,"Upload");<br />
<br />
m_Tab = (CXPTabCtrl *)GetDlgItem(IDC_OPTION_TABS);<br />
<br />
<br />
TCITEM tcItem1 = {0};<br />
<br />
tcItem1.mask = TCIF_TEXT;<br />
tcItem1.pszText =szBuffer1;<br />
tcItem1.cchTextMax =79; <br />
<br />
<br />
<br />
TCITEM tcItem2 = {0};<br />
<br />
tcItem2.mask = TCIF_TEXT;<br />
tcItem2.pszText =szBuffer2;<br />
tcItem2.cchTextMax =79; <br />
<br />
m_Tab->InsertItem(0,&tcItem1);<br />
m_Tab->InsertItem(1,&tcItem2);<br />
<br />
m_Tab->SetCurFocus(0);
ritz1234
|
|
|
|
|
ritz1234 wrote: EnableThemeDialogTexture(GetSafeHwnd());
I hope you have tried with out calling this function also.
Coudnt find any problem with this code. Any way pls try specifying the ETDT_ENABLETAB in the EnableThemeDialogTexture () function.
|
|
|
|
|
I've tried for specifying ETDT_ENABLETAB but that doesn't has any effect.
What should be done?
ritz1234
|
|
|
|
|
There are functions like GetCurrentBitmap(), GetCurrentBrush()... but how do we know what objetcs are attached to the cuurent CDC object?
Actually I want to check the GDI objects associated with CDC object and delete all the objects using DeleteObject()
Expecting favourable answers.
|
|
|
|
|
Nope, AFAIK. Anyway selecting a new object gives the (previously) current object back to you.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Doesn't make much sense ...
If you don't own the objects selected into the DC, then you shouldn't
be deleting them.
If you own the objects then you already have the previously selected objects
which you should select back into the DC before destroying the objects.
At least that's what you SHOULD be doing
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi we have been running the DTS package for Direct Deposits, for a while now and suddenly is very slow and data is not updated on applications for users.We get dat from ftp to the tables.
Thank you.
|
|
|
|
|
Hi,
I had develop some MFC calss and that program is working properly. Now I am decided to integrate my MFC class with .NET (C++/CLI).
My requirement is that, I want to use the same MFC class in my C++/CLI Program with out any changes. I can do it like this, I create a .dll file using the same MFC calss in load that .dll file into my C++/CLI ( CLR ) project and create an object using that .dll file and it is working. But I am not satisfied in this methord. Because, through this method, we want to keep a lot of .dll file ( for each class we need to create .dll file and load that .dll file in to my new project ). So I am trying for another method. So I made changes in my mfc project settings and inherit the mfc class in my native class and create an object using the new native calss and i can load the MFC class in my native class and I can call the functions from my native object. But in my MFC class there has a function OnCreate(LPCREATESTRUCT lpCreateStruct). in that function I had do some steps. I can't call that function through the native call. Can you help me to solve this problem?
My aim is using my existing MFC class, I want to create a create a native application ( C++/CLI )
my source code is like this,
MFC class
MyTreeView.h
class CFpiTreeView : public CView
{
protected:
DECLARE_DYNCREATE(CFpiTreeView)
public:
CFpiTreeView();
virtual ~CFpiTreeView();
CTreeCtrl m_Tree;
CStatic m_Logo;
HBITMAP m_hBtmLogo;
void SetTreeItemText(HTREEITEM ti, CString NewText);
public:
protected:
virtual void OnDraw(CDC* pDC);
virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
void Selchanged(NMHDR* pNMHDR, LRESULT* pResult);
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
public:
void Test();
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnSize(UINT nType, int cx, int cy);
DECLARE_MESSAGE_MAP()
};
MyTreeView.cpp
#include "stdafx.h"
#include "FpiTreeView.h"
using namespace System;
using namespace System::Windows;
using namespace System::Windows::Forms;
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#define TREEID 1000
IMPLEMENT_DYNCREATE(CFpiTreeView, CView)
CFpiTreeView::CFpiTreeView()
{
MessageBox::Show(L"Create CFpiTreeView");
}
CFpiTreeView::~CFpiTreeView()
{
DeleteObject(m_hBtmLogo);
}
BEGIN_MESSAGE_MAP(CFpiTreeView, CView)
ON_WM_CREATE()
ON_WM_SIZE()
END_MESSAGE_MAP()
void CFpiTreeView::OnDraw(CDC* pDC)
{
MessageBox::Show(L"OnDraw");
RECT r, r2;
CPen *pOldPen, pen;
CBrush *pOldBrush, brush;
pen.CreatePen(PS_SOLID, 0, RGB(255, 0, 0));
brush.CreateSolidBrush(RGB(255, 0, 0));
GetClientRect(&r);
m_Logo.GetClientRect(&r2);
r.bottom = r2.bottom + 10;
pOldPen = pDC->SelectObject(&pen);
pOldBrush = pDC->SelectObject(&brush);
pDC->Rectangle(r.left, r.top, r.right, r.bottom);
pDC->SelectObject(pOldPen);
pDC->SelectObject(pOldBrush);
}
#ifdef _DEBUG
void CFpiTreeView::AssertValid() const
{
CView::AssertValid();
}
void CFpiTreeView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
#endif //_DEBUG
int CFpiTreeView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
MessageBox::Show(L"OnCreate");
if (CView::OnCreate(lpCreateStruct) == -1)
return -1;
RECT r;
HTREEITEM ti;
r.left = r.top = 0;
r.right = 100;
r.bottom = 100;
m_Logo.Create("", WS_CHILD | WS_VISIBLE | SS_BITMAP, r, this, 18);
m_Logo.SetBitmap(m_hBtmLogo);
r.right = 100;
r.bottom = 100;
m_Tree.Create(WS_CHILD | WS_VISIBLE | TVS_SHOWSELALWAYS | TVS_HASBUTTONS | TVS_LINESATROOT | TVS_DISABLEDRAGDROP | TVS_HASLINES, r, this, TREEID);
m_Tree.SetBkColor(RGB(0, 255, 0));
m_Tree.InsertItem("Grafische Darstellung");
ti = m_Tree.InsertItem("Projektstammdaten");
m_Tree.InsertItem("Eckdaten", ti);
m_Tree.InsertItem("Hinweise", ti);
ti = m_Tree.InsertItem("Kosten Bau");
m_Tree.InsertItem("Übersicht und Verteilung der Gesamtkosten", ti);
m_Tree.InsertItem("Zusammenstellung der Kosten", ti);
return 0;
}
void CFpiTreeView::OnSize(UINT nType, int cx, int cy)
{
CView::OnSize(nType, cx, cy);
RECT r;
int Diff;
m_Logo.GetClientRect(&r);
Diff = r.right - r.left;
r.left = (cx - r.right + r.left) / 2;
r.right = r.left + Diff;
m_Logo.MoveWindow(&r);
r.top = r.bottom = r.bottom + 10;
r.left = 0;
r.right = cx;
if (cy > r.bottom)
r.bottom = cy;
m_Tree.MoveWindow(&r);
}
BOOL CFpiTreeView::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
if (wParam == TREEID)
{
NMHDR *pNMHDR = (NMHDR*)lParam;
if (pNMHDR->code == TVN_SELCHANGED)
Selchanged(pNMHDR, pResult);
}
return CView::OnNotify(wParam, lParam, pResult);
}
void CFpiTreeView::Selchanged(NMHDR* pNMHDR, LRESULT* pResult)
{
}
void CFpiTreeView::SetTreeItemText(HTREEITEM ti, CString NewText)
{
m_Tree.SetItemText(ti, NewText);
}
MainForm.h
#pragma once
#include "ChildView.h"
#include "FpiTreeView.h"
#include "Form1.h"
#include
#include
#include
#using
using namespace System;
using namespace System::Windows;
using namespace System::Windows::Forms;
public ref class MClass : public TreeView
{
public:
MClass() : m_Impl( new CFpiTreeView ) {}
public:
CFpiTreeView * m_Impl;
};
public ref class MyForm : public Form
{
private:
public:
MClass^ tree;
System::ComponentModel::Container ^components;
public:
MyForm(void)
{
tree = gcnew MClass();
tree->Width = 400;
tree->Height = 300;
this->Width=450;
this->Height=400;
this->Controls->Add(tree);
}
private:
};
class CMainFrame : public CFrameWnd
{
public:
CMainFrame();
protected:
DECLARE_DYNAMIC(CMainFrame)
public:
public:
public:
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo);
public:
virtual ~CMainFrame();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
CStatusBar m_wndStatusBar;
CToolBar m_wndToolBar;
CChildView m_wndView;
protected:
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnSetFocus(CWnd *pOldWnd);
DECLARE_MESSAGE_MAP()
};
MainForm.cpp
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
MyForm^ myfrm = gcnew MyForm();
myfrm->Show();
}
using this code, The tree view is created. But the node values, in
int CFpiTreeView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
MessageBox::Show(L"OnCreate");
if (CView::OnCreate(lpCreateStruct) == -1)
return -1;
RECT r;
HTREEITEM ti;
r.left = r.top = 0;
r.right = 100;
r.bottom = 100;
m_Logo.Create("", WS_CHILD | WS_VISIBLE | SS_BITMAP, r, this, 18);
m_Logo.SetBitmap(m_hBtmLogo);
r.right = 100;
r.bottom = 100;
m_Tree.Create(WS_CHILD | WS_VISIBLE | TVS_SHOWSELALWAYS | TVS_HASBUTTONS | TVS_LINESATROOT | TVS_DISABLEDRAGDROP | TVS_HASLINES, r, this, TREEID);
m_Tree.SetBkColor(RGB(0, 255, 0));
m_Tree.InsertItem("Grafische Darstellung");
ti = m_Tree.InsertItem("Projektstammdaten");
m_Tree.InsertItem("Eckdaten", ti);
m_Tree.InsertItem("Hinweise", ti);
ti = m_Tree.InsertItem("Kosten Bau");
m_Tree.InsertItem("Übersicht und Verteilung der Gesamtkosten", ti);
m_Tree.InsertItem("Zusammenstellung der Kosten", ti);
return 0;
}
is not created. How can I call this function?
Please help me
Thank you in Advance
Sabi
modified on Wednesday, May 14, 2008 6:32 AM
|
|
|
|
|
Sorry mate, but I think you are going to get very few answers to your question. At least not if you don't reformat your code with the < pre > < /pre > tags and use the debugger to isolate where the problem is and then paste important code. With such a hugh snippet...
Up to you
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
As Nelek said, you're not going to get people wading through that long code. Certainly not me. You need to read the positing guidelines. The bit about the pre tags are there for a reason. To help you to help us to help you.
To solve your own question, you need to set a bunch of breakpoints and see if your OnCreate is even getting called - then whether your Tree is getting created, and has a HWND, etc. You don't actually check for creation of the tree, you just call the create function.
I'd be quite surprised that you can get an MFC window object fully working in a non MFC environment - especially a CView derivative, which uses a lot of the MFC plumbing.
Worst comes to the worst, and you want to keep the same code for both projects, you can #ifdef different bits for MFC and for CLI.
Good luck,
Iain.
Plz sir... CPallini CPallini abuz drugz, plz plz help urgent.
|
|
|
|
|
edit and reformat that man !!!
modified on Wednesday, May 14, 2008 5:42 AM
|
|
|
|
|
You may also use the Rant Message Type Icon.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
you're totally right. fixed now.
|
|
|
|
|
toxcct wrote: man
You're assuming things. There might be a fantastic reason why I'm wrong, but I'm going on my misogynous assumptions...
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
sabeeshcs wrote: my source code is like this,
Can you please post the rest of it?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I need to draw the child controls (Combobox and other custom controls) into a metafile. Following is the code,
...........
CMetaFileDC mDC;
mDC.CreateEnhanced(DC,0,0,_T("Graphics\0Picture 1\0\0"));
............
HWND hWndChild = Cal.GetSafeHwnd(); //Child control
::SendMessage(hWndChild, WM_PAINT, (WPARAM)mDC.m_hDC, 0L);
The child control gets drawn, but I'm not able to specify its position and size. It is always drawn at the top.
Is there anyway to specify the size and position of the child control while drawing into a metafile DC?
|
|
|
|
|
I am not very sure but i think because you pass argument "0" at lpBounds (third position) of CreateEnhanced
lpBounds
Points to a RECT data structure or a CRect object that specifies the dimensions in HIMETRIC units (in .01-millimeter increments) of the picture to be stored in the enhanced metafile.
Yes U Can ...If U Can ,Dream it , U can do it ...ICAN
|
|
|
|
|
Even if give the third parameter lpBounds, (CreateEnhanced) in HIMETRIC, it is not working.
Basically, I have a activex control with some drawings on the client area and a combobox in the middle. I need to get all these in the metafile.
When I call PlayMetafile to check the metafile contents, the combobox is always drawn at top instead in the middle.
When control recieves a WM_PAINT message, how will the control know where it should draw itself?
How do you force a control to draw itself into a given device context and also specify in which position it should be drawn?
|
|
|
|
|
Cna you please send me your code ?
Yes U Can ...If U Can ,Dream it , U can do it ...ICAN
|
|
|
|
|