English 中文(简体)
GetCommandLine()失踪的工序名称
原标题:Process name missing from GetCommandLine()

页: 1

它通常归还可起诉的名称,然后是空间和论点。 正如文件所言,第一个被点击的人可能没有通往形象的完全道路,而真主党则会成为真主党。

直到现在,我就从未有过使用过“民族解放军”的“建筑工程”。

如果我使用的话:

CreateProcess(NULL, ""c:\myexe.exe" param1 param2", ...)

<代码>GetCommandLine 回归“c:myexe.exe param1 param2”

但是,如果我使用的话:

CreateProcess("C:myexe.exe", "param1 param2")

<代码>GetCommandLine回报率仅为“param1 param2”。

如果另一个申请发射地雷,我怎么知道在指挥线上是否提供了可执行的名称?

而且,军事委员会开办守则认为,指挥线上的第一个标志是可执行的名称和空档。 但是,如果你以第二大生产工艺品标书为例启动一项中小公司的申请,中小公司代码将绕过第一个论点。

问题回答

不是你们的问题。 它负责其他申请的工作,以适当建造指挥线。 你们应该简单地假设,第一种论点是一种可执行的名称,是期望的,也是ski的。

I have a workaround which can be helpful in a case like this. I guess we always be able to check how our module was been started. In this case we should check first argument.

I will write code because I have some problem with English. Here two ways:

The first case. we can compare module name with first command line argument. something like this:

const TCHAR* csCommandLine = ::GetCommandLine();

// Attention!!! the first symbol can be quete

if (*csCommandLine == _T( " ))
    csCommandLine++;

TCHAR sModuleFileName[MAX_PATH];

DWORD dwModuleFileName = ::GetModuleFileName(NULL, sModuleFileName, MAX_PATH);

if (dwModuleFileName && !_tcsncmp(csCommandLine, sModuleFileName, dwModuleFileName)) {

    // The command line contains the module name.
}

The second case. we can try to get file attributes for the first command line argument something like this:

/ 注意! 如果你在指挥线论点方面通过档案途径,就不会使用。

int nArgc;

LPTSTR* szArglist = ::CommandLineToArgvW(::GetCommandLine(), &nArgc);

if (nArgc && ::GetFileAttributes(szArglist[0]) != INVALID_FILE_ATTRIBUTES) {

    // The command line contains the module name.
}

::LocalFree(szArglist);

我希望这能够有所助益。

关于 弗拉基米尔





相关问题
How to read exact number of bytes from a stream (tcp) socket?

In winsock, both the sync recv and the async WSARecv complete as soon as there is data available in a stream socket, regardless of the size specified (which is only the upper limit). This means that ...

AcquireCredentialsHandle returns SEC_E_NO_CREDENTIALS

I created a self-signed certificate (created using OpenSSL) and installed it into the Certificate Store using the Certificates MMC snap-in (CertMgr.msc) on Windows Vista Ultimate. I have managed to ...

Calling Win32 EnumThreadWindows() in C#

I m trying to get a call to EnumThreadWindows working, but I always get a Wrong Parameter-Error, although my code is nearly the same as this example on pinvoke.net. I don t know why this doesn t work: ...

COM Basic links

folks can you provide me the tutorial link or .pdf for learning basic COM?. i do google it.. still i recommend answers of stackoverflow so please pass me.. Thanks

Handling multiple windows WIN32 API

HI I m trying to create an application in the Win32 environment containing more than one window. How do i do that? all the Win32 Tutorials on web i found only showed how to manage one window. How do i ...

Creating a thread in DllMain?

It seems that when a thread is created from within DllMain upon DLL_PROCESS_ATTACH it won t begin until all dll s have been loaded. Since I need to make sure the thread runs before I continue, I get a ...

热门标签