|
It's a very flexible teqnique. It essentially allows yor application to do things which arn't otherwise possible. For example in this project[^] i used code injection to deactivate the Ctrl+Alt+Delete key combo. I've seen code injection used to skin the windows tray clock: http://www.rcis.co.za/dale/tclockex/[^]. In both cases here code has been injected, and setup to hook into the WindowProc so that messages a routed through it to allow the code to extend or surpress standard functionality. The sky's the limit - use your imagination!
Joel Holdsworth
Wanna give me a job this summer?
Check out my online CV and project history[^] - now available in MSWord format![^]
|
|
|
|
|
How to get notified when user logoff?
WM_ENDSESSION & WM_QUERYENDSESSION messages are not OK. Cause the system won't send these messages when EWX_FORCE flag is set in ExitWindowsEx function.
Is there any way to get notified other than using dll in "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\
CurrentVersion\Winlogon\Notify" entry?
Thanks a lot!
Let's roll!
|
|
|
|
|
Check out ISensLogon .
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hi, I have a 11x5 bidimensional array of .net textboxes in my app. When the user paste into one of those textboxes, I want to parse the clipboard string, splitting it in 2length substrings and putting each substring in each textbox. Example:
I copy from a web page this string: "10 11 12 13 14". Then I paste (with mouse or ctrl-v) in the first textbox. I want the first text box take the "10" value, the second one the "11" value etc... etc... There also restrinctions of numbers (they must be >0 and <90 and not repeated for line) but I've already implemented those checks with some keyPress, controlLeave and controlEnter event handlers.
I have no clue wich is the best way to do it. Help.
|
|
|
|
|
Here What i would do
First Option
Subclass the first edit box
catch the WM_PASTE message
pass the string to the parent window
start processing the string
and set the edits acording to your specification
Or
Seconde Option
Add a button to that window
when you copy the text insted of passing it with ctr+v
push the button
Open the Clipboard read the text
praise it
and pass it to the specified edits;
I hope i could give you some clues.
G_S
|
|
|
|
|
Thanks for help. I've decided to go through the first way. Anyway I have a problem with passing the string to the parent window. Here's my code:
public __gc class myParentForm; // declared to allow double inclusion
// ...
// derived textbox class to allow custom paste from clipboard
public __gc class CustomPasteTextBox : public System::Windows::Forms::TextBox {
private:
const static int WM_PASTE = 0x302;
protected:
void WndProc(System::Windows::Forms::Message __gc* m){
switch(m->get_Msg()){
case WM_PASTE: // custom paste operation
if(Clipboard::GetDataObject()->GetDataPresent(DataFormats::Text)){
String* pastedString = Clipboard::GetDataObject()->GetData(DataFormats::Text)->ToString();
>>> (__try_cast<MyParentForm*>(this->get_Parent()))->customPaste(pastedString, this);
}
break;
default:
__super::WndProc(m);
break;
}
}
};
// ...
Compiler cannot convert from Control to my derived Windows Form, why?
|
|
|
|
|
Hey long time no see! Anywayz,
What would be the easiest way to get IDC_EDIT1 (total amount) be split into dollars and change...
IDC_EDIT1 (Total) = 1.50
IDC_EDIT2 (Dollars) = 1.00
IDC_EDIT3 (Change) = 0.50
How would i split 1.50 into 1.00 and 0.50?
Or how would i split $15.68 into $15.00 and 0.68?
Any help would b greatful, nice to see you all again!
/* Just a Human Trying to Live in a Computers World. */
|
|
|
|
|
if i understand correctly you wand this
double dTotalSize = 15.68;
<br />
int iDollar = (int)dTotalSize;<br />
double dCent = dTotalSize - iDollar;<br />
G_S
|
|
|
|
|
NewbieStats wrote:
How would i split 1.50 into 1.00 and 0.50?
Or how would i split $15.68 into $15.00 and 0.68?
float a=15.68;
IDC_EDIT2 (Dollars) = int(a);
IDC_EDIT3 (Change) = a-int(a);
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
Hello,
If you have CString's than this code will do the trick for you:
<br />
CString sTotal = "15.68";<br />
CString sChange = "0." + sTotal.Right(2);<br />
CString sDollars = sTotal.Left(sTotal.Find('.')) + ".00";<br />
Hope this helps.
I also got the blogging virus..[^]
|
|
|
|
|
how gan i make he user browse for a file and retreive the path of the xe file and display the icon on my form
|
|
|
|
|
Use this function to extract the icon from the target file
ExtractIconEx finction
read the api description on the msdn website
for the functions
ExtractIconEx
GetOpenFileName
G_S
|
|
|
|
|
could u tell me how to do this as im really new to VC++?
|
|
|
|
|
Hi!
There is a number of plotting stuff out there, but I failed to find a plot allowing user to modify it. In other words, I need a graph as input control in which user can define a functional dependence by creating/moving/deleting points.
Please, provide some links on the topic.
Thanks in advance!
|
|
|
|
|
|
Thanks!
But is it the only control of this type? Maybe there are more ones?
|
|
|
|
|
I personally found this the easiest to use. It also had a good demo that although does not do exactly what you were looking for, I think it provides the basic steps to get you there.
|
|
|
|
|
Hi there
Below is the code i have written, is there something wrong
with my derived class? i am getting a compiler error :No default Constructor available for the Animal class.
Or is it the base class ,
<br />
class Animal<br />
{<br />
public:<br />
Animal(const string &name, const char &sex, const string &Colour, int age);<br />
~Animal();<br />
<br />
int feed_animal(const int &);<br />
<br />
void display_Info() const;<br />
<br />
private:<br />
string aName;<br />
char aSex;<br />
string aColour;<br />
int aAge;<br />
};<br />
<br />
class Crocodile : public Animal<br />
{<br />
public:<br />
Crocodile(int jaw_size, const string &move_ment);<br />
~Crocodile();<br />
<br />
private:<br />
int jaw;<br />
string move;<br />
<br />
};<br />
<br />
Animal::Animal(const string &name,const char &sex, const string &Colour, int Age)<br />
:aName(name), aSex(sex), aColour(Colour), aAge(age)<br />
{<br />
}<br />
<br />
Animal::~Animal()<br />
{<br />
}<br />
<br />
int Animal::feed_animal(const int &food)<br />
{<br />
return food;<br />
}<br />
<br />
void Animal::display_Info() const<br />
{<br />
cout << "Name : " << aName << endl;<br />
cout << "Sex : " << aSex << endl;<br />
cout << "Colour : " << aColour << endl;<br />
cout << "Age : " << aAge << endl;<br />
}<br />
<br />
<br />
int main(int argc, char *argv[])<br />
{<br />
Animal Crocko("American Aligator", 'M', "Dark Grey", 2);<br />
Crocko.feed_animal(25);
Crocko.display_animal();<br />
<br />
<br />
return 0;<br />
}<br />
thanks in advance
Bhangie
Education begins a gentleman,
conversation completes him
|
|
|
|
|
In C++, a derived class's constructor calls the base class constructor first before proceeding. In your Crocodile class, you have a constructor that takes two arguments. You haven't called the base class constructor explicitly, so the compiler puts a calls to the base class' default constructor. Because there is no default constructor, the code fails to compile.
You can make it by compile by adding a default constructor to Animal , like
class Animal
{
public:
Animal() {}
};
Or you can propagate the call from the derived class to the base class with something like
class Crocodile : public Animal
{
public:
Crocodile(const string &name, const char &sex, const string &Colour, int age,int jaw_size, const string &move_ment) : Animal(name, sex, Colour, age)
{
}
};
By the way, I don't think deriving Crocodile from Animal is a good idea. A crocodile is an instance of animal. It's like inheriting Toyota Corolla and Mercedes Benz from Car.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
S. Senthil Kumar wrote:
It's like inheriting Toyota Corolla and Mercedes Benz from Car.
What about Roll Royce!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
S. Senthil Kumar wrote:
It's like inheriting Toyota Corolla and Mercedes Benz from Car.
What is wrong with that? They are both cars.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
How do you then distinguish between instances and derived classes? My idea is that a class is a "template" and instances of the class are the "live" entities. Going by that logic, a specific car (say a Benz) is an instance of type car. I'd consider AutomaticTransmissionCar and ManualTransmissionCar to be subclasses of Car, for example.
What do you say?
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Consider the following hierarchy:
-----------Vehicle -----------
/ | \
Car Boat Aircraft
/ \ / \ / \
Truck Van Sailboat Yacht Helicopter Blimp Note that Yacht is derived from Boat , which is derived from Vehicle , but there are no instances of any of the classes until one is defined. You define an instance like:
Helicopter whirlybird; Here whirlybird is an instance of the Helicopter class.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Yeah, but Yacht is not related to Boat in the same way as Benz is to Car. You can have several models of Yachts which have exactly the same properties but different values for them. But a Yacht is a specific kind of Boat with other properties.
Likewise, a Benz and a Corolla have the properties of a car but have different values.
DavidCrow wrote:
Here whirlybird is an instance of the Helicopter class.
I thought that's what I said too (I'm assuming whirlybird is a helicopter model).
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
"Derived from" and "instance of" are mutually exclusive terms. By definition, an instance of class is the actual occurrence of that class.
In your example, Benz is not derived from anything. It is an instance of the Car class.
S. Senthil Kumar wrote:
I thought that's what I said too
You said something about an instance being a live entity, whatever that is.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|