LPTSTR PathGetArgs(LPCTSTR pszPath) 功能:从路径中分析参数 例如:LPTSTR pszParam = PathGetArgs( “notepad.exe c:// pszPath); 功能:删除路径中带有的参数 LPTSTR PathRemoveBackslash(LPTSTR lpszPath); 功能:删除路径结尾多余的’/’符号 void PathRemoveBlanks (LPTSTR lpszString); 功能:删除字符串头尾的空格 void PathRemoveExtension( LPTSTR pszPath); 功能:删除路径后面的文件扩展名 BOOL PathRemoveFileSpec( LPTSTR pszPath); 功能:删除路径后面的文件名和’/’符号。 hello.txt BOOL PathStripToRoot( LPTSTR szRoot ); 功能:从路径中分析出盘符 void PathUnquoteSpaces( LPTSTR lpsz
strsafe.h> #define BUFSIZE 4096 DWORD WINAPI InstanceThread(LPVOID); VOID GetAnswerToRequest(LPTSTR , LPTSTR, LPDWORD); int _tmain(VOID) { BOOL fConnected; DWORD dwThreadId; HANDLE hPipe, hThread; LPTSTR lpszPipename = TEXT("\\\\. chRequest, LPTSTR chReply, LPDWORD pchBytes) { _tprintf( TEXT("%s #define BUFSIZE 512 int _tmain(int argc, TCHAR *argv[]) { HANDLE hPipe; LPTSTR
#include <tchar.h> #include <windows.h> #define PAGELIMIT 80 LPTSTR lpNxtPage; // 用于记录已经提交的虚拟内存的位置 // 让程序继续执行 return EXCEPTION_CONTINUE_EXECUTION; } void main(void) { LPVOID lpvBase; LPTSTR = VirtualAlloc(NULL, PAGELIMIT * dwPageSize, MEM_RESERVE, PAGE_NOACCESS); lpPtr = lpNxtPage = (LPTSTR GetLastError()); } } bSuccess = VirtualFree(lpvBase, 0, MEM_RELEASE); } void ErrorExit(LPTSTR
封装了智能合约运行环境的相关软件应用层:为智能合约其他计算机的进程通信服务CString theString( "This is a test " );LPTSTR lpsz =(LPTSTR)(LPCTSTR)theString; char *buf; CString str 例如:CString theString( "This is a test " );LPTSTR lpsz 例如:CString s(_T( "This is a test "));LPTSTR p = s.GetBuffer
include "tchar.h" int APIENTRY _tWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR ), TEXT( "haha" ), MB_OK); return 0; } 1 当采用_tWinMain作为入口函数时,第三个参数类型应定义为 LPTSTR ,表示 WCHAR *型 #include
在VC++中,还有类似的字符串类型,如LPTSTR、 LPCTSTR等,它们的含义如图2所示。 一般地,还有下列类型定义: #ifdef UNICODE typedef LPWSTR LPTSTR; typedef LPCWSTR LPCTSTR; #else typedef LPSTR LPTSTR 例如: CString theString( “This is a test” ); LPTSTR lpsz =(LPTSTR)(LPCTSTR)theString; 方法二,使用strcpy。 例如: CString s(_T(”This is a test “)); LPTSTR p = s.GetBuffer(); // 在这里添加使用p的代码 if(p ! 将其强制转换成LPTSTR去掉const,是极为危险的! 一不留神就会完蛋!
CharSet=CharSet.Auto)] internal struct structPrinterDefaults { [MarshalAs(UnmanagedType.LPTStr SuppressUnmanagedCodeSecurityAttribute()] internal static extern bool OpenPrinter([MarshalAs(UnmanagedType.LPTStr internal static extern bool DeleteForm( IntPtr phPrinter, [MarshalAs(UnmanagedType.LPTStr )] string pDrive, [MarshalAs(UnmanagedType.LPTStr)] string pName, [MarshalAs(UnmanagedType.LPTStr / handle to parent window HANDLE hPrinter, // handle to printer object LPTSTR
这个函数接受一个SERVICE_TABLE_ENTRY结构数组,这个结构定义如下: typedef struct _SERVICE_TABLE_ENTRY { LPTSTR lpServiceName 它的格式如下: VOID WINAPI ServiceMain( DWORD dwArgc, // number of arguments LPTSTR *lpszArgv // array SC_HANDLE hSCManager, // handle to SCM database LPCTSTR lpDisplayName, // display name,大小写不敏感 LPTSTR lpBinaryPathName; LPTSTR lpLoadOrderGroup; DWORD dwTagId; LPTSTR lpDependencies; LPTSTR 这是lpInfo为一个 typedef struct _SERVICE_DESCRIPTION { LPTSTR lpDescription; //描述字符串,不能超过1024个字符
notification handler code here UpdateData(); CString cs(m_childProcess); cs += m_cmd; LPTSTR lpsz = (LPTSTR)(LPCTSTR)cs; m_editoutput = ""; UpdateData(FALSE); SECURITY_ATTRIBUTES sa
VOID ); VOID WriteToPipe( VOID ); VOID ReadFromPipe( VOID ); VOID ErrorExit( LPTSTR ); VOID ErrMsg( LPTSTR , BOOL ); DWORD main( int argc, char *argv[]) { WriteFile(hStdout, chBuf, dwRead, &dwWritten, NULL)) break ; } } VOID ErrorExit ( LPTSTR
string> #include <tchar.h> #include <Psapi.h> #pragma comment (lib,"Psapi.lib") BOOL DosPathToNtPath(LPTSTR pszDosPath, LPTSTR pszNtPath) { TCHAR szDriveStr[500]; TCHAR szDrive[3
获取载入的模块(exe,dll)的方法: GetModuleFileName(HMOUDLEhModule,LPTSTR lpFileName,DWROD nSize); 当hModule的值为NULL 4 进程的命令行 LPTSTR GetCommandLine();获取命令行字符串 5 进程的环境变量 每一个进程都有一个与它相关的环境变量块,环境块是进程的地址空间中分配的一个内存块 value for variable); <3> DWORD GetEnvironmentVariable( LPCTSTR lpName, // environment variable name LPTSTR <1> DWORD GetCurrentDirectory( DWORD nBufferLength, //size of directory buffer LPTSTR lpBuffer 8 创建进程 BOOL WINAPI CreateProcess( _In_opt_ LPCTSTR lpApplicationName, _Inout_opt_ LPTSTR lpCommandLine
FORMAT_MESSAGE_FROM_HMODULE, Hand, dwErrCode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR GetDlgItem(IDC_EDIT_ERRMSG)->SetWindowText((LPTSTR)lpMessageBuffer); // Free the buffer allocated
LPTSTR WINAPI lstrcpy( _Out_ LPTSTR lpString1, _In_ LPTSTR lpString2);
lStructSize; HWND hwndOwner; HINSTANCE hInstance; LPCTSTR lpstrFilter; LPTSTR lpstrCustomFilter; DWORD nMaxCustFilter; DWORD nFilterIndex; LPTSTR lpstrFile; DWORD nMaxFile; LPTSTR lpstrFileTitle; DWORD nMaxFileTitle OFN_PATHMUSTEXIST|OFN_OVERWRITEPROMPT; if (GetOpenFileName(&ofn))//GetOpenFileName, GetSaveFileName { LPTSTR
stdcall *MyMessageBox)(HWND, LPCTSTR, LPCTSTR, UINT); DWORD (__stdcall *MyGetModuleFileName)(HMODULE, LPTSTR stdcall *)(LPCTSTR))pData->dwGetModuleHandle; MyGetModuleFileName = (DWORD (__stdcall *)(HMODULE, LPTSTR
FALSE /* /************************************************************************/ BOOL TaskbarPin(LPTSTR lpPath, LPTSTR lpFileName, BOOL bIsPin = FALSE) { BOOL bRet = FALSE; HMENU hmenu = NULL;
return 0; } typedef BOOL (WINAPI* PtrConvertSidToStringSid)( PSID Sid, LPTSTR PtrConvertSidToStringSid)GetProcAddress( GetModuleHandle(L"Advapi32.dll"), "ConvertSidToStringSidA" ); LPTSTR MySid = NULL; dwPtr( tagTokenInfo->User.Sid, (LPTSTR*)&MySid ); printf("sudami's PC Name:\n
UINT MessageThread1(LPVOID pParam) { Gsz_CriticalSection.Lock(); LPTSTR pMessage = _T("Thread1 Gsz_CriticalSection.Unlock(); return 0; } UINT MessageThread2(LPVOID pParam) { Gsz_CriticalSection.Lock(); LPTSTR
dwScope; DWORD dwType; DWORD dwDisplayType; DWORD dwUsage; LPTSTR lpLocalName; LPTSTR lpRemoteName; LPTSTR lpComment; LPTSTR lpProvider