Get handle and file operations

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.