mfc >> In need of an IProgressDialog Bug workaround

by c2s4Ym9p » Fri, 17 Mar 2006 00:00:27 GMT

I am using the IProgressDialog interface to display a simple progress dialog
to the users of my product. The problem is that there seems to be a bug when
using the interface to display a modal version of the dialog. In this case,
when the user selects cancel the main application loses focus and hides
behind any other active applicaiton on the desktop. I have seen references
to this problem on CodeProject, and descriptions of the cause of the problem,
but no workarounds. I do not see the problem when using other programs that
seem to be employing IProgressDialog. The problem does not present when usig
the progress Dialog as a modeless dialog, but I need to use it in its modal
form. Does anyone have an idea of what can be done?


Similar Threads

1. bug in namespaces VC.71 (WORKAROUND NEEDED)

2. Need workaround for template bug in VS2005

The following simplified program fails in VS2005 with SP1, with the
error "C2975: 't' : invalid template argument for 'C<T>::hi', expected
compile-time constant expression"

template<typename T>
class C {
public:
    template<T t>
    static int hi() { return 0; }
};


int fa() { return 0; }
int main()
{
    C<int (*)()>::hi<&fa>();
    return 0;
}

This is definitely a bug, the code works fine with VS2008, g++, and
Comeau, none of which are options for us. Any ideas for workarounds?

3. Workaround: WAS: is this a bug of JIT? - CSharp/C#

4. Workaround for BCB6 bug

I found a bug in BCB6 when attempting to derive a component from TDBComboBox
and overriding TDBComboBox's ComboWndProc virtual function. When one does
this, the linker gives an unresolved external error for
TDBComboBox::ComboWndProc, in other words this member function appears never
have been put into a library, or to have been put into a library with a
different mangled name signature.

So I thought I would take the dbctrls.pas file, where TDBComboBox, and its
ComboWndProc, is implemented, and add that to my component. When I attempt
to add this to my project, a whole host of VCL source file components are
compiled and errors ensue in the compiler and linker stages.

Does anyone know of some magic setting which will let me just compile the
dbctrls.pas file without regenerating a whole host of other .pas source
files ? I don't understand the pascal compiler and its need to recompiler
many other .pas files when I only need to compile dbctrls.pas into my
project.


5. Workaround for compiler bug: Value-initialization in new-expression

6. Workaround for MSVC 7.1 bug with references?

The following code compiles clean with Comeau online and g++,
and executes as expected with g++.
What happens is, a function returns a struct with members that are references.
This struct is of course not an l-value, but each member is.
I get C2106 error with MSVC 7.1 ('=' : left operand must be l-value).
on the assignment "getpair().second = 5;"

Is there a workaround for this misbehaviour?
(I've tried adding operator= and copy constructor, to no avail).

Thanks,
	homsan

-------------- 8< ---------------

struct refpair
{
	int& first;
	int& second;
	refpair(int& a, int& b) : first(a), second(b) {}
};

refpair getpair()
{
	static int a, b;
	return refpair(a, b);
}

void tryrefpair()
{
	getpair().second = 5;
//	std::cout << getpair().second;
}

int main()
{
     tryrefpair();
     return 0;
}

7. MSVC++ 13.10(VS2003) compler bug, help me with workaround

8. Need VC6 workaround for function template

Hello!

I have created a function template that splits a string into a vector of tokens. To make it easy to use I overloaded it for strings so that it then looks like a regular function. For example, here's how it can be used:

   {
      std::string s("RTCM RTK,CMR,RTCM DGPS,RTCM V3,Leica");
      std::vector<std::string> tokens = SF::Split(s, ",");
   }
   {
      std::string s("1,2,3,4,5");
      std::vector<int> tokens = SF::Split<int>(s, ",");
   }

So, if the tokens are to be split into strings, not template parameter is needed. The problem is that the code compiles with VC7.1 but not VC6.0, where the compiler complains of ambiguous overload. Here is the code:

#include <string>
#include <vector>
#include <boost/lexical_cast.hpp>

namespace SF
{
   template<class Target, class Source>
   std::vector<Target>
   Split(const Source& s, typename Source::const_pointer delims)
   {
      std::vector<Target> result;
      typename Source::size_type first = 0;
      typename Source::size_type last = s.find_first_of(delims);
      while( last!=Source::npos )
      {
         result.push_back(boost::lexical_cast<Target>(s.substr(first, last-first)));
         first = last + 1;
         last = s.find_first_of(delims, first);
      }
      result.push_back(boost::lexical_cast<Target>(s.substr(first)));

      return result;
   }

   std::vector<std::string> Split(const std::string& s, std::string::const_pointer delims)
   {
      return Split<std::string>(s, delims);                                         // Error is here
   }

   std::vector<std::wstring> Split(const std::wstring& s, std::wstring::const_pointer delims)
   {
      return Split<std::wstring>(s, delims);
   }
}

int main()
{
   {
      std::string s("RTCM RTK,CMR,RTCM DGPS,RTCM V3,Leica");
      std::vector<std::string> tokens = SF::Split(s, ",");
   }
   {
      std::wstring s(L"RTCM RTK,CMR,RTCM DGPS,RTCM V3,Leica");
      std::vector<std::wstring> tokens = SF::Split(s, L",");
   }
   {
      std::string s("1,2,3,4,5");
      std::vector<int> tokens = SF::Split<int>(s, ",");
      int d = tokens[0];
   }
   {
      std::wstring s(L"1,2,3,4,5");
      std::vector<int> tokens = SF::Split<int>(s, L",");
      int d = tokens[0];
   }
   {
      std::string s("1,2,3,4,5");
      std::vector<double> tokens = SF::Split<double>(s, ",");
      double d = tokens[0];
   }
   {
      std::wstring s(L"1,2,3,4,5");
      std::vector<double> tokens = SF::Split<double>(s, L",");
      double d = tokens[0];
   }

   return 0;
}

VC6 says main.cpp(30) : error C2668: 'Split' : ambiguous call to overloaded function
This is in the std::vector<std::string> Split(const std::string& s, std::string::const_pointer delims)
function. Is there a workaround to make this code compile with VC6?
Thanks in advance!

-- 
Daniel
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?