Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <windows.h>
- #pragma comment(linker,"/MERGE:.rdata=.text")
- #pragma comment(linker,"/MERGE:.data=.text")
- #pragma comment(linker,"/FILEALIGN:512 /SECTION:.text, /IGNORE:4078")
- #pragma comment(linker,"/ENTRY:WinMain")
- HWND GetButtonHandle(){
- HWND nag = 0;
- HWND result = 0;
- do{
- nag = FindWindowA("TNASTYNAGSCREEN", "Total Commander");
- if (nag != 0){
- HWND notebook = FindWindowExA(nag, NULL, "TNotebook", NULL);
- if (notebook != 0){
- HWND nagpage = FindWindowExA(notebook, NULL, NULL, "NagPage");
- if (nagpage != 0){
- HWND panel = FindWindowExA(nagpage, NULL, "TPanel", NULL);
- if (panel != 0){
- HWND panel1 = FindWindowExA(panel, NULL, "TPanel", NULL);
- if (panel1 != 0){
- char buf[3];
- GetWindowText(panel1, buf, 2);
- switch (atoi(buf)){
- case (1) : {
- result = FindWindowExA(panel, NULL, "TButton", "&1");
- break;
- }
- case (2) : {
- result = FindWindowExA(panel, NULL, "TButton", "&2");
- break;
- }
- case (3) : {
- result = FindWindowExA(panel, NULL, "TButton", "&3");
- break;
- }
- default: result = 0;
- }
- }
- }
- }
- }
- }
- } while (result == 0);
- return result;
- }
- int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdParam, int nCmdShow){
- WinExec("TOTALCMD.EXE", SW_SHOWNORMAL);
- HWND btn = GetButtonHandle();
- if (btn != 0){
- SendMessage(btn, WM_SETFOCUS, NULL, NULL);
- SendMessage(btn, WM_LBUTTONDOWN, MK_LBUTTON, NULL);
- SendMessage(btn, WM_LBUTTONUP, MK_LBUTTON, NULL);
- HWND tcmd = FindWindow("TTOTAL_CMD", NULL);
- if (tcmd != 0){
- SetWindowText(tcmd, "Total Commander");
- }
- }
- ExitProcess(0);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement