|
can someone show a simple example of the best and most effective way to forcefully close a prog?
|
|
|
|
|
hi
Call TerminateProcess to terminate a process. This needs the process handle as input. Call OpenProcess to get the process handle. This needs processId as input. Call Process32First and Process32Next to loop thru the running process and to get the ProcessId. Call CreateToolhelp32Snapshot before calling Process32First .
sample code is available on msdn.
rgds..mil10
|
|
|
|
|
Hello.
I am a C++ programmer with limited experience (design) using C#. From my experience, C#, like Java, is a derivative of C++. However, Microsoft is able to blend C# and C++, getting the best out of the Java design.
With the recent settlement between MS and SUN, I think that MS will remain the top desktop software company. Bottomline: C# should surpass Java given that it is in fact platform-independent.
I have some basic questions on the C# language.
Currently, does a C# application run on a non-Win32/Win64 platform (UNIX, Mac, wireless)?
How does C# compare to C++ in terms of object-oriental design (inheritance, template, etc) on a large-scale project?
How does C# compare to C++ for client/server applications including various IPC concepts, multithreading, multiple processes, etc?
How does C# compare to C++ for processor-intensive applications including games, 3D-render, multimedia, etc?
I read some reviews on two books on C# by Jeff Prosise and Charles Petzold. In general, readers find the books GUI-oriented. How good is C# for performance-imperative applications?
Thanks,
Kuphryn
|
|
|
|
|
kuphryn wrote:
Currently, does a C# application run on a non-Win32/Win64 platform (UNIX, Mac, wireless)?
Sort of. Have a look at the Mono project - they have a C# compiler and so forth
kuphryn wrote:
How does C# compare to C++ in terms of object-oriental design (inheritance, template, etc) on a large-scale project?
Probably similarly to Java.
kuphryn wrote:
How does C# compare to C++ for client/server applications including various IPC concepts, multithreading, multiple processes, etc?
Pass. .NET certainly makes those things a lot easier and less error prone. Have a look at .NET Remoting and Asynchronous Delegates for starters.
kuphryn wrote:
How does C# compare to C++ for processor-intensive applications including games, 3D-render, multimedia, etc?
Well, if you're working on the bleeding edge, C++ will probably let you squeeze out a few percent extra performance at the cost of much more complicated development. Later versions of DirectX have support for using a managed language like C#.
kuphryn wrote:
I read some reviews on two books on C# by Jeff Prosise and Charles Petzold. In general, readers find the books GUI-oriented. How good is C# for performance-imperative applications?
I would say that C# is quite suitable, but if you're learning, keep a close eye on the code you are writing and the objects you are creating. It's quite easy to screw up your performance if you create a lot of objects and the GC can't collect them in a good time for some reason, so all your app does is swap all the time.
HTH
Ian Darling
"The trouble with the world is that the stupid are cocksure and the intelligent are full of doubt." - Bertrand Russell
|
|
|
|
|
|
I'll also emphasise the plaform independance of C# - not so good at the moment, and unlikely to support the full .net framework anytime soon. Java definatley has platform independance and if you are considering a Unix/Windows co-development then it, and C++ (with judicious use of libraries), are your only options.
|
|
|
|
|
I often read about fully OO feature in languages including Java and C#.
How important is object-oriented paradigm?
Nonetheless, the good things seem to point to platform-independence rather than the OO paradigm.
How would you evaluate fully OO paradigm (C#, Java, etc) to a flexible programming language like C++ that gives the developer unsurpassed control without going to ASM?
Kuphryn
|
|
|
|
|
I want to know how to determine how much of the video RAM is in use. For example, you have 8 MB of video RAM available, and your graphics intensive program is running. How much RAM is left, before you make that next SaveDC call and get an error or something.
In the MSDN, I have located some IOCTL calls to the video mini port driver that you can use to get video memory status, but I am not sure how you to contact the video miniport driver at the application level.. If someone knows how to do that, any help appreciated.
Thanks.
|
|
|
|
|
Are you sure that this uses Video Ram at all? I read MSDN SaveDC()[^] it says the following The SaveDC function saves the current state of the specified device context (DC) by copying data describing selected objects and graphic modes (such as the bitmap, brush, palette, font, pen, region, drawing mode, and mapping mode) to a context stack. and it makes no mention of video memory at all.
John
|
|
|
|
|
Thanks for your reply. No, I am not sure.
Since I can locate code to track almost everything except available video RAM, I wanted to be complete, and that was just one of my suspect functions potentially leaking memory or GDI handles or 'somethihng' out there that is causing other GDI calls to fail.
I did find this useful link for tracking GDI objects:
Detect and Plug GDI Leaks in Your Code with Two Powerful Tools for Windows XP
http://msdn.microsoft.com/msdnmag/issues/03/01/GDILeaks/default.aspx
|
|
|
|
|
Blake Miller wrote:
determine how much of the video RAM
One way to do so is create a directdraw7 interface and use IDirectDraw7::GetCaps to get the amount of free video memory.
John
|
|
|
|
|
Hello
i've got a char **reser, and i pass it to a function like this:
<br />
char **reser;<br />
ParsearReservadas(ArchReser,reser,&cant,vec);<br />
the function header is:
<br />
void ParsearReservadas(FILE *FileReser, char **reser,int *cantpalres, int *vec)<br />
i write something to the char ** inside the function (after using malloc), and i print it and it's ok, but when i return to main i print it and i can't see it.
this piece of code works inside the function but doesn't work in main
<br />
for (i=0;i<=(cant);i++)<br />
printf ("%s\n",reser[i]);<br />
what's the problem ?
thanks!
|
|
|
|
|
kfaday wrote:
i write something to the char ** inside the function, and i print it and it's ok, but when i return to main i print it and i can't see it.
That's how function parameters work. To make the change visible to the caller, make the parameter a reference:
void ParsearReservadas(FILE* FileReser, char**& reser, ... );
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
Windows troubleshooting: Reboot first, ask questions later.
|
|
|
|
|
|
How can i save BMP files as frams to AVI file?
i can get Frames from AVI and i Put them into BMP files
how can i add bMp to AVI?
|
|
|
|
|
Someone may have answered this already, but I could not find one. So a pointer to an already answered article. Or an answer would be appreciated.
I have downloaded a couple of the ComboBox examples and they work as advertised when I use the demos provided. However, when I incorporate the code into my own project it does not perform the same way. Specifically When I run the demos the ComboBox will drop down with a complete list of selections. When I click on the ComboBox in my project (6.0) I can't get the complete list. I get a single drop Item. So can anyone tell me how I can make the Visual C++ 6.0 project provide a complete drop down list with all items showing? I.E. When you click on the ComboBox Drop button how do I get all items to show instead of just a single item?
Many thanks for any help.
Charlie
|
|
|
|
|
If I understand you correctly...
A combobox is comprised of two controls: an edit control and a dropdown listbox. For the most part, they act seamlessly together. However, at design time, they can be a bit quirky. In the resource editor, click the down arrow on the right side of the combobox. This will allow you to size the listbox part of the control.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
THANK YOU! Sometimes it is the simplest things that get you. I have been trying for days to figure this one out. Thanks to you I am now back on track!
Thanks a million!
Charlie
|
|
|
|
|
Hello Folks!
I was wondering if someone can help me in this issue. I'm having problems setting focus on a window control. Specially, if the control is a Button or Edit, I call SetFocus to it, but Windows don't draw the focus on the control. So, seems that the control don't has the focus, but it do However, it happens with some versions of WindowsXP and Win2000. The most interesting thing is even if we click the control with the mouse the control still doesn't seem to be focused . My application is Win32 C, using only Platform SDK (I mean, it is a C application, not C++).
I do something like this:
HWND Controls[NUM_CONTROLS];<br />
<br />
void InitControls(void);<br />
<br />
LRESULT CALLBACK KeyboardProc(<br />
int nCode,<br />
WPARAM wParam,<br />
LPARAM lParam<br />
)<br />
{<br />
switch(wParam)<br />
{<br />
<br />
case VK_TAB: <br />
SetFocus(Controls[nNextControl]);<br />
UpdateWindow(hThisWindow);<br />
return TRUE;<br />
}<br />
return CallNextHookEx(hkHook, nCode, wParam, lParam);<br />
}<br />
Thanks for any help on this.
Regards,
__________
Chulips
|
|
|
|
|
Boy, i know ur problem and the exact solution.
First of all, you cant use SetFocos to focus child items on the MAIN WINDOW. You have to use a technique called WINDOW SUBCLASSING to solve it.
If you have access to the book "Programming windows" by charl's petzold, go through Window subclassing in chapter 9.
If u dont hav the book, tell me, i ll try to give a short tutorial
Remember... testing & debugging are always part of programming ...so exterminate those stinking bugs
|
|
|
|
|
I can't do it even if I'm working with dialogs ????
Well, I know this book, but I don't have how to access it... If you can help me with some resources, I would be glad.
Thanks a lot.
__________
Chulips
|
|
|
|
|
Ignore the other poster. This is a feature of Windows 2000 and XP - focus is only drawn when the user actually interacts with the UI using the keyboard.
Note: I'm talking about focus rectangles, the dotted lines that appear inside the button. See later for information on the default push button highlight and automatically selecting the text in an edit control.
To get the UI to draw focus rectangles in response to a keyboard operation, Windows sends your window WM_CHANGEUISTATE and WM_UPDATEUISTATE messages. To get the standard controls to do their stuff, simply pass these messages along to DefWindowProc (which you should normally be doing anyway).
If you have a custom control that you want to draw focus rectangles on, handle these messages.
If you're dealing with a dialog, send a WM_NEXTDLGCTRL message to the dialog instead of using SetFocus . The dialog box code itself deals with selecting the text in an edit control and setting the default button, but it doesn't see the notifications to the child controls.
If you have a modeless dialog (created with CreateDialog or the Indirect /Param variants), your message loop needs to call IsDialogMessage to get this behaviour. You can also use IsDialogMessage with a regular window to get the same behaviour.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Hello Mike!
Your tip has helped me a lot! IsDialogMessage was my problem (I wasn't calling it...) But now, I have the same problem for static controls. There're two controls (static texts) that should receive the focus, since I'm treating them as links. So, I want tabstops and focus drawing on them. But Windows makes only tabstops, but doesn't draw it. Still, seems that I can't process WM_KILLFOCUS, WM_SETFOCUS or even WM_CHANGEUISTATE and WM_UPDATEUISTATE, because they are processed by IsDialogMessage. Do you have any comment about it? How do I get focus visible on those controls?
Regards,
Felipe
__________
Chulips
|
|
|
|
|
Hello Everyone,
In my current code, A program calls a function in B program using "Invoke" method. B program has an exposed COM interface. It works fine. Then I added another exposed method in B program, but everytime I call it, there is an error. I tried to go thru the code. In program B, the code for the two function are exactly the same. What should I do?
Thanks a lot in advance.
Bin
|
|
|
|
|
More information on the error would help!
Ant.
|
|
|
|
|