|
I have a simple dialog with a progress control bar and some static text in it.
If I make the dialog modal Dlg.DoModal() there is no problem. But when I show it with Dlg.Create(IDD_PROGDLG, NULL); Dlg.ShowWindow(SW_SHOW); The text does not appear.
What am I doing wrong??
|
|
|
|
|
piul wrote: If I make the dialog modal Dlg.DoModal() there is no problem. But when I show it with Dlg.Create(IDD_PROGDLG, NULL); Dlg.ShowWindow(SW_SHOW); The text does not appear.
Are you dynamically creating this static control?
Nibu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
No. I put it when drawing the dialog.
|
|
|
|
|
piul wrote: No. I put it when drawing the dialog.
Can you show us the code where you are doing this?
Most probably it's(static) a local object that's why it's working with DoModal and not working with Create and ShowWindow , since DoModal blocks till the dialog is closed but this is not the case with Create and ShowWindow , they don't block so your static control will get destroyed hence it's not visible.
Nibu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
The header file:
class CProgressDlg : public CDialog
{
DECLARE_DYNAMIC(CProgressDlg)
public:
CProgressDlg(int nNoteNum = 0, CWnd* pParent = NULL);
virtual ~CProgressDlg();
void UpdateBar(int nFoundSoFar = 0) ;
enum { IDD = IDD_PROGDLG };
protected:
virtual void DoDataExchange(CDataExchange* pDX);
DECLARE_MESSAGE_MAP()
public:
CProgressCtrl m_ProgBar;
int m_nTotNoteNum ;
BOOL m_bInit ;
};
the source file:
IMPLEMENT_DYNAMIC(CProgressDlg, CDialog)
CProgressDlg::CProgressDlg(int nNoteNum, CWnd* pParent)
: CDialog(CProgressDlg::IDD, pParent)
{
m_nTotNoteNum = nNoteNum ;
m_bInit = FALSE ;
}
CProgressDlg::~CProgressDlg()
{
}
void CProgressDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_PROGRESS1, m_ProgBar);
}
void CProgressDlg::UpdateBar(int nFoundSoFar)
{
if (!m_bInit)
{
OnInitDialog() ;
m_ProgBar.SendMessage(PBM_SETRANGE, 0, MAKELPARAM(0, m_nTotNoteNum));
m_ProgBar.SendMessage(PBM_SETSTEP, (WPARAM) 1, 0);
m_bInit = TRUE ;
}
m_ProgBar.SendMessage(PBM_STEPIT, 0, 0) ;
}
BEGIN_MESSAGE_MAP(CProgressDlg, CDialog)
END_MESSAGE_MAP()
|
|
|
|
|
It's very strange... I've just tried to do the same in a different project and it works all right.
And any other item that I add to the dialog does not show either. I've tried adding buttons and stuff and they just don' appear.
|
|
|
|
|
Is this a dialog based app and the dialog is the main dialog?
|
|
|
|
|
Are you sure its visible?
|
|
|
|
|
Hi
I am using CListCtrl. When using CListCtrl with Imagelist in the "ICON" view - for the inserted items , by default text will come at the bottom of the Icon. How to change so that "Text" will come in the front ( at right side ) of the ICON.
|
|
|
|
|
|
Hi guys,
As the subject points out I'd like to restrict the movement of an (owned ?) WS_POPUP to the client area of its owner. Contrary to the behaviour of a WS_CHILD which is clipped when it hits the boundaries of its parent (you can push the child under the borders) - I'd like my window to "bounce" of the borders (you can not push it under the borders, it should behave as hitting a wall). Is this possible ? If yes how can I tackle the problem ? Based on my pretty meager windows programming knowledge I'd say I need to trap/catch/grab some windows messages ( but which ones ? ) and then do something with them (probably subclassing the windowproc of the WS_POPUP ?). I can truly say I have no idea where to start. Can anybody provide some hints ? Maybe you have already done what I would need and can furnish same coding example ?
Sorry child windows are completely out of the question - not for the clipping behaviour but for other reasons as well!
thanx,
codingworm
|
|
|
|
|
WM_MOVING [^] [^] looks interesting.
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
modified on Tuesday, April 29, 2008 9:12 AM
|
|
|
|
|
Globalization?
"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
|
|
|
|
|
Oops, went out-of-synchro while doing multiple answers...
Now fixed, thank 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
|
|
|
|
|
CodingWorm wrote: Is this possible ?
Yes. See here.
"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
|
|
|
|
|
thank you both very much
hope i can check it out now
br
codingworm
|
|
|
|
|
I write client/server code in MFC and now need to create a class for it. Because I write this code in Asynchronous manner, I dont khow how can I deliver message from packet arrival to one procedure of this class.
|
|
|
|
|
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
|
|
|
|
|
mmj wrote: I write client/server code in MFC and now need to create a class for it.
why do you code the WIN32 way in MFC, when MFC already have wrapper class, CAsyncSocket.
|
|
|
|
|
I want to create an avi file.
I am having only device context handle.
I need to create a HBITMAP from hdc and add that to AVI file.
Any help?
|
|
|
|
|
|
|
I am using gdi plus to display the image. now i want to mask the
particular color of the image . is there any gdiplus api
for doing this .
Trioum
|
|
|
|
|
|
Hello,
I have this piece of code which i am using in my application developed on VS2003. i have migrated the code to VS2005 and have cleaned the code, but now i have to port it to Vista.
The code uses SHFILEOPSTRUCT and SHFileOperation which are nwo deprecated and a new interface IFileOperation has been introduced for Vista. I did a lot of head banging but still i could not figure out how to modify my code except the use of SetOperationFlag() function of IFileOperation. So please see if you could help.
Here are the snippets
<br />
SHFILEOPSTRUCT shfileop;<br />
<br />
shfileop.hwnd = NULL;<br />
<br />
shfileop.wFunc = FO_DELETE;<br />
<br />
shfileop.pFrom = pstrfrom;<br />
<br />
shfileop.pTo = NULL;<br />
<br />
shfileop.fFlags = FOF_NOCONFIRMATION;<br />
<br />
shfileop.fAnyOperationsAborted = 0;<br />
<br />
shfileop.hNameMappings = 0;<br />
<br />
shfileop.lpszProgressTitle = 0;<br />
<br />
SHFileOperation(&shfileop);
I get the pFrom and pTo from LPCTSTR type strings. I would also like to know about the double null termination of strings.
Thanks and regards,
Mustanseer
|
|
|
|