2012-02-07 4 views
0

컴파일 된 .exe 파일을 실행하면 명령 줄이 표시됩니다. 제거하고 싶습니다. 그러나 C++에 대해 아무것도 모르기 때문에 어떻게 할 수 있습니까?C++ 명령 줄 제거

이것은 내 스크립트가 아닙니다 ... 그냥 알다시피.

#include <iostream> 
#include <windows.h> 

using namespace std; 

typedef long (*GetFunctionCount) (void) __attribute__((stdcall)); 
typedef long (*GetFunctionInfo)(int, void*&, char*&) __attribute__((stdcall)); 
typedef void (*Setup)(char*,char*,long,long,char*) __attribute__((stdcall)); 

int main(int argc, char** argv) { 
    HMODULE libsmart = LoadLibrary("./libsmart.dll"); 
    cout << "Library: " << libsmart << '\n'; 
    cout << "GetFunctionCount: " << (void*)GetProcAddress(libsmart, "GetFunctionCount") << '\n'; 
    cout << "GetFunctionInfo: " << (void*)GetProcAddress(libsmart, "GetFunctionInfo") << '\n'; 
    GetFunctionCount count = (GetFunctionCount) GetProcAddress(libsmart, "GetFunctionCount"); 
    GetFunctionInfo info = (GetFunctionInfo) GetProcAddress(libsmart, "GetFunctionInfo"); 

    int exports = count(); 
    cout << "#Exports = " << count() << '\n'; 
    for (int i = 0; i < exports; i++) { 
     char* def = new char[1024]; 
     void* addr; 
     info(i,addr,def); 
     cout << '\t' << addr << " = " << def << '\n'; 
     delete def; 
    } 
    cout << "Starting SMART...\n"; 
    Setup setup = (Setup) GetProcAddress(libsmart, "std_setup"); 
    setup((char*)"http://world19.runescape.com/", (char*)",f5", 765, 503,(char*)""); 

    while (true) Sleep(1000); 

    return 0; 
} 

답변

2
#define _WIN32_WINNT 0x0500 
#include <iostream> 
#include <windows.h> 



using namespace std; 

    typedef long (*GetFunctionCount) (void) __attribute__((stdcall)); 
    typedef long (*GetFunctionInfo)(int, void*&, char*&) __attribute__((stdcall)); 
    typedef void (*Setup)(char*,char*,long,long,char*) __attribute__((stdcall)); 

    int main(int argc, char** argv) { 
    HWND hWnd = GetConsoleWindow(); 
    ShowWindow(hWnd, SW_HIDE); 
     HMODULE libsmart = LoadLibrary("./libsmart.dll"); 
     cout << "Library: " << libsmart << '\n'; 
     cout << "GetFunctionCount: " << (void*)GetProcAddress(libsmart, "GetFunctionCount") << '\n'; 
     cout << "GetFunctionInfo: " << (void*)GetProcAddress(libsmart, "GetFunctionInfo") << '\n'; 
     GetFunctionCount count = (GetFunctionCount) GetProcAddress(libsmart, "GetFunctionCount"); 
     GetFunctionInfo info = (GetFunctionInfo) GetProcAddress(libsmart, "GetFunctionInfo"); 

     int exports = count(); 
     cout << "#Exports = " << count() << '\n'; 
     for (int i = 0; i < exports; i++) { 
      char* def = new char[1024]; 
      void* addr; 
      info(i,addr,def); 
      cout << '\t' << addr << " = " << def << '\n'; 
      delete def; 
     } 
     cout << "Starting SMART...\n"; 
     Setup setup = (Setup) GetProcAddress(libsmart, "std_setup"); 
     setup((char*)"http://world19.runescape.com/", (char*)",f5", 765, 503,(char*)""); 

     while (true) Sleep(1000); 

     return 0; 
    } 

작동합니다. 상단의 정의를 잊지 마십시오.

+1

** ** ** 고마워요! - 해결 : – JHolta

+0

대단히 환영합니다. – Andonuts

0

명령 줄을 표시하는 부분을 제거하려면 cout <<으로 시작하는 모든 행이 화면에 표시되고 있습니다.

그러나 명령 줄은 주로 argv에 저장되어 있으며 프로그램에서이 명령 줄에 대한 참조가 표시되지 않습니다.

0

콘솔 서브 시스템이 아닌 Windows 서브 시스템에 컴파일하고 링크하고자 할 것입니다.