|
Hi All
I have problems to send print in my application.
If I send print and if I change my view before ready to print, all commands will be cancelled.
I send direct to print, print setup is not showed, the view can be closed, and OpenDocumentFile doesn't show this view if command is print;
My application needs fill a graph, reading from a database, while not read all data he is not ready to print, I have a flag to do this.
See my code:
if(pDoc!=NULL)
{
dwTick=::GetTickCount();
nPrintWindowTimeout=5;
if(nPrintWindowTimeout<0)
nPrintWindowTimeout=0;
dwWaitLimit=(DWORD)nPrintWindowTimeout*1000;
if(pDoc->IsReadyForPrintWindow() || (dwTick < item.m_dwTickStart || dwTick - item.m_dwTickStart > dwWaitLimit) )
{
m_arPrintQueue.RemoveAt(0);
pDoc->SetPrinting(TRUE);
if (pDoc->GetView())
{
if (item.m_bPrintSetup == TRUE)
pDoc->GetView()->SendMessage(WM_COMMAND, ID_FILE_PRINT_SETUP);
else
pDoc->GetView()->SendMessage(WM_COMMAND, ID_FILE_PRINT);
}
pDoc->SetPrinting(FALSE);
pDoc->OnCloseDocument();
}
}
}
Somebody, can help me?
Thank you
|
|
|
|
|
Hi,
I have following block of code,
class Base
{
public:
Base()
{
cout<<"Constructor: Base"<<endl;
}
~Base()
{
cout<<"Destructor : Base"<<endl;
}
virtual void fun();
};
class Derived: public Base
{
public:
Derived()
{
cout<<"Constructor: Derived"<<endl;
}
~Derived()
{
cout<<"Destructor : Derived"<<endl;
}
void fun()
{
cout<<" in der";
}
};
int _tmain(int argc, _TCHAR* argv[])
{
Derived obj;
obj.fun();
getche();
In above code virtual fun() is showing error that it not resolved. If i add blank body then Derived class's Fun()is called. Is it necessary to have blank body for virtual function in base class and what is reason of this.
Thanks
abm
|
|
|
|
|
Hi,
Your Base::fun() member is declared but not defined, so the linker complains.
You have to define it somewhere either as pure virtual virtual void fun() = 0; or otherwise:
virtual void Base::fun(){};
cheers,
AR
When the wise (person) points at the moon the fool looks at the finger (Chinese proverb)
|
|
|
|
|
Hi all!
Sorry for my english, I use it very rarely and have bad grammer
I tired to get moving marquee progress bar in my project. I read many articles, try different variants, but nothing work. Progress bar freezes in left side and only, what I can do, change it size, by varying range.
All, wat I do:
1. add refference into manifest file for common controls:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
version="1.0.0.0"
processorArchitecture="X86"
name="XPProgress"
type="win32" />
<description>XPProgress</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="X86"
publicKeyToken="6595b64144ccf1df"
language="*" />
</dependentAssembly>
</dependency>
</assembly>
2. change supported windows versions:
#define _WIN32_WINDOWS 0x0501
3. enable common controls:
::AtlInitCommonControls (ICC_COOL_CLASSES | ICC_BAR_CLASSES | ICC_PROGRESS_CLASS);
4. create simple dialog with progress bar:
IDD_DIALOG DIALOGEX 0, 0, 331, 44
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Dialog"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "OK",IDOK,137,23,50,14
CONTROL "",IDC_PROGRESS,"msctls_progress32",WS_BORDER,7,7,317,14
END
5. create dialog class:
class CDlgMain : public CDialogImpl<CDlgMain>
{
public:
enum { IDD = IDD_DIALOG };
CDlgMain(void);
~CDlgMain(void);
BEGIN_MSG_MAP(CDlgMain)
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
MESSAGE_HANDLER(WM_CLOSE, OnClose)
COMMAND_ID_HANDLER(IDOK, OnOK)
END_MSG_MAP()
LRESULT OnInitDialog(UINT , WPARAM , LPARAM , BOOL& );
LRESULT OnClose(UINT , WPARAM , LPARAM , BOOL& );
LRESULT OnOK(WORD , WORD wID, HWND , BOOL& );
};
6. on button click - enable/disable marquee option for toolbar:
LRESULT CDlgMain::OnOK(WORD , WORD wID, HWND , BOOL& )
{
DWORD dwWinLong = ::GetWindowLong(GetDlgItem (IDC_PROGRESS), GWL_STYLE);
if (dwWinLong & PBS_MARQUEE)
{
::SetWindowLong(GetDlgItem (IDC_PROGRESS), GWL_STYLE, dwWinLong & (~PBS_MARQUEE));
::SendMessage(GetDlgItem (IDC_PROGRESS), PBM_SETMARQUEE, (WPARAM) 0, (LPARAM) 100);
}
else
{
::SetWindowLong(GetDlgItem (IDC_PROGRESS), GWL_STYLE, dwWinLong | PBS_MARQUEE);
::SendMessage(GetDlgItem (IDC_PROGRESS), PBM_SETMARQUEE, (WPARAM) 1, (LPARAM) 100);
}
return TRUE;
}
Result is freezed progress bar, that not moving anywhere
I discovered, than, when I change progress bar range to smaller values, visible progress line grow biger, but nowhere moves.
::SendMessage(GetDlgItem (IDC_PROGRESS), PBM_SETRANGE, 0, MAKELPARAM(0, 20));
Someone can tell me, what I do wrong, or what I miss? I read many articles in different sites and forums, but there say, that is enough to enable progress bar animation.
karuuzo
|
|
|
|
|
Hi,
You are mixing the control style, must have PBS_MARQUEE , and it's state.
Set the control style either in your DIALOG resource descriptor:
CONTROL "",IDC_PROGRESS, "msctls_progress32", PBS_MARQUEE | WS_BORDER, 23, 38, 80, 14
or in your OnInitDialog() handler:
LRESULT OnInitDialog(UINT , WPARAM , LPARAM , BOOL& )
{
CProgressBarCtrl(GetDlgItem(IDC_PROGRESS)).ModifyStyle(0, PBS_MARQUEE);
return TRUE;
}
and in your OnOK() handler switch the moving state, for instance:
LRESULT OnOK(WORD , WORD , HWND , BOOL& )
{
static bool bAnimated = false;
CProgressBarCtrl(GetDlgItem(IDC_PROGRESS)).SetMarquee(bAnimated = !bAnimated);
return 0;
}
cheers,
AR
When the wise (person) points at the moon the fool looks at the finger (Chinese proverb)
|
|
|
|
|
Sorry, not working
I already try all variants, what I can imagine - progress bar marquee definition in resource file, using WTL classes, windows messages, but nothing works.
There latest code, but progress bar still dead
LRESULT CDlgMain::OnInitDialog(UINT , WPARAM , LPARAM , BOOL& )
{
CenterWindow();
CProgressBarCtrl(GetDlgItem(IDC_PROGRESS)).ModifyStyle(0, PBS_MARQUEE);
return TRUE;
}
LRESULT CDlgMain::OnClose(UINT , WPARAM , LPARAM , BOOL& )
{
EndDialog(0);
return TRUE;
}
LRESULT CDlgMain::OnOK(WORD , WORD wID, HWND , BOOL& )
{
static bool bAnimated = false;
CProgressBarCtrl(GetDlgItem(IDC_PROGRESS)).SetMarquee(bAnimated = !bAnimated);
return TRUE;
}
IDD_DIALOG DIALOGEX 0, 0, 331, 44
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Dialog"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
DEFPUSHBUTTON "OK",IDOK,137,23,50,14
CONTROL "",IDC_PROGRESS,"msctls_progress32",PBS_MARQUEE | WS_BORDER,7,7,317,14
END
karuuzo
|
|
|
|
|
Hi,
karuuzo wrote: Sorry, not working
What does that mean?
AR
When the wise (person) points at the moon the fool looks at the finger (Chinese proverb)
|
|
|
|
|
Nothing shows on the progress bar. I get only this and nothing else.
karuuzo
|
|
|
|
|
I uploaded a working sample at MarqueeTest.zip (6.2 KB)
cheers,
AR
When the wise (person) points at the moon the fool looks at the finger (Chinese proverb)
|
|
|
|
|
I try on another computer, yes - it works, but on my - no
Looks-like there are problem with my computer. I using Crystal Clear visual theme, may be this is a problem?
Thanks for all, I try do something my self.
karuuzo
|
|
|
|
|
karuuzo wrote: Looks-like there are problem with my computer. I using Crystal Clear visual theme, may be this is a problem?
Sure it's not a WTL or Windows problem
AR
When the wise (person) points at the moon the fool looks at the finger (Chinese proverb)
|
|
|
|
|
In your original post you showed the following line of code:
::SendMessage(GetDlgItem (IDC_PROGRESS), PBM_SETMARQUEE, (WPARAM) 1, (LPARAM) 100);
so I presume your SetMarquee() method does something similar. The LPARAM value in this call affects the speed of the marquee display: the higher the value the slower the marquee. Try setting it to zero for the default behaviour.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
CProgressBarCtrl::SetMarquee from atlctrls.h (WTL):
BOOL SetMarquee(BOOL bMarquee, UINT uUpdateTime = 0U)
{
ATLASSERT(::IsWindow(m_hWnd));
return (BOOL)::SendMessage(m_hWnd, PBM_SETMARQUEE, (WPARAM)bMarquee, (LPARAM)uUpdateTime);
}
Default is 0L
karuuzo
|
|
|
|
|
So, is it working yet or not?
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
Yes. I change Windows theme to "Windows XP style" and progress bar start working.
karuuzo
|
|
|
|
|
Guys,
Iam a Fresher looking to build a project on my own as a open source. I want some tools informations which are like ProcessMonitor kind of, can any one let me know about the more tools available in C++/VC++.. Thanks in Advance.
Iam almost trying for microsoft Internship Please help me .... Please..
|
|
|
|
|
There are a couple of tools that hang out in the Back Room...
L u n a t i c F r i n g e
|
|
|
|
|
Get a copy of whole tomato visual assist, it is worth if you're on C++.
|
|
|
|
|
I'm trying to create a pop up list box to display some drawing line styles which are stored in an XML file. I want to display the line and then the name of the style (i.e., the items have strings).
So I derived a class from CListBox, added in some sizing code and the relevant DrawItem function, and dynamically CreateEx'd this to popup off a button in my test dialog app.
However, I'm not getting any owner-draw messages to my popup - it's blank! If I take off the LBS_OWNERDRAWFIXED|LBS_HASSTRINGS style the popup is correctly populated with the style name strings. I added an owner-draw list box to the dialog and re-classified it to use my listbox class, and barring some item sizing issues it draws the items the way I want them drawn.
So what am I not appreciating about the dynamically created version? Where are is WM_DRAWITEM messages going?
Cheers!
|
|
|
|
|
I can sort of make this work, by putting the owner-draw list box 'full-screen' on a borderless dialog (ick!) and then positioning that. But then I run into problems dismissing the dialog when the user clicks off it, and sorting out where the messages go. It would be nicer and neater if the dynamic way worked...
|
|
|
|
|
Hi,
I need to customize a CMFCPropertyGrid such that be able to display a simple button inside.
when user selects given grid, user can press button inside and then a dialog box will be displayed!
exactly like Folder dialog box.
how can i do this?
best regards
|
|
|
|
|
Can you pls help to How to associate CMap key value to CComboBox MFC
Thanks in advance.
|
|
|
|
|
its not possible to store CComboBox objects into CMap or CList since copy constructor for CComboBox is not available. However you may do it as,
CMap<int, int, CComboBox*, CComboBox*> m_map;
sample to store data
CComboBox *pBox = new CComboBox();
CRect rc(0, 0, 100, 50);
UINT nId = 100;
pBox->Create(SW_HIDE, rc, this, nId);
m_map[m_id] = pBox;
modified on Monday, September 27, 2010 11:24 PM
|
|
|
|
|
May be I did not put my question correctly.
let me put it like this.... I have a CMap
CMap<CString,LPCSTR,CString,CString&> map;
with <key1, value1="">,<key2, Value2>......
I have a combo box cmb, now I want to do some thing like
for(int j=0;j<map.GetCount();j++)
{
cmb.AddString(map[i]);
}
and now the combo should contina key1, key2.key3......
|
|
|
|
|
can't u do like
POSITION pos = map.GetStartPosition();
CString csKey, csValue;
while(pos)
{
map.GetNextAssoc(pos, csKey, csValue);
cmb.AddString(csKey);
}
|
|
|
|
|