|
Ravi,
This is a guess, so it might not work.
If you use ShellExecuteEx, then SHELLEXECUTEINFO::hwnd holds the handle to any message boxes that the system might produce during execution.
Now you could do something like this :-
while(true)
{
Sleep(1000);
if(!IsWindow(SHELLEXECUTEINFO::hwnd))
break;
}
deletefile(...)
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Review by Shog9
Click here for review[NW]
|
|
|
|
|
Thanks, Nish! Still cheddarlike...
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
|
Fortunately this cheese doesn't belong to the known stinking cheeses. Oh my goddish;P
She's so dirty, she threw a boomerang and it wouldn't even come back.
|
|
|
|
|
|
hi evryone,
i m a beginer VC++ prog.
i have to make a prjct in VC++ for my college project whch will allow access to all desktops in a LAN.
i want to know abt the features reqd to implemnet it and any reference help if avlble.
THNX for any help
|
|
|
|
|
http://www.uk.research.att.com/vnc/index.html
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
I have a program that was written on a Windows 2000 machine and runs without error on that platform or any earlier platforms. When I take the program to a Windows XP machine, the program fails every time it is run. On different XP machines, the program will reach different points before failing. Is there anything I can do to make my program run on an XP machine?
dinger
|
|
|
|
|
Is this proggy a RAS prog? The RAS structures differ between XP and 2K and cause a lot of trouble because you need to set the size member of the structs to sizeof structname, but this changes according to the underlying OS. Anyway I had this experience with RAS and you might have the same issue with some other APIs too. The solution is to maintain 2-3 different cpp files each with a different WINVER definition.
Regards,
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Review by Shog9
Click here for review[NW]
|
|
|
|
|
At the very least, you should install VC++ on one of your XP machines and use the debugger to find the exact point of failure.
Signature space for rent. Apply by email to....
|
|
|
|
|
Or if the XP machine is connected via LAN then try Remote Debugging - this works GREAT!
Gero
|
|
|
|
|
I have found that when I try to create a dialog to manage a thread, it fails to create. I am passing the same parameters to Create() as I found in the sample program from Microsoft so this part should be correct. I can only figure that there is some memory problem which I can't find or since the program was originally written on Win2K, it doesn't like the way it is being compiled on WinXP. The dialog boxes haven't changed since they were compiled on Win2K. The Win2K compiled program won't run on XP either. Any ideas?
dinger
|
|
|
|
|
Bit my bit I'm trying to make more use of STL, but it is a painfull process at times.
The following code is text book stuff, but I can't get it to compile. In particular I would like to call class member function which has a parameter from for_each(), find_if() etc.
Here is the code:
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <string>
using std::vector;
using std::for_each;
using std::bind2nd;
using std::mem_fun_ref;
using std::string;
void Test_find();
int main(int argc, char* argv[])
{
Test_find();
return 0;
}
class Person
{
public:
Person() {};
Person( char* pszName ) { m_Name = pszName; }
int print()
{ std::cout << m_Name << std::endl; return 0; }
int printWithPrefix( std::string prefix )
{ std::cout << prefix << m_Name << std::endl; return 0; }
std::string m_Name;
};
void GPrint( Person person )
{
std::cout << person.m_Name << std::endl;
}
void
Test_find()
{
std::vector<Person> col1;
col1.push_back( Person( "Neville" ) );
col1.push_back( Person( "Cherryl" ) );
for_each( col1.begin(), col1.end(), &GPrint );
for_each( col1.begin(), col1.end(), mem_fun_ref( &Person::print ) );
for_each( col1.begin(), col1.end(), bind2nd( mem_fun_ref( &Person::printWithPrefix ), "person: " ) );
}
Blank lines somehow are missing above!
Neville Franks, Author of ED for Windows. www.getsoft.com
|
|
|
|
|
std::bind2nd requires that the function have two parameters. Otherwise, you can't bind anything to the second parameter Change Person::printWithPrefix() to accept two std::string arguments. The first will be the vector element, and the second will be the string bound with bind2nd.
I think.
|
|
|
|
|
Thanks, but...
The example I gave was straight from: "The C++ Standard Library" by
Nioclai M. Josuttis, so one would like to think it would work.
Changing printWithPrefix()to accept two std::string arguments gives:
for_each( col1.begin(), col1.end(), bind2nd( mem_fun_ref( &Person::printWithPrefix ), "person: ", "abc" ) );
d:\libs\tests\teststl.cpp(71) : error C2784: 'class std::mem_fun_ref_t<_R,_Ty> __cdecl std::mem_fun_ref(_R (__thiscall _Ty::*)(void))' : could not deduce template argument for '<Unknown>' from 'int (__thiscall Person::*)(class std::basic_string<char
,struct std::char_traits<char>,class std::allocator<char> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)'
d:\libs\tests\teststl.cpp(71) : error C2780: 'class std::binder2nd<_Bfn> __cdecl std::bind2nd(const _Bfn &,const _Ty &)' : expects 2 arguments - 3 provided
g:\program files\microsoft visual studio\vc98\include\functional(189) : see declaration of 'bind2nd'
I'm not sure if you are right about bind2nd(), but having not used this before anything is possible. I just tried bind1st to no avail.
Neville Franks, Author of ED for Windows. www.getsoft.com
|
|
|
|
|
Well, seems to me there are three problems here:- The offending line should be using
mem_fun1_ref :
for_each( col1.begin(), col1.end(), bind2nd( std::mem_fun1_ref( &Person::printWithPrefix ), "person: " ) );
- Even so, the probem doesn't compile due to (what it seems to me) a bug in the STL implementation for VC++:
mem_fun1_ref is defined as returning a std::binary_function<T *, A, R> , when it should return a std::binary_function<T, A, R> !
- The last problem is that
bind2nd passes as its first argument a const reference, which doesn't match with what mem_fun1_ref expects; basically, the standard is broken in this aspect.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thanks for that. Chris Losinger also suggested mem_fun1_ref which I tried, and also found didn't work.
I spent several hours on this earlier today, assuming it was simply my lack of understanding of STL and there had to be an solution.
The example in the book I refered to declares printWithPrefix as:
void printWithPrefix(..) const; but I had to change the return type to int and remove the const to get print() to work.
If anyone has STLPort etc. installed I'd be interested to know if this code works with them.
I'm sure this really should be so hard.
Neville Franks, Author of ED for Windows. www.getsoft.com
|
|
|
|
|
You might try Boost.Functional[^]. It fixes a number of errors of the standard wiith respect to binders and functional adapters.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
If you add the const back in, it works with STLport (4.5.something - the current version). Note that mem_fun1_ref isn't part of the standard (AFAIR). Single argument member functions are supported (in the Standard & STLPort) through overloading mem_fun_ref.
I'd second Joaquín Muñoz - Boost has a nice substitute for functional that works very nicely...as does most of the rest of Boost . The following line of code is the Boost equivalent of the STL code...the '_1' is a placeholder for the iterator parameter supplied in for_each .
for_each( col1.begin(), col1.end(), boost::bind( &Person::printWithPrefix , _1, "person: " ) );
One other thing you can do with the Boost version - make the parameter to printWithPrefix a const std::string& - Boost works around the C++ rule that you can't take a reference to a reference.
Stuart Dootson
'Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p'
|
|
|
|
|
Hi Stuart,
Thanks for that. Am I right in assuming that STLPort is the STL implementation of choice these days? I've downloaded it, but haven't got as far as building the library yet.
There is no doubt that Boost has some good stuff in it. I've just started using boost::scoped_ptr because VC auto_ptr doesn't have reset(), which I find quite astonishing. scoped_ptr is a better choice any way as it turns out.
Will using Boost functional as per your example work with VC STL or is this only with STLPort?
I'm also using LibSigC++ which I can do nothing but highly recomend. And as just recently noted on CP, Boost has just released their own implementation of signals and slots, which I look forward to trying when a get some spare time.
Neville Franks, Author of ED for Windows. www.getsoft.com
|
|
|
|
|
Well...it's my implementation of choice . I use it for VC6 because it's more standard compliant than the one that ships with VC6 and also has some nice extra features (rope s and hash_map s, for example - rope s are nice for incrementally building up a big (Mb) string - three times faster than strings in some basic benchmarks I did). One other very nice feature is the debug version - iterators that tell you when you're using them incorrectly!!! Told me off about several things in my code!
The main downside is that it seems to pull more dross than the Dunkumware STL implementation because of the way it initialises it's iostream s (but, on the other hand, their fstream implementation uses memory mapping, which should boost (no pun) performance). That may not be true - I tend to statically link to STLport, but dynamically link to the VC6 STL, because of the availability of the respective DLLs.
As for Boost.functions , AFAIR, they work with both STL implementations. I've not used their signals yet - I rolled my own version about 18 months ago, which I'm still using.
Stuart Dootson
'How can you give a f**k when nothing seems to matter at all' - Mission of Burma, Vs
|
|
|
|
|
I define this data in header file.
---------------------------------------------------
#define Hash[0] "208803DD4D"
#define Hash[1] "146DB1CB1C"
#define Hash[2] "26D2199CFA"
#define Hash[3] "7CAFF3D504"
#define Hash[4] "6C40AB0E42"
#define Hash[5] "1E1D7486BE"
#define Hash[6] "A03E54D487"
#define Hash[7] "7ACC08F3F7"
#define Hash[8] "6B0133E813"
#define Hash[9] "114CFE0C12"
---------------------------------------------------
when I compile there is error message show
"error C2008: '[' : unexpected in macro definition"
If you know how to declare these array in header file,please tell me. Thank you.
|
|
|
|
|
YOu can't do it with #define. You should declare it as a const array, like this, using a CString or an STL string:
const CStirng Hash[] =
{
"data",
"data",
...
};
Or you could use char * in a similar way (I believe... no compiler with me at the moment so the syntax might not be 100% correct... ):
const char **hash =
{
"data",
"data",
"data",
...
};
Even a broken clock is right twice a day.
|
|
|
|
|
define it as:
<br />
char *Hash[10] = <br />
{"208803DD4D",<br />
"146DB1CB1C",<br />
"26D2199CFA",<br />
"7CAFF3D504",<br />
"6C40AB0E42",<br />
"1E1D7486BE",<br />
"A03E54D487",<br />
"7ACC08F3F7",<br />
"7ACC08F3F7",<br />
"6B0133E813",<br />
"114CFE0C12"<br />
};<br />
|
|
|
|
|
That won't work. Lose the *
Signature space for rent. Apply by email to....
|
|
|
|
|