|
|
I have drawn sqaure n circle in VC++ . and the requirement is wen i press space bar the colour of the square n circle shud change.
|
|
|
|
|
|
I have drawn sqaure n circle in VC++ . and the requirement is wen i press space bar the colour of the square n circle shud change.
|
|
|
|
|
Add an event handler for keys .. e.g. WM_KEYDOWN or WM_KEYUP whichever you require..
In the event handler check the keycode provide to be of space bar.. set the colors to whatever you want .. i know the answer is a little vague but so was the question :P.. Look into the MSDN for WM_KEYDOWN or WM_KEYUP for specific handling!
|
|
|
|
|
thanks for the help . i know that the event is WM_KEYDOWN but main thing is wat code shud i write to change the colour . i know the key events. please let me knw if u knw this
|
|
|
|
|
cshah2 wrote: but main thing is wat code shud i write to change the colour
Set the new color in your respective member variable and trigger a redraw
You did draw them before, so erase the screen, redraw, but take the color from the color-member-variable mentioned above).
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."
-- Caius Petronius, Roman Consul, 66 A.D.
|
|
|
|
|
hi,
i want to know which SP is installed on my machine.
I hav evn implemented that using wmi. It even works
but i want to know, if using wmi is a better option or chking registry is a better option.
If I have a list of the exes KBXXXX then can I chk registry as well ?
I want to know if wmi and chking these registry entries is giving me the same result - that is to let me know that SP2(or whichevr) is installed.
Please help.
|
|
|
|
|
Call GetVersionEx() and pass an OSVERSIONINFOEX struct. You can then check the wServicePackMajor and wServicePackMinor members of the struct.
|
|
|
|
|
Hi all,
I am having a memory leak.
// senario
//To include CGTDObjectShape class
#include "GTDObjectShape.h"
in .h Class
class CGTDSwitchBasic : public CObject
{
public :
CGTDObjectShape *mC_ONShape; // CGTDObjectShape class
CGTDObjectShape *mC_OFFShape; // CGTDObjectShape class
};
in .CPP Class
CGTDSwitchBasic::CGTDSwitchBasic(UINT pui_SwitchDrawObjID)
{
// Create a new Instace of the Object Shape.
mC_ONShape = new CGTDObjectShape(pui_SwitchDrawObjID , 0);
mC_OFFShape = new CGTDObjectShape(pui_SwitchDrawObjID , 1);
}
--> Memory Leak after Closing the Application
GTDSwitchBasic.cpp(70) : {185679} client block at 0x0D732450, subtype c0, 200 bytes long.
//===========================================================================
Please help me out.
Uday kiran
|
|
|
|
|
uday kiran janaswamy wrote: // Create a new Instace of the Object Shape.
mC_ONShape = new CGTDObjectShape(pui_SwitchDrawObjID , 0);
mC_OFFShape = new CGTDObjectShape(pui_SwitchDrawObjID , 1);
Where you have deleted this memory ?
|
|
|
|
|
hi prasad,
//Code Snippet.
//==================================================================
CGTDSwitchBasic::~CGTDSwitchBasic()
{
if(mC_ONShape){
delete mC_ONShape; //Deleted Here
}
if(mC_OFFShape){
delete mC_OFFShape; //Delete Here
}
}
//==================================================================
please give your suggestions.
Uday kiran
|
|
|
|
|
How you are using CGTDSwitchBasic object? If its pointer, probably its not deleted , which inturn causing this leak. Probably , providing more code should do.
uday kiran janaswamy wrote: if(mC_ONShape){
delete mC_ONShape; //Deleted Here
}
There is no harm calling delete on NULL pointer. You can avoid if statement here. Just set pointer to NULL after deleting it.
|
|
|
|
|
uday kiran janaswamy wrote: client block at 0x0D732450
There is an article in MSDN with the following heading
"Detecting and Isolating Memory Leaks Using Microsoft Visual C++"
This artcile will explain to you what are client blocks and normal blocks and how to set breakpoints on allocations.
|
|
|
|
|
uday kiran janaswamy wrote: GTDSwitchBasic.cpp(70) : {185679} client block at 0x0D732450, subtype c0, 200 bytes long.
What is line 70 in your cpp ?
|
|
|
|
|
Hi Prasad,
The Line 70 is
mC_ONShape = new CGTDObjectShape(pui_SwitchDrawObjID , 0); //Line 70.
Please help me out prasad.
Uday kiran
|
|
|
|
|
Does d'tor of CGTDSwitchBasic is getting called ? If CGTDSwitchBasic is created on heap, are you calling delete on it ?
Does c'tor of class CGTDObjectShape does some memory allocation , which is not getting deleted ?
|
|
|
|
|
Hi,
I am trying to execute .bat file using CreateProcess API .
like below
CreateProcess("C:\\WINNT\\system32\\cmd.exe", // lpszImageName
"C:\\Tomcat.bat", // lpszCommandLine
0, // lpsaProcess
0, // lpsaThread
TRUE, // fInheritHandles
CREATE_NO_WINDOW, // fdwCreate
0, // lpvEnvironment
0, // lpszCurDir
&si, // lpsiStartupInfo
&pi // lppiProcInfo
))
But its not working. Can any one help me out in this ?
Thanks and Regards,
Subbu
|
|
|
|
|
Y don't u use ShellExecute(), instead of CreateProcess()?
Come online at:-
jubinc@skype
|
|
|
|
|
I am having lots exe files to execute .. so I will be going in a loop and exexute each exe through CreateProcess. All this process will done in a windows service
|
|
|
|
|
Don Box wrote: Y don't u
May I please ask you to make use of proper language? Saving your key strokes?
toxcct already asked you this, didn't he?
Nobody can give you wiser advice than yourself. - Cicero
ப்ரம்மா
|
|
|
|
|
I had seen a couple of articles on drag and drop between listboxes on the .NET framework IDE whihc uses some very helpful built-in functions. However, I am still on VC 6. Just wondering if it is possible to implement the drag and drop feature? Any clues and suggestions welcomed. Thanks.
|
|
|
|
|
whatever@whatever.com wrote: I am still on VC 6.
Look up CDragListBox .
|
|
|
|
|
CDragListBox allows drag and drop within its own listbox for arrangement purposes but not onto another list box.
|
|
|
|
|