Run and restart Windows

Source: Internet
Author: User

 

Void coutrundlgdlg: onrun ()
{
Cstring pszdllname = "shell32.dll ";
Hinstance hlib =: loadlibrary (pszdllname );
 
Typedef void (_ stdcall * prunfiledlg) (hwnd, hicon, lpctstr, uint );
Prunfiledlg runfiledlg;
If (hlib = NULL)
{
Return;
}
Runfiledlg = (prunfiledlg) getprocaddress (hlib, (char *) 61 );
Cstring name = "Running wolfbaby ";
Cstring SSS = "Input Program path ";
Lpwstr wname = new wchar [100];
Lpwstr wsss = new wchar [100];
Memset (wname, 0, sizeof (wchar) * 100 );
Memset (wsss, 0, sizeof (wchar) * 100 );
Multibytetowidechar (cp_acp,
Mb_precomposed, // character-type options
Name, // address of string to map
Name. getlength (), // number of bytes in string
Wname, // address of Wide-Character Buffer
100
);
Multibytetowidechar (cp_acp,
Mb_precomposed, // character-type options
SSS, // address of string to map
Sss. getlength (), // number of bytes in string
Wsss, // address of Wide-Character Buffer
100
);

If (runfiledlg! = NULL)
{
Runfiledlg (this-> getsafehwnd (), null, null, (lpctstr) wname, (lpctstr) wsss, 0x02 );
}

: Freelibrary (hlib );

Delete [] wname;
Delete [] wsss;

}

Void coutrundlgdlg: onrestar ()
{
Cstring pszdllname = "shell32.dll ";
Hinstance hlib =: loadlibrary (pszdllname );
 
 
Typedef void (_ stdcall * prunfiledlg) (hwnd, lpctstr, uint );
Prunfiledlg runfiledlg;
If (hlib = NULL)
{
Return;
}
Runfiledlg = (prunfiledlg) getprocaddress (hlib, (char *) 59 );
Cstring name = "wolfbaby restart ";
Wchar_t * wname = new wchar [100];
Memset (wname, 0, sizeof (wchar) * 100 );
Multibytetowidechar (cp_acp,
Mb_precomposed, // character-type options
Name, // address of string to map
Name. getlength (), // number of bytes in string
Wname, // address of Wide-Character Buffer
100
);
If (runfiledlg! = NULL)
{
Runfiledlg (this-> getsafehwnd (), (lpctstr) wname, 0x02 );
}
 
: Freelibrary (hlib );
Delete [] wname;
}

Related Article

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.