介绍几个API,SetConsoleTextAttribute / AttachConsole / ShellExecute / _searchenv ...

彩色命令行:
BOOL SetConsoleTextAttribute(
  HANDLE hConsoleOutput,
  WORD wAttributes
);

附到console上去:
The AttachConsole function attaches the calling process to the console
of the specified process.
BOOL AttachConsole(
  DWORD dwProcessId
);

从Shell中执行文件
效果类似于Console中的start命令以及explorer中的双击事件,shell会自动选择默认的程序来打开:
HINSTANCE ShellExecute(     
    HWND hwnd,
    LPCTSTR lpOperation,
    LPCTSTR lpFile,
    LPCTSTR lpParameters,
    LPCTSTR lpDirectory,
    INT nShowCmd
);

配合查找shell path的CRT函数可以模拟 开始->运行
void _searchenv(
   const char *filename,
   const char *varname,
   char *pathname
);
void _wsearchenv(
   const wchar_t *filename,
   const wchar_t *varname,
   wchar_t *pathname
);


快捷方式(恼火啊,偶当时用的可是IShellxxx)
SHCreateShortcut : This function creates a shortcut.
SHCreateShortcutEx : This function automatically creates a uniquely named shortcut in a specified directory.

这里可以搞到更多...
BrowseCallbackProc This function specifies an application-defined callback function used with the SHBrowseForFolder function.
ChooseFont This function creates a Font dialog box that enables the user to choose attributes for a logical font.
SHAddToRecentDocs This function adds a document to the shell's list of recently used documents or clears all documents from the list.
SHBrowseForFolder This function displays a dialog box that allows a user to select a folder.
SHCreateShortcut This function creates a shortcut.
SHCreateShortcutEx This function automatically creates a uniquely named shortcut in a specified directory.
Shell_NotifyIcon This function sends a message to the system to add, modify, or delete an icon from the taskbar status area.
ShellExecuteEx This function performs an action on a file. The file can be an executable file or a document.
SHFileOperation This function can be used to copy, move, rename, or delete a file system object.
SHGetDesktopFolder Retrieves the IShellFolder interface for the desktop folder, which is the root of the shell's namespace.
SHGetDocumentsFolder This function retrieves the path to the documents directory for the volume specified in the pszVolume parameter.
SHGetFileInfo This function retrieves information about an object in the file system, such as a file, a folder, a directory, or a drive root.
SHGetMalloc This function retrieves a pointer to the shell's IMalloc interface.
SHGetPathFromIDList This function converts an item identifier list to a file system path.
SHGetShortcutTarget This function retrieves the shortcut's target path.
SHGetSpecialFolderLocation This function retrieves the location of a special folder, such as My Handheld PC, Recycle Bin, Desktop, Printers, Fonts, or various file system directories.
SHGetSpecialFolderPath This function retrieves the path of a special folder, identified by its CSIDL.
SHLoadDIBitmap This function loads a bitmap from the specified file.
SHShowOutOfMemory This function displays a system-defined dialog box notifying the user that memory is full.
StrRetToBuf This function takes a STRRET structure returned by IShellFolder::GetDisplayNameOf, converts it to a string, and places the result in a buffer.

 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值