473,387 Members | 1,497 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.

Previous Existance (Managed C++.NET 2003)

Can anyone convert this to managed C++.NET 2003?

Private Function PrevInstance() As Boolean
If
UBound(System.Diagnostics.Process.GetProcessesByNa me(System.Diagnostics.Proc
ess.GetCurrentProcess.ProcessName)) 0 Then
Return True
Else
Return False
End If
End Function

When I try to convert it the 'ProcessName' doesn't work

.... to (System::Diagnostics::Process::GetCurrentProcess

That is when I cannot use: GetCurrentProcess::ProcessName)) >0

Any suggestions would be grateful

Thanks in advance,

--
Newbie Coder
(It's just a name)

Mar 19 '07 #1
5 1345

"Newbie Coder" <ne*********@spammeplease.comwrote in message
news:O5**************@TK2MSFTNGP06.phx.gbl...
Can anyone convert this to managed C++.NET 2003?

Private Function PrevInstance() As Boolean
If
UBound(System.Diagnostics.Process.GetProcessesByNa me(System.Diagnostics.Proc
ess.GetCurrentProcess.ProcessName)) 0 Then
Return True
Else
Return False
End If
End Function

When I try to convert it the 'ProcessName' doesn't work

... to (System::Diagnostics::Process::GetCurrentProcess
GetCurrentProcess sounds like a function, which requires trailing
parentheses.

I also have to remind you that converting code to Managed Extensions for C++
(VC2003) is about the worst possible thing to do. It's unsupported, buggy,
and won't be fixed, ever. Please use C++/CLI instead, you'll save yourself
a lot of pain.
>
That is when I cannot use: GetCurrentProcess::ProcessName)) >0

Any suggestions would be grateful

Thanks in advance,

--
Newbie Coder
(It's just a name)

Mar 20 '07 #2
Ben,

Thank you for your reply

After the GetCurrentProcess nothing comes up in the intellisense. So, I am
still in the same position.

My knowledge of C++ now after 5-6 years not using it is basically zero. I'd
prefer to create C++ apps that don't requite the framework whatsoever &
which will use the old C++ runtime files.

--
Newbie Coder
(It's just a name)
Mar 20 '07 #3

"Newbie Coder" <ne*********@spammeplease.comwrote in message
news:e1**************@TK2MSFTNGP03.phx.gbl...
Ben,

Thank you for your reply

After the GetCurrentProcess nothing comes up in the intellisense. So, I am
still in the same position.
Intellisense often gets confused in C++ code.

You should have ended up with something like:

if
(::System::Diagnostics::Process::GetProcessesByNam e(::System::Diagnostics::Process::GetCurrentProces s()->ProcessName)->Length
1) {
....
}
>
My knowledge of C++ now after 5-6 years not using it is basically zero.
I'd
prefer to create C++ apps that don't requite the framework whatsoever &
which will use the old C++ runtime files.

--
Newbie Coder
(It's just a name)


Mar 20 '07 #4
Thank you Ben

Will try when I get in

Thanks again,

--
Newbie Coder
(It's just a name)

"Ben Voigt" <rb*@nospam.nospamwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
>
"Newbie Coder" <ne*********@spammeplease.comwrote in message
news:e1**************@TK2MSFTNGP03.phx.gbl...
Ben,

Thank you for your reply

After the GetCurrentProcess nothing comes up in the intellisense. So, I
am
still in the same position.

Intellisense often gets confused in C++ code.

You should have ended up with something like:

if
(::System::Diagnostics::Process::GetProcessesByNam e(::System::Diagnostics::P
rocess::GetCurrentProcess()->ProcessName)->Length
1) {
...
}

My knowledge of C++ now after 5-6 years not using it is basically zero.
I'd
prefer to create C++ apps that don't requite the framework whatsoever &
which will use the old C++ runtime files.

--
Newbie Coder
(It's just a name)


Mar 20 '07 #5

"Newbie Coder" <ne*********@spammeplease.comwrote in message
news:e1**************@TK2MSFTNGP03.phx.gbl...
Ben,

Thank you for your reply

After the GetCurrentProcess nothing comes up in the intellisense. So, I am
still in the same position.

My knowledge of C++ now after 5-6 years not using it is basically zero.
I'd
prefer to create C++ apps that don't requite the framework whatsoever &
which will use the old C++ runtime files.
For a native solution (no framework dependencies), you can do the exact same
thing using EnumProcesses, but the standard way of finding an existing
instance of your application is to create a named pipe. If that fails, it's
because one already exists, so then you can open the named pipe and send a
message to the existing instance.

The problem with the "count processes" method is that it's not atomic. Two
processes could start simultaneously, count processes, see there's another
process, and both exit, even though you would want one to start. The named
pipe method deals with that race condition.
>
--
Newbie Coder
(It's just a name)


Mar 20 '07 #6

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

Similar topics

4
by: lyndon hughey | last post by:
I'm having a problem setting the testing for the existance of a nodes outerxml property. Below I try to test for the existance before I access the property, but I receive a null exception error. ...
1
by: Terencetrent | last post by:
I have created a query that examines qarterly sales for 5 regions in the country. The query contains data for the past 6 quarters for each region and calculates the perecentage of total sales for...
6
by: Shai Levi | last post by:
Hi, I'm trying to migrate native c++ class to managed c++ class. The native class header definition looks as: class NativeClass { public: typedef void (CbFunc1)(int n,void* p);
1
by: Jeremy Cowles | last post by:
Is it possible to pass an instance of a standard C++ class into managed memory and use it (MC++/C#/VB/J#)? I guess I am still foggy on the whole concept of Managed C++. TIA, Jeremy
6
by: Itay_k | last post by:
Hello, I want a member in my class that will save pointer to pointer to System::Drawing::Image class. When I write on my class code: System::Drawing::Image **bmp; I get this error message:...
6
by: Paul Delhanty | last post by:
Hi, I am converting an existing native C++ program making heavy use of STL to C#2.0 with STL usage replaced by the new generic collections. The conversion has gone well to the point where I am...
4
by: Tim Menninger | last post by:
Just started working on this and have not found any real good resources out there. We have a lot of native C++ Dll code that we use for our app. We want to share the code so that C# ASP.net code...
11
by: Peter Oliphant | last post by:
Is there any plan to support templates with managed code in the (near) future? For instance, VS.NET 2005... : )
3
by: Peter Oliphant | last post by:
In the 2002 version of VS C++.NET if I wanted to create a new Managed C++ application I would got to "New Projects", then select "C++ Projects," then "Managed C++ Application". I recently...
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:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.