Bom pessoal
sguindo este tutorial
http://www.portaljava.com/home/modules.php?name=Content&pa=showpage&pid=176
Não consegui fazer, como todo tutorial achado na net, nunca funciona :/
Baixei o Visual C++ 6, fiz tudo iguazinho, mas não da certo...
Andei perguntando em foruns de C++ e parece que tem até varivel escrita errado dentro, pelo jeito mais um tutorial feito nas "COXAS"...
stricmp pelo que disseram é strcmp, agora vamos aos erros, como disse fiz tudo igualzinho e causa alguns erros
-------------------Configuration: CWUtilsProject - Win32 Debug--------------------
Compiling...
CWUtils.cpp
C:\Documents and Settings\Diegok\Desktop\MOdulos C++\CWUtils.cpp(12) : error C2065: 'CTaskManager' : undeclared identifier
C:\Documents and Settings\Diegok\Desktop\MOdulos C++\CWUtils.cpp(12) : error C2146: syntax error : missing ';' before identifier 'taskManager'
C:\Documents and Settings\Diegok\Desktop\MOdulos C++\CWUtils.cpp(12) : error C2065: 'taskManager' : undeclared identifier
C:\Documents and Settings\Diegok\Desktop\MOdulos C++\CWUtils.cpp(13) : error C2065: 'CExeModuleInstance' : undeclared identifier
C:\Documents and Settings\Diegok\Desktop\MOdulos C++\CWUtils.cpp(13) : error C2065: 'pProcess' : undeclared identifier
C:\Documents and Settings\Diegok\Desktop\MOdulos C++\CWUtils.cpp(13) : warning C4552: '*' : operator has no effect; expected operator with side-effect
C:\Documents and Settings\Diegok\Desktop\MOdulos C++\CWUtils.cpp(19) : error C2228: left of '.Populate' must have class/struct/union type
C:\Documents and Settings\Diegok\Desktop\MOdulos C++\CWUtils.cpp(22) : error C2228: left of '.GetProcessCount' must have class/struct/union type
C:\Documents and Settings\Diegok\Desktop\MOdulos C++\CWUtils.cpp(25) : error C2228: left of '.GetProcessByIndex' must have class/struct/union type
C:\Documents and Settings\Diegok\Desktop\MOdulos C++\CWUtils.cpp(26) : error C2227: left of '->Get_Name' must point to class/struct/union
Error executing cl.exe.
CWUtilsProject.dll - 9 error(s), 1 warning(s)
Erro no codigo passado no tutorial
#include "CWUtils.h"
#include <stdio.h>
#include <windows.h>
JNIEXPORT jboolean JNICALL Java_CWUtils_isProcessRunning
(JNIEnv * env, jobject obj, jstring pn)
{
bool isRunningprocess = false;
CTaskManager taskManager;
CExeModuleInstance *pProcess;
const char *nameProcess = env->GetStringUTFChars(pn, 0);
// Retrieves information about processes and modules.
// The taskManager dynamically decides whether to use ToolHelp library or PSAPI
taskManager.Populate();
// Enumerates all processes
for (unsigned i = 0; i < taskManager.GetProcessCount(); i++)
{
pProcess = taskManager.GetProcessByIndex(i);
if ( stricmp( pProcess->Get_Name(), nameProcess ) == 0 )
{
isRunningprocess = true;
break;
}
}
env->ReleaseStringUTFChars(pn, nameProcess);
return isRunningprocess;
}
Eu não entendo nada de C++, preciso desta verificação logo, alguem que ja tenha feito ele e tenha tido sucesso poderia me ajudar ?