Didnt work, here is the results of compiling:
[scar]
Compiling...
Mybasemeth2.cs(1,2): error CS1024: Preprocessor directive expected
Mybasemeth2.cs(1,10): error CS1025: Single-line comment or end-of-line expected
Mybasemeth2.cs(2,2): error CS1024: Preprocessor directive expected
Mybasemeth2.cs(2,10): error CS1025: Single-line comment or end-of-line expected
Mybasemeth2.cs(3,2): error CS1024: Preprocessor directive expected
Mybasemeth2.cs(3,10): error CS1025: Single-line comment or end-of-line expected
Mybasemeth2.cs(4,7): error CS1041: Identifier expected; 'namespace' is a keyword
Mybasemeth2.cs(4,20): error CS1514: { expected
Mybasemeth2.cs(8,27): error CS1001: Identifier expected
Mybasemeth2.cs(15,20): error CS1518: Expected class, delegate, enum, interface, or struct
Mybasemeth2.cs(18,94): error CS1518: Expected class, delegate, enum, interface, or struct
Mybasemeth2.cs(19,15): error CS1001: Identifier expected
Mybasemeth2.cs(25,2): error CS0116: A namespace does not directly contain members such as fields or methods
Mybasemeth2.cs(26,1): error CS1022: Type or namespace definition, or end-of-file expected
Done.
[/scar]
Posted on: March 08, 2010, 12:17:52 AM
I have figured out if you put this at the end of the code then it will prevent it from running the code witch the c++ contain but the thing is i want it to not run if there is another program running.
[scar]
#ifndef LimitSingleInstance_H
#define LimitSingleInstance_H
#include <windows.h>
//This code is from Q243953 in case you lose the article and wonder
//where this code came from.
class CLimitSingleInstance
{
protected:
DWORD m_dwLastError;
HANDLE m_hMutex;
public:
CLimitSingleInstance(TCHAR *strMutexName)
{
//Make sure that you use a name that is unique for this application otherwise
//two apps may think they are the same if they are using same name for
//3rd parm to CreateMutex
m_hMutex = CreateMutex(NULL, FALSE, strMutexName); //do early
m_dwLastError = GetLastError(); //save for use later...
}
~CLimitSingleInstance()
{
if (m_hMutex) //Do not forget to close handles.
{
CloseHandle(m_hMutex); //Do as late as possible.
m_hMutex = NULL; //Good habit to be in.
}
}
BOOL IsAnotherInstanceRunning()
{
return (ERROR_ALREADY_EXISTS == m_dwLastError);
}
};
#endif
[/scar]
Posted on: March 08, 2010, 12:56:45 AM
what woud be similar to this:
begin
getself.hide
end.
but in c++
i tought of an idea but i need to know the code for that first what is it ?
Posted on: March 08, 2010, 03:24:02 AM
it will work with a code that stop if found a certain form titlename, not windowname because this utility dont has a windowname (its hided from taskbar)
so if it can search for a form title name and then if that name is there then application will not start, but if it dont find it then it will.
woud this be possible atleast ?