void CMFC_CORE_1Dlg::GetModule(){HMODULE hmodule = NULL;GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS,(PCTSTR)GetModule,&hmodule);TRACE("%8x",hmodule);}
TCHAR name[500] = {0};StrCpy( name,GetCommandLine());TRACE(L"%s\r\n",name);
The file operation method exclusive to win7 is called event service.
#include <KtmW32.h>#pragma comment(lib, "KtmW32.lib")
Void cmfc_core_1dlg: getmodule () {handle htran; handle hfile; DWORD dwwrittenbytes; char * lpstring = "whypro"; tchar szfilename [] = text ("testfile "); tchar szdirname [] = text ("testdir"); // zookeeper has been started before htran =:: createtransaction (null, 0, transaction_do_not_promote, infinite, L "invalid handle_value"); If (htran = invalid_handle_value) {trace (L "error");} // cannot parse into hfile = :: createfiletransacted (szfilename, generic_write, 0, null, open_always, 0, null, htran, null, null); If (hfile = invalid_handle_value) {trace (L "error ");}: writefile (hfile, lpstring, strlen (lpstring), & dwwrittenbytes, null); // encode into bytes into: createdirectorytransacted (null, szdirname, null, htran); // zookeeper transaction processing has been completed without prior execution: committransaction (htran); // zookeeper transaction processing has been completed successfully :: closehandle (htran );}
Get handle and file operations