473,387 Members | 1,742 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

ListView/Process Questions

In C++.NET 2003 Windows Forms App

I fill a ListView control with process name & second column is the Process
ID.

I would like to kill the selected process, which is simple in VB.NET or C#,
but cannot work it out in C++.

In VB.NET, I'd do the following:

Dim intProcID As Int32
Dim Proc As New Process()

procID = (CInt(ListView1.SelectedItems(0).SubItems(1).Text) )

Proc = Process.GetProcessById(procID)
Proc.Kill()

When trying to convert this code I get many compile errors. The C++ code I
am just typing in here & hasn't come from the VS 7.1 IDE:

Example:

SubItems aren't recognised
Kill isn't recognised either

If I create a string value to hold the ListView subitem then use
Convert::ToInt32... it still fails

Please help,

--
Newbie Coder
(It's just a name)
Mar 20 '07 #1
1 1515
Newbie Coder wrote:
In VB.NET, I'd do the following:

Dim intProcID As Int32
Dim Proc As New Process()

procID = (CInt(ListView1.SelectedItems(0).SubItems(1).Text) )

Proc = Process.GetProcessById(procID)
Proc.Kill()

When trying to convert this code I get many compile errors. The C++ code I
am just typing in here & hasn't come from the VS 7.1 IDE:
It would help if you could post your C++ code and the exact error
messages that you're getting. Here's my attempt to translate your VB code:

int procID = Convert::ToInt32(
listView1->SelectedItems->Item[0]->SubItems->Item[1]);
System::Diagnostics::Process* proc =
System::Diagnostics::Process::GetProcessById(procI D);
proc->Kill();

Note that MC++ doesn't support default properties, so you can't write
SelectedItems[0], you need to type the whole thing out.

Tom
Mar 20 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: newbie | last post by:
Hello, I maybe asking too much in a single posting, but here it goes: I building a windows form that mimic's the Outlook XP GUI. Its a three pane form that will allow a user to view and edit...
1
by: MrNobody | last post by:
I have a question about how ListView works. I have a data structure of several hundred records which I have used to fill up a ListView. Now, I figured the ListView would take references to my...
9
by: Devron Blatchford | last post by:
Hi there, Just wondering if I change the back and fore colour of a listview item when the mouse hovers over it? I want to overide the default windows colour. Can someone please tell me how to...
1
by: Kenneth | last post by:
I have a listview that fill up some texboxes on a form when I select a listviewItem when I scrolldown in the listview the textbox is update for each item I set focus to. Now to the help I...
0
by: Terry Brown | last post by:
I have a form which contains a listview item. The form is created to view data that is generated by interaction with a separate form. There are buttons on the form that change the data source...
3
by: Michael.Suarez | last post by:
Is it me, or does it seem like they put no effort into creating the listview control in .Net. listview. A few gripes I have with .Net listview that aren't present in vb6: -Inability to set...
12
by: garyusenet | last post by:
I have had no replies to my previous post so perhaps I didn't write it good enough. Please excuse new thread but i wanted to break from the last thread hopefully this thread will be better. ...
2
by: =?Utf-8?B?SXJmYW4=?= | last post by:
Hello, It may be a repeated question but I don't find the solution to the situation that I encounter in it. My application is monitoring another application that is built in VB6. The...
1
by: NvrBst | last post by:
I have a ListView (VirtualMode) and I want to implement a SelectAll. --1st Atempt-- The standard for loop takes way to long: "for(int i = 0; i < listView1.VirtualListSize - 1; i++)...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.