|
One solution is ownerdraw via WM_CTLCOLOR.
Kuphryn
|
|
|
|
|
You can also take a look here in CP at the Button articles in order to find out some classes already done... CButton ST is a good class...
HTH...
|
|
|
|
|
Hi,
I have a VC++ application that launches another application in Run Time
<br />
char* pszFileName = "c:\\NewApplication.exe";<br />
spawnl( _P_NOWAIT, pszFileName, pszFileName,NULL);<br />
It works fine, but I could not find another command to terminate that application (NewApplication.exe) in Run Time
Anyone can help me?
Thanks
|
|
|
|
|
Use TerminateProcess(HANDLE hProcess,UINT uExitCode);
|
|
|
|
|
skaanji wrote:
Use TerminateProcess(HANDLE hProcess,UINT uExitCode);
No, No, No, No, No, unless you want the user to loose all the work they've done.
To quote the MS Docs:
The TerminateProcess function is used to unconditionally cause a process to exit. Use it only in extreme circumstances.
Please be very carefull about what you you suggest to people here.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Hi,
I am trying & still find the way to do right!
Thanks
ATC
|
|
|
|
|
Hi,
I am working on it & still find the way to do right!
Thanks
ATC
|
|
|
|
|
|
Hi,
I am working on it & still find the way to do right!
Thanks
ATC
|
|
|
|
|
Obtain the handle of the window. Pass a message to it to shut down.
If it's an app that requires saving before closing then it should ask
Example:
HWND hWnd;<br />
LRESULT lpResult;<br />
<br />
hWnd = FindWindow(NULL, winName);<br />
if (hWnd == NULL)<br />
{<br />
return 0;<br />
}<br />
lpResult = DefWindowProc(hWnd, WM_SYSCOMMAND, SC_CLOSE, NULL);<br />
Hope this helps
|
|
|
|
|
Hi,
I did try your suggestion, but when I compiled I had two errors:
---> hWnd = FindWindow(NULL, winName);
---> lpResult = DefWindowProc(hWnd, WM_SYSCOMMAND, SC_CLOSE, NULL);
error C2440: '=' : cannot convert from 'class CWnd *' to 'struct HWND__ *'
error C2660: 'DefWindowProcA' : function does not take 4 parameters
Do you know why?
Thanks for help
ATC
|
|
|
|
|
In Java, they got rid of the use of pointers, and most Java
programmers will tell you because the creators want to get
rid of the pointers headache for programmers. I wonder if it
is true? Is pointers a headache for you? And is it useful? If
you don't use pointers, what alternatives do you have?
(off topic) By the way, do you happen to know if there is a
Java forum that is similar to this site?
Thanks.
|
|
|
|
|
VW_Red_Jetta wrote:
By the way, do you happen to know if there is a
Java forum that is similar to this site?
Try the JDC Forums: http://forum.java.sun.com/[^]
- Mike
|
|
|
|
|
other people's use of pointers is evil, but pointers are wonderful.
To vote with no response is to follow the way of the coward.
|
|
|
|
|
Chris Losinger wrote:
other people's use of pointers is evil, but pointers are wonderful
I agree, I dont do c++ but do c, and once you grasp that everything is really just a number and passing-by-reference is complete bollocks, then it all makes sense to you.
<a TITLE="See my user info" href=http:
|
|
|
|
|
VW_Red_Jetta wrote:
Is pointers a headache for you? And is it useful? If
you don't use pointers, what alternatives do you have?
No.
Yes.
VB
Java people say that pointers are evil. C++ people say that not controlling when object destructors run is evil. *shrug*
--Mike--
Latest blog entry: *drool* (Alyson) [May 10]
Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber
"You have Erica on the brain" - Jon Sagara to me
|
|
|
|
|
C++ pointers are extremely powerful for both software design and implementation.
Kuphryn
|
|
|
|
|
I do not understand...
How can you get anything done without them.
and it is not a headache.
I think, the reason that JAVA is different from C (C++) in this respect, is security.
In C you can assign any number to a pointer and read and write any byte in memory, sometimes with disastrous results. Only hardware memory management can protect us from unauthorized access.
But then, I do not know JAVA.
Daniela
|
|
|
|
|
VW_Red_Jetta wrote:
Is pointers a headache for you?
No. I can't dream of a fairly large program without pointers.
VW_Red_Jetta wrote:
And is it useful?
See above.
VW_Red_Jetta wrote:
If you don't use pointers, what alternatives do you have?
I dunno.
Actually, I had to do a couple of small programs (one in VB, one in Java). I got really pissed off - with VB for the language and Java for lack of pointers. C++ is for me. I'm gonna learn C#, though.
Vikram.
-----------------------------
My site due for a massive update.
"Good lord you yanks are getting worse than a defensive VB developer at a C++ conference." - Paul Watson in the Lounge, 31 May 2003.
"Do not give redundant error messages again and again." - A classmate of mine, while giving a class talk on error detection in compiler design.
|
|
|
|
|
Pointers are one of the most useful parts of C++/C. Used well, they become one of the most powerful tools in a programmers toolkit - used poorly and they can make your life a living hell.
When I first started wiht pointers in the late 80's (in C), it took me a couple of months to understand the concept but now they are second nature.
Michael
'War is at best barbarism...Its glory is all moonshine. It is only those who have neither fired a shot nor heard the shrieks and groans of the wounded who cry aloud for blood, more vengeance, more desolation. War is hell.' - General William Sherman, 1879
|
|
|
|
|
As long as java exists, there's and endless discussion between C/C++ and Java programmers about which language to use.
I have some experience with java. I learn it at school, from my point of view, Java programmers are lazy thinkers(no offence) and C/C++ programmers are lazy writing!
Back to pointers, I use pointers as much as I can. They keep the mind sharp!
In Java they didn't get rid of pointers at all, they just hide them from the programmer. (Ever had a null pointer exception??)
|
|
|
|
|
First of all, my first misconception about java, was that there were no pointers. That misconception from a C++ point of view led me to believe that you just used copied objects everywhere.
Java is all about references -- which really are just smarter pointers. Smart would be pushing it, but smarter... I can't tell you how many hours I've spent debugging java code because it wouldn't release objects. {how smart can it be if you can still screw it up?}
I think of Java like I think of PASCAL. Remember PASCAL? It tries real hard to protect you from shooting yourself in the foot, but if you attempt anything too lofty, you will end up shooting yourself in the foot, but not realize it, and then you die a slow but somewhat painless death. Java makes a great teaching language -- as long as you don't really want to understand what's happening under the hood.
References live in C++ too, and but they don't do the auto-delete-referenc-counter thingy that java does. MS came out with this thing called COM. COM implements some java-like stuff in C++. Reference counting and smarter casting stuff...
My answer is: that I'd much rather use C++. I think it's the control-freak in me, but I know what I am getting with C++. {knowing assembly helps too} Java leaves you greatly at the whim of the person that developed the runtime...
The learning curve with C++ is higher. And java has some constructs that are missing in C++ (like "super" -- I love "super"). But I'd still pick C++ any day!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
Santa Cruz Networks
|
|
|
|
|
Well, I remember OBJECT PASCAL. They try to prevent the use of pointers. I couldn't even find information about pointers in the delphi help files!
The 'auto-delete-reference-counter thingy' from Java is called the garbage collector. This is one of the many things that make Java a slow language!
Some people also tried to implement a garbage collector in C++, but failed at some aspects. The reference counting is done by so-called 'smart pointers'. A topic about C++ garbage collecting and 'smart pointers' is around here somewhere.
Almost everyone in my class didn't start their programming experience with C/C++. Almost everyone (with experience) was aquainted with (object) PASCAL, Java, Visual Basic. They all did well, until we got tje subject 'C'. Almost everyone failed at understanding pointers. They didn't know with what the were dealing with (maybe they're just stupid).
So my opinion is: If you want to learn how to program, start with C/C++. Why? You don't get used to 'easy' programming and when you know something about C/C++, no other language is hard to learn. They are all easier than C/C++. If you do it the other way around, you still got a hard language to learn!
The 'super' keyword is indeed a handy thing, but C++ allows a similar construction!
exemple:
<br />
class A<br />
{<br />
private:<br />
int n;<br />
public:<br />
A();<br />
int GetInt();<br />
};<br />
A::A()<br />
{ n = 1; }<br />
int A::GetInt()<br />
{ return n; }<br />
<br />
class B : public A<br />
{<br />
private:<br />
double b;<br />
public:<br />
B();<br />
double GetDouble();<br />
}<br />
<br />
B::B() : A()<br />
{<br />
d = 1.1; <br />
}<br />
<br />
B::B()<br />
{<br />
d = 1.1;<br />
A::A();
}<br />
Did you know that there is a way to interface assembly with C/C++? This can be achieved by using the __asm keyword. Consult your help or the online msdn library for more details
|
|
|
|
|
Well, languages that hide pointers, they are similar for me to having some car with engine capable to run 300kmph, but the car vendor decided for you , that it is dangerous and you cannot do it and forced some limitation to the car, that you can now drive max. 130kmph.
Yes, it is safe, and it will protect some people from being hurt, but it also hides some part of power inside the thing and you are not able to use it even on a racing polygon.
|
|
|
|
|
I need to get the Thread ID of another thread of the same application. The situation is like this, IEXPLORE.EXE loads my DLL (a thread) and it also has some other threads . I (my DLL) want to get the Thread ID of one of those threads (lets say an applet). Can I?
Thanx in advance,
Mahesh
|
|
|
|