|
Hi iceman,
Do you have a C/C++ related question? I fail to see how your question applies to the board topic.
Best Wishes,
-David Delaune
|
|
|
|
|
iceman8616 wrote: Can the process make some action before killed?
No. The process will not get any clue when it is terminated from the taskmanager.
|
|
|
|
|
Naveen wrote: No. The process will not get any clue when it is terminated from the taskmanager.
Hi Naveen,
Are you sure about that? The task manager uses two methods of terminating an application depending on which tab is selected. One of them can be ignored by an application.
Best Wishes,
-David Delaune
|
|
|
|
|
Randor wrote: task manager uses two methods of terminating an application depending on which tab is selected.
Hi David,
I mean the "EndProcess" option in the "Process" tab of the task manager( I guess it uses TerminateProcess()). It is the "End task" option in the "Application" tab that can be igonred( which sends a WM_CLOSE message ). right? Please correct me if I am wrong.
|
|
|
|
|
Yes, the 'End Task' button on the 'Application' tab simply sends a WM_CLOSE message. You can see this with the Spy++ utility. An application or malware could potentially ignore this message.
Best Wishes,
-David Delaune
|
|
|
|
|
I believe so - I think the window gets a WM_CLOSE or WM_QUIT first (can't remember which) and if it doesn't die pretty quickly, it then gets terminated with TerminateProcess.
I think that's how it works, anyway.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
|
Hi, Everybody,
In the code underneath the compiler says there's no matching function for
GetNextComb.I marked the place where it refuses to compile the programme. What should I do ?
#include <cstdlib>
#include "IndexCombination.h"
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iterator>
#include <map>
#include <sstream>
using namespace std;
using namespace stdcomb;
struct Element
{
char name[6];
int numbers[30];
char chain[90];
};
const Element elements[] = {
{
"ia11",
{3,9,17,21,24,31,33,36,42,49,4,8,19,22,28,30,34,39,43,47,2,6,10,13,14,25,29,37,38,46},
"3,9,17,21,24,31,33,36,42,49,4,8,19,22,28,30,34,39,43,47,2,6,10,13,14,25,29,37,38,46"
}, {
"ia34",
{1,6,12,15,22,27,31,32,41,42,4,7,14,17,23,30,33,36,45,48,2,9,13,18,21,26,34,39,44,49},
"1,6,12,15,22,27,31,32,41,42,4,7,14,17,23,30,33,36,45,48,2,9,13,18,21,26,34,39,44,49"
}, {
"ia72",
{3,8,11,18,22,25,36,37,43,46,1,6,16,17,23,28,35,40,41,44,2,5,12,19,24,27,31,34,42,49},
"3,8,11,18,22,25,36,37,43,46,1,6,16,17,23,28,35,40,41,44,2,5,12,19,24,27,31,34,42,49"
}, {
"ia167",
{3,4,12,15,21,28,32,39,47,48,6,9,16,17,29,30,31,38,41,42,7,8,11,20,26,27,34,35,45,46},
"3,4,12,15,21,28,32,39,47,48,6,9,16,17,29,30,31,38,41,42,7,8,11,20,26,27,34,35,45,46"
}, {
"ia190",
{3,10,11,14,22,23,32,35,43,44,6,9,16,19,24,29,37,38,45,48,2,5,13,18,25,30,31,40,41,0},
"3,10,11,14,22,23,32,35,43,44,6,9,16,19,24,29,37,38,45,48,2,5,13,18,25,30,31,40,41,0"
}, {
"ia21",
{2,5,16,19,25,30,34,39,45,48,1,9,12,13,21,24,33,36,44,49,3,8,15,20,23,26,35,40,43,46},
"2,5,16,19,25,30,34,39,45,48,1,9,12,13,21,24,33,36,44,49,3,8,15,20,23,26,35,40,43,46"
}, {
"ia64",
{6,9,13,20,28,29,33,40,43,48,2,7,16,19,24,27,31,34,44,47,5,8,14,17,21,30,32,37,41,46},
"6,9,13,20,28,29,33,40,43,48,2,7,16,19,24,27,31,34,44,47,5,8,14,17,21,30,32,37,41,46"
}, {
"ia102",
{4,9,14,19,22,29,35,38,46,47,5,8,13,16,21,26,33,40,41,48,6,7,15,17,28,30,32,39,42,45},
"4,9,14,19,22,29,35,38,46,47,5,8,13,16,21,26,33,40,41,48,6,7,15,17,28,30,32,39,42,45"
}, {
"ia178",
{6,9,15,20,23,24,37,38,42,45,7,8,16,19,22,25,34,39,43,46,1,2,17,18,26,29,31,40,47,0},
"6,9,15,20,23,24,37,38,42,45,7,8,16,19,22,25,34,39,43,46,1,2,17,18,26,29,31,40,47,0"
}, {
"ia180",
{1,4,13,18,27,30,33,38,45,46,2,3,12,15,22,23,39,40,44,47,8,9,11,17,24,25,32,37,49,0},
"1,4,13,18,27,30,33,38,45,46,2,3,12,15,22,23,39,40,44,47,8,9,11,17,24,25,32,37,49,0"
}
};
int main(int argc, char *argv[])
{
CIdxComb cb;
cb.SetSizes(10,6);
vector<int> combination(6);
combination[0] = 0;
combination[1] = 1;
combination[2] = 2;
combination[3] = 3;
combination[4] = 4;
combination[5] = 5;
int Total = 0;
bool GetNextComb(std::vector<unsigned int> &vi);
while(cb.GetNextComb(combination))//the compiler stops here
{
Total++;
cout << "Combination number. " << Total << endl;
for (unsigned i = 0; i < combination.size(); i++)
{
const Element &element = elements[combination[i]];
cout << element.name << ": " << element.chain << endl;
}
cout << endl;
}
system("PAUSE");
return EXIT_SUCCESS;
}
|
|
|
|
|
try to move the following line to outside main function
bool GetNextComb( std::vector<unsigned int> &vi );
Thanks and Regards,
Selvam,
http://www.wincpp.com
|
|
|
|
|
You probably need to define the GetNextComb function; here you simply declared it (and the declaration should be out of the "main" function.
This signature was proudly tested on animals.
|
|
|
|
|
The way you use GetNextComb, it's a method of CIdxComb. Your forward declaration (bool GetNextComb(std::vector<unsigned int> &vi); ) is for a free function, not a method of CIdxComb.
So, you need to add GetNextComb to the definition of CIdxComb.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
It looks like adding GetNextComb to the definition of CIdxComb doesn't solve anything. The compiler still wants a function. It's apparent that the problem is more complicated than I expected. Another evidence is that anybody can figure out how to write this section of the code.
However,
great thanks to everybody!
|
|
|
|
|
I'm new to Window API c c++ and had some real trouble with char datatype. Then I discovered basic_string class so I could do
std::string n="XXXX" and I was on my way. But now a new problem. Seems like there is always new problem.
Anyway, I writing windows program for CE and I discovered that the program must be UNICODE. In writing my own functions using 'string' all is well. But API functions use CHAR or WCHAR depending on compile. Since CE is unicode functions use the WCHAR. So now I'm somewhat stuck on how to use std::wstring versus std::string. My
simple code
std::wstring transType="MU"
fails with cannot convert char[3] to class std::basic_string..........
Anyone know what the problem is here?
|
|
|
|
|
egerving wrote: Anyone know what the problem is here?
Yes, written like that "MU" is a char array, and not a WChar array. You have to write it this way:
_T("MU") in order to be unicode independant.
First thing, I really suggest you read this excellent article[^], you'll get a much better grasp on unicode ans string conversions.
Second point, I suggest you define your strings this way:
#if defined _UNICODE || defined UNICODE
typedef std::wstring TMyString;
#else
typedef std::string TMyString;
#endif
So, everywhere later in your program, use TMyString instead of wstring or string. This way, you will remain independant of the UNICODE settings.
|
|
|
|
|
Cedric,
Thanks for the quick response, your help and suggestion. This is a great web site. Really starting to love it. Complied with no errors!
|
|
|
|
|
On the brighter side, it feels good to see people like you, who would take our advise and acknowledge the help received. You can mark his reply as "Good Answer" if you wish to add reputation to him.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
If you're explicitly using std::wstring, then
std::wstring transType=L"MU";
is probably more appropriate than using _T("MU") . The L prefix on the string marks it as a wide-character string literal whether you compile for Unicode or ASCII, which matches std::wstring, which also is a wide-character string whether you compile for Unicode or ASCII.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi all,
I want my .txt file to be saved in unicode big endian encoded one..
i am using fwrite function...
but its not writing properly..its showing some junk characters..
Does fwrite function allow us to save in unicode big endian format??
Please let me know for further clarifications..
thanks,
rakesh.
|
|
|
|
|
|
Hi Selvam,
Thanks for your reply..
Can you please enlighten me about the content u referred??
can you please tell me how can we make fwrite to support unicode big endian type..
thanks,
rakesh
|
|
|
|
|
|
Hi all,
Having a problem with polymorphism and returning a class from a function.
Suppose I have base class B which is used to derive D1, D2, D3, D4, etc..
Suppose a function of B, myFunc(), has return of type B, and myFunc() creates within it a D1, D2, D3, or D4 and returns it.
If I were to try the following in a separate, or main(), function somewhere else,...
B rtn_instance = B::myFunc();
....how come rtn_instance is still of type B and not of type D1, D2, D3, etc... ?
I thought the polymorphism would make rtn_instance of type D1, D2, etc...
Maybe references would be helpful, but doesn't using references pose a memory leak risk, or do the pointed to objects get destroyed on exit from the calling function?
Many thanks for any help.
|
|
|
|
|
figured it out...
i should be using references.
Hurrah !
|
|
|
|
|
Let's do some actual code...
class B
{
public:
virtual B & myFunc () { return *this; }
virtual void SayMyName () { printf ("B"); }
};
class C : public B
{
public:
virtual B &myFunc () { return *this; }
virtual void SayMyName () { printf ("C"); }
}
main ()
{
C c;
B b = c.myFunc;
b.SayMyName ();
}
OK, pretty artificial, and I'm missing out on stuff.
It's pretty plain to me that a temporary B would be constructed, using it's copy constructor. Then if the compiler is not too clever, that temporary B would be copied to b.
If you want a polymorphic return, use pointers.
class B
{
public:
virtual B *myFunc () { return this; }
virtual void SayMyName () { printf ("B"); }
};
class C : public B
{
public:
virtual B *myFunc () { return this; }
virtual void SayMyName () { printf ("B"); }
}
main ()
{
C c;
B *b = c.myFunc;
b->SayMyName ();
}
Give that a go, I hope it helps.
Iain.
I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need cotract work done, give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|
In addition to my answer (yours was a clue)
{
C c;
B &b = c.myFunc ();
}
would have been fine too.
I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need cotract work done, give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|