|
Yes, I get the same error, and I want to know if there is a way around it...
|
|
|
|
|
sashoalm wrote: but may be compiler specific
Yes, it seems to be compiler specific accoring to the ISO standards:
The underlying type of an enumeration is an integral type that can represent all the enumerator values defined in the enumeration. It is implementation-defined which integral type is used as the underlying type for an enumeration except that the underlying type shall not be larger than int unless the value of an enumerator cannot fit in an int or unsigned int. If the enumerator-list is empty, the underlying type is as if the enumeration had a single enumerator with value 0.
Best Wishes,
-David Delaune
|
|
|
|
|
I believe the standard tells the compiler to implement it like an int...
maybe Nemanja (Trifunovic) could confirm
|
|
|
|
|
No luck on a 32 bit system with Visual C++ compiler, read this page [^].
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
[My articles]
|
|
|
|
|
I'm trying to automate mspaint to print some files, and I do this by sending WM_COMMAND / WM_LBUTTONDOWN / WM_LBUTTONUP messages. I can hide the main dialog by passing SW_HIDE to CreateProcess, but I don't know how to hide the modal Print dialog.
And is it better to use GDI+ or some other library to print the files instead? Will it be easier or harder? It must be able to support jpg, tiff, gif and png.
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
You can use EnumWindows () http://msdn.microsoft.com/en-us/library/ms633497(VS.85).aspx[^] to go through all the open windows on your system.
For each one, you can examine its attributes (title, position, size) until you find the ones you're looking for. Then you can hide them.
GDI+ supports all the images types you mentioned.
|
|
|
|
|
Thanks, that works
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
|
Hi,
Thanks for posting. But why OpenGL? The files I want to print have nothing to do with 3D. Can OpenGL open png, jpg or gif files from disk?
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
I've got an MDI application I'm working on which is set to use the CMFCVisualManagerOffice2007 black style which all works fine apart from any dialog boxes I launch from it which just use the standard XP style. Is there a way to get around this so they display in the same style as the rest of the app?
Apologies in advance if this is a monumentally dumb question - I'm fine with the complicated stuff, it's the simple bits I get stuck with...
|
|
|
|
|
I think you're out of luck.
There is a CDialogEx class, but as far as I can see, this is only used to specify a background colour/image.
|
|
|
|
|
I was afraid that was the case. Thanks anyway Rob.
I was expecting there to be a CMFCDialogWithBellsOn or something, but apparently not.
The thing I don't really understand is that you can create a dialog app with the Office 2007 styles, or you can create an MDI app with the Office 2007 styles, but if you launch a dialog box from that MDI app then it appears to use the standard OS style. Obviously the documentation is more than a little sparse and despite a great deal of time searching I've had no joy.
|
|
|
|
|
If a dialog app works, then there must be a way to do this - I am at home now, so can't check, but I'll look into it tomorrow.
I was a big fan of this stuff when it was BCG, so have spent a lot of time working with the MFC Feature Pack.
|
|
|
|
|
Hello,
Is there a function to get the number of rows in a ListCtrl? I have to edit all items and found
listCtrl.GetHeaderCtrl()->GetItemCount();
to get the number of columns. But how can I get the number of rows. Something like 'while(listCtrl.GetNextItem...' doesn't work - it seems, that it's an endless-loop.
Thanks, GE
|
|
|
|
|
CListCtrl::GetItemCount();
so you can write : listCtrl.GetItemCount();
Retrieves the number of items in a list view control.
Gerhard-E wrote: listCtrl.GetHeaderCtrl()->GetItemCount();
you are calling it on the header control that is why you get the number of columns
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Seems to work perfect.
Very many thanks for the fast answer, GE
|
|
|
|
|
Before a button event, I am posting a message to MainFram to display a popup with a progress bar, pop is displayed, but the progress in not updated on the dialog. Please advice
void CMainFrame::OnTimer(UINT nIDEvent)
{
if (iStopProgress!=1) // This working fine
{
// update progress..
iPrgCounter++;
PostMessage(WM_USER_THREAD_UPDATE_PROGRESS, iPrgCounter, nMaxPrgValue);
Sleep(100);
DoEvents1();
}
else
{
popupDlg->OnCancel();
DoEvents1();
Sleep(100);
}
CMDIFrameWnd::OnTimer(nIDEvent);
}
void CMainFrame::OnStartPrgBar()
{
popupDlg= new CPrgpopup();
popupDlg->DoModal();
}
void CMainFrame::OnStopPrgBar()
{
iStopProgress=1;
if (KillTimer (Timeval)!=TRUE)
{
AfxMessageBox("Timmer Kill Failed");
}
else
{
AfxMessageBox("Timmer KILLED");
popupDlg->OnCancel();
AfxMessageBox("MF Stop");
}
}
UINT CMainFrame::StartProgressBarThread (LPVOID param)
{
THREADSTRUCT* ts = (THREADSTRUCT*)param;
if (ts->_this->popupDlg->DoModal()==TRUE)
{
hwnd=ts->_this->popupDlg->GetSafeHwnd();
ts->_this->popupDlg->m_ProgressCtrl.SetRange (0, nMaxPrgValue);
}
return 1;
}
void CMainFrame::OnUpdatePrgBar()
{
popupDlg->m_ProgressCtrl.StepIt(); // Not getting update on Dlg
DoEvents1();
Sleep(100);
}
|
|
|
|
|
ptr_Electron wrote: DoEvents1();
SHAME ON YOU!
because you're recalling the Worst of the Weird Visual Basic Statements
BTW You've done already many posts: Did you ever notice the code block button?
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
[My articles]
|
|
|
|
|
A much simpler design: Do your background work on worker threads
and leave all your UI stuff on ONE UI thread.
Your code is more complicated than it needs to be!
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
After posting message to MainFrame, a thread is started to display popup progressbar, and a timmer keep updating the prg bar(not happning), once stop getting stop messge posted from dialog timmer is killed, and popup is closed. every thing is fine except the updating the progress bar.
void CMainFrame::OnTimer(UINT nIDEvent)
{
if (iStopProgress!=1)
{
iPrgCounter++;
PostMessage(WM_USER_THREAD_UPDATE_PROGRESS, iPrgCounter, nMaxPrgValue);
Sleep(100);
DoEvents1();
}
else
{
popupDlg->OnCancel();
DoEvents1();
Sleep(100);
}
CMDIFrameWnd::OnTimer(nIDEvent);
}
void CMainFrame::OnStartPrgBar()
{
popupDlg= new CPrgpopup();
popupDlg->DoModal();
}
void CMainFrame::OnStopPrgBar()
{
iStopProgress=1;
if (KillTimer (Timeval)!=TRUE)
{
AfxMessageBox("Timmer Kill Failed");
}
else
{
AfxMessageBox("Timmer KILLED");
popupDlg->OnCancel();
AfxMessageBox("MF Stop");
}
}
UINT CMainFrame::StartProgressBarThread (LPVOID param)
{
THREADSTRUCT* ts = (THREADSTRUCT*)param;
if (ts->_this->popupDlg->DoModal()==TRUE)
{
hwnd=ts->_this->popupDlg->GetSafeHwnd();
ts->_this->popupDlg->m_ProgressCtrl.SetRange (0, nMaxPrgValue);
}
return 1;
}
void CMainFrame::OnUpdatePrgBar()
{
popupDlg->m_ProgressCtrl.StepIt();
DoEvents1();
}
|
|
|
|
|
Why is there a DoModal call in two places?
You do know DoModal doesn't return until the dialog
is dismissed right?
You also can only call methods on MFC window objects on the same thread
the window was created on.
Again, your design is unnecessarily complex. Just create a modeless progress
dialog on the UI thread, fire off your worker thread, and let the worker thread
post messages to the modeless dialog to update the progress bar.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hello,
I'm having a problem with my MFC program. It's an MS outlook style splitter window application. In one of it's CFormViews, I want the user to be able to open a dialog that relates to the currently selected row of a report style List, when they press return, just like MS outlook. If the user interacts with the view, this virtual function is called:
BOOL CMyFormView::PreTranslateMessage(MSG* pMsg)
{
if(GetFocus() != &ReportCtrl)
return CFormView::PreTranslateMessage(pMsg);
if (pMsg->wParam == VK_RETURN )
{
PostMessageA(ID_OPEN_RECORD,0,0);
return TRUE;
}
return CFormView::PreTranslateMessage(pMsg);
}
When this dialog is closed, I highlight ReportCtrl in this manner:
...
MyDialog.DoModal();
ReportCtrl.SetFocus();
....
Unfortunately, this has an odd effect; When I press return in the child dialog, the dialog's default button, OK, is pressed, but then "the enter" somehow propogates down to CMyFormView, causing the dialog to immediately respawn - That's obviously not desirable. What should I do? How can I make the Right pane/ CFormView get back focus without this happening?
For some reason, directly calling the function mapped to the ID_OPEN_RECORD Message, or Sending rather than posting a message, causes assertion failures. I didn't make the ID_OPEN_RECORD especially to solve this problem though - It was originally created so that the user could press an "open record" button on the toolbar, and have that work in every view.
Regards,
Sternocera
|
|
|
|
|
Hi all!
I'am working on an application, that connects to a mysqlhost
in the internet. for this i used the mysql c api and the libmysql.dll
in a mfc application project.
This works fine but no i want to compile an application, that does
not need the libmysql.dll.
Is there any possibility to connect to a mysqlserver without libmysql.dll?
Or can i merge the libmysql.dll into my application, so that i only have one
working exe file?
Thanks in advance!
|
|
|
|
|
Why do you want to compile an application that does not need libmysql.dll?
|
|
|
|
|
Hi,
at work i have to deploy a stand alone exe application, that has
no dependency to any libraries, that are non standard on windows
platforms. also, because the programm is used commercial, we are
not allowed to supply our programm with libmysql.dll to custommers.
thats the reason, because i have to work without libmysql.dll.
|
|
|
|