Beispiel #1
0
/*********************************************************
*NAME:          dialogNetInfoSetup
*AUTHOR:        John Morrison
*CREATION DATE:  3/3/99
*LAST MODIFIED: 29/4/00
*PURPOSE:
* Sets up the dialog box
*
*ARGUMENTS:
*  hWnd - The dialog window handle
*********************************************************/
void dialogNetInfoSetup(HWND hWnd) {
  char str[FILENAME_MAX]; /* Our address as a string */
  char addr[FILENAME_MAX];

  /* Setup languages */
  SetWindowTextA(hWnd, langGetText(STR_DLGNETINFO_TITLE));
  SetDlgItemTextA(hWnd, IDC_SERVERS, langGetText(STR_DLGNETINFO_SERVERADDRESS));
  SetDlgItemTextA(hWnd, IDC_THISADDRESSS, langGetText(STR_DLGNETINFO_THISGAMEADDRESS));
  SetDlgItemTextA(hWnd, IDC_SERVERPINGS, langGetText(STR_DLGNETINFO_SERVERPING));
  SetDlgItemTextA(hWnd, IDC_PPSPLS, langGetText(STR_DLGNETINFO_PACKETS));
  SetDlgItemTextA(hWnd, IDC_NETSTATUSS, langGetText(STR_DLGNETINFO_STATUS));
  SetDlgItemTextA(hWnd, IDC_NETERRORSS, langGetText(STR_DLGNETINFO_ERRORS));

  /* We are in a client and playing a networked game.. */
  if (threadsGetContext() == FALSE && netGetType() != netSingle)
  {
	  playersGetPlayerLocation(screenGetPlayers(),playersGetSelf(screenGetPlayers()),addr);
	  netGetOurAddressStr(str);
	  strcat(addr,strchr(str,':'));
	  SendDlgItemMessageA(hWnd, IDC_THISADDRESS, WM_SETTEXT, 0, (LPARAM)(LPCTSTR) (addr));
  }
  else /* Single player game, no networking */
  {
      netGetOurAddressStr(str);
	  SendDlgItemMessageA(hWnd, IDC_THISADDRESS, WM_SETTEXT, 0, (LPARAM)(LPCTSTR) (str));
  }
  timerNetInfo = SetTimer(hWnd, timerNetInfo, SECOND, NULL);
  dialogNetInfoUpdate(hWnd);
}
Beispiel #2
0
INT_PTR CALLBACK LastResultDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) {
	int wmId, wmEvt;
	switch(message)
	{
	case WM_COMMAND:
		wmId = LOWORD(wParam);
		wmEvt = HIWORD(wParam);
		switch (wmId)
		{
		case IDOK:
			EndDialog(hDlg, IDOK);
			return INT_PTR(TRUE);
		default:
			break;
		}
		break;
	case WM_CLOSE:
		EndDialog(hDlg, IDOK);
		return (INT_PTR)TRUE;
	case WM_SHOWWINDOW:
		{
			HighScores::HighScoresRepository scoresRepository;
			std::vector<HighScores::MatchResult> lastMatchResults = scoresRepository.select(50, 0);
			SendDlgItemMessageA(hDlg, IDC_LSTHIGHSCORES, LB_RESETCONTENT, 0, 0);
			for(auto item = lastMatchResults.begin(); item != lastMatchResults.end(); ++item) {
				SendDlgItemMessageA(hDlg, IDC_LSTHIGHSCORES, LB_ADDSTRING, 0, (LPARAM)item->strRepr().c_str());	
			}
			return (INT_PTR)TRUE;
		}
	}
	return (INT_PTR)FALSE;
}
Beispiel #3
0
void CUIDialog::windowGetText(HWND hDlg, int controlId, std::string &text)
{
	text.resize(SendDlgItemMessageA(hDlg, controlId, WM_GETTEXTLENGTH, 0,
		0));
	SendDlgItemMessageA(hDlg, controlId, WM_GETTEXT,
		(WPARAM)text.size() + 1, (LPARAM)&text[0]);
}
void UpdateInfo(HWND hwndDlg)
{
	char *b=MadeString(hwndDlg);
	if (!b) 
	{
		SendDlgItemMessageA(hwndDlg,IDC_EDIT1,WM_SETTEXT,0,(LPARAM)"");
		return;
	}
	SendDlgItemMessageA(hwndDlg,IDC_EDIT1,WM_SETTEXT,0,(LPARAM)b);
	{
		OPT_OBJECT_DATA *sd=NULL;  
		HTREEITEM hti=TreeView_GetSelection(GetDlgItem(hwndDlg,IDC_OBJECT_TREE));				
		if (hti)
		{
			TVITEMA tvi={0};
			tvi.hItem=hti;
			tvi.mask=TVIF_HANDLE|TVIF_PARAM;
			TreeView_GetItem(GetDlgItem(hwndDlg,IDC_OBJECT_TREE),&tvi);
			sd=(OPT_OBJECT_DATA*)(tvi.lParam);
			if (sd)
			{
				if (sd->szValue) mir_free_and_nill(sd->szValue);
				sd->szValue=mir_strdup(b);
			}
		}
	}
	mir_free_and_nill(b);
	glSkinWasModified=1;
}
Beispiel #5
0
static INT_PTR CALLBACK YahooSearchAdvancedDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch ( msg ) {
	case WM_INITDIALOG:
		TranslateDialogDefault(hwndDlg);
			
		SendDlgItemMessageA(hwndDlg, IDC_SEARCH_PROTOCOL, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"Yahoo! Messenger");
		SendDlgItemMessageA(hwndDlg, IDC_SEARCH_PROTOCOL, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"Lotus Sametime");
		SendDlgItemMessageA(hwndDlg, IDC_SEARCH_PROTOCOL, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"LCS");
		SendDlgItemMessageA(hwndDlg, IDC_SEARCH_PROTOCOL, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"Windows Live (MSN)");
		
		// select the first one
		SendDlgItemMessage(hwndDlg, IDC_SEARCH_PROTOCOL, CB_SETCURSEL, 0, 0);
		return TRUE;
	case WM_COMMAND:
		if(LOWORD(wParam)==IDC_SEARCH_ID && HIWORD(wParam)==EN_CHANGE){
			PostMessage(GetParent(hwndDlg),WM_COMMAND, MAKEWPARAM(0,EN_SETFOCUS), (LPARAM)hwndDlg);
			return TRUE;
		}
		if(LOWORD(wParam)==IDC_SEARCH_PROTOCOL && HIWORD(wParam)==CBN_SELCHANGE){
			PostMessage(GetParent(hwndDlg),WM_COMMAND, MAKEWPARAM(0,EN_SETFOCUS), (LPARAM)hwndDlg);
			return TRUE;
		}
		break;
	}
	return FALSE;
}
static void on_add_click(HWND dialog)
{
    static const char dotDll[] = ".dll";
    char buffer[1024], *ptr;

    ZeroMemory(buffer, sizeof(buffer));

    SendDlgItemMessageA(dialog, IDC_DLLCOMBO, WM_GETTEXT, sizeof(buffer), (LPARAM) buffer);
    if (lstrlenA(buffer) >= sizeof(dotDll))
    {
        ptr = buffer + lstrlenA(buffer) - sizeof(dotDll) + 1;
        if (!lstrcmpiA(ptr, dotDll))
        {
            WINE_TRACE("Stripping dll extension\n");
            *ptr = '\0';
        }
    }

    /* check if dll is in the builtin-only list */
    if (!(ptr = strrchr( buffer, '\\' )))
    {
        ptr = buffer;
        if (*ptr == '*') ptr++;
    }
    else ptr++;
    if (is_builtin_only( ptr ))
    {
        MSGBOXPARAMSA params;
        params.cbSize = sizeof(params);
        params.hwndOwner = dialog;
        params.hInstance = GetModuleHandleA( NULL );
        params.lpszText = MAKEINTRESOURCEA( IDS_DLL_WARNING );
        params.lpszCaption = MAKEINTRESOURCEA( IDS_DLL_WARNING_CAPTION );
        params.dwStyle = MB_ICONWARNING | MB_YESNO;
        params.lpszIcon = NULL;
        params.dwContextHelpId = 0;
        params.lpfnMsgBoxCallback = NULL;
        params.dwLanguageId = 0;
        if (MessageBoxIndirectA( &params ) != IDYES) return;
    }

    SendDlgItemMessageW(dialog, IDC_DLLCOMBO, WM_SETTEXT, 0, (LPARAM)emptyW);
    disable(IDC_DLLS_ADDDLL);
    SendMessageW(GetParent(dialog), DM_SETDEFID, IDOK, 0);

    WINE_TRACE("Adding %s as native, builtin\n", buffer);

    SendMessageW(GetParent(dialog), PSM_CHANGED, 0, 0);
    set_reg_key(config_key, keypath("DllOverrides"), buffer, "native,builtin");

    load_library_settings(dialog);

    SendDlgItemMessageA(dialog, IDC_DLLS_LIST, LB_SELECTSTRING, 0, (LPARAM) buffer);

    set_controls_from_selection(dialog);
}
static
void
_insertString
(
    HWND hDlg,
    PCHAR string,
    int stringlen,
    BOOL showOffset,
    int offset,
    BOOL showType,
    BOOL unicode,
    int index
)
{
    LV_ITEMA lvi            = { 0 };
    CHAR    stroffset[10]   = { 0 };
    int     subitem         = 0;

    ZeroMemory(&lvi, sizeof(lvi));

    if (showType)
    {
        lvi.mask = LVIF_TEXT;
        lvi.pszText = unicode ? "U" : "A";
        lvi.cchTextMax = 2;
        lvi.iItem = index;
        lvi.iSubItem = subitem;
        SendDlgItemMessageA(hDlg, IDC_STRINGLIST, subitem == 0 ? LVM_INSERTITEMA : LVM_SETITEMA, 0, (LPARAM)&lvi);
        subitem++;
    }

    if (showOffset)
    {
        ZeroMemory(stroffset, sizeof(stroffset));
        _snprintf_s(stroffset, sizeof(stroffset), sizeof(stroffset), "%08X", offset);

        lvi.mask = LVIF_TEXT;
        lvi.pszText = stroffset;
        lvi.cchTextMax = sizeof(stroffset);
        lvi.iItem = index;
        lvi.iSubItem = subitem;
        SendDlgItemMessageA(hDlg, IDC_STRINGLIST, subitem == 0 ? LVM_INSERTITEMA : LVM_SETITEMA, 0, (LPARAM)&lvi);
        subitem++;
    }

    lvi.mask = LVIF_TEXT;
    lvi.pszText = string;
    lvi.cchTextMax = stringlen;
    lvi.iItem = index;
    lvi.iSubItem = subitem;
    SendDlgItemMessageA(hDlg, IDC_STRINGLIST, subitem == 0 ? LVM_INSERTITEMA : LVM_SETITEMA, 0, (LPARAM)&lvi);

}
Beispiel #8
0
void ListView_AddTextItemA(HWND hDlg, int nIDDlgItem, int iItem, int iSubItem, LPCSTR text)
{
   LVITEMA itemdata;

   itemdata.mask = LVIF_TEXT;
   itemdata.iItem = iItem;
   itemdata.iSubItem = iSubItem;
   itemdata.pszText = (LPSTR)text;
   itemdata.cchTextMax = (int)lstrlenA(itemdata.pszText);

   if (itemdata.iSubItem == 0)
      SendDlgItemMessageA(hDlg, nIDDlgItem, LVM_INSERTITEMA, 0, (LPARAM)&itemdata);
   else
      SendDlgItemMessageA(hDlg, nIDDlgItem, LVM_SETITEMA, 0, (LPARAM)&itemdata);
}
DWORD
WINAPI
_findStringThreadFunc
(
    PVOID arg
)
{
    PTHREAD_ARGS    findStringsArg  = (PTHREAD_ARGS)arg;
    HWND            hDlg            = NULL;
    BOOL            stop            = FALSE;
    __try
    {
        hDlg = findStringsArg->hDlg;
        Edit_SetText(GetDlgItem(hDlg, IDC_STATUS), "");
        _resetStringList(hDlg);
        _setViewColums(hDlg, findStringsArg->offsets, 
                        findStringsArg->ascii && findStringsArg->unicode);
        SendDlgItemMessageA(hDlg, IDC_PROGRESS, PBM_SETPOS, 0, (LPARAM)0);
        g_stringsdone = FALSE;
        g_prevascii = FALSE;
        g_prevunicode = FALSE;
        g_lastObj = g_object;
        g_showOffsets = findStringsArg->offsets;
        if (!stop && findStringsArg->ascii)
        {
            stop = _findStrings(findStringsArg->hDlg, findStringsArg->minLen,
                findStringsArg->ascii, 0,
                findStringsArg->offsets, findStringsArg->unicode && findStringsArg->ascii);
            g_prevascii = TRUE;
        }
        if (!stop && findStringsArg->unicode)
        {
            stop = _findStrings(findStringsArg->hDlg, findStringsArg->minLen,
                0, findStringsArg->unicode,
                findStringsArg->offsets, findStringsArg->unicode && findStringsArg->ascii);
            g_prevunicode = TRUE;
        }
        g_stringsdone = TRUE;
        SendDlgItemMessageA(hDlg, IDC_PROGRESS, PBM_SETPOS, 100, (LPARAM)0);
    }
    __finally
    {
        free(findStringsArg);
        CloseHandle(g_thread);
        g_thread = NULL;
    }
    return 0;
}
Beispiel #10
0
/*********************************************************
*NAME:          dialogMessagesChange
*AUTHOR:        John Morrison
*CREATION DATE: 7/4/99
*LAST MODIFIED: 3/1/00
*PURPOSE:
* Changes the "Sending to X players" message 
*
*ARGUMENTS:
*  hWnd - The dialog window handle
*********************************************************/
void dialogMessagesChange(HWND hWnd) {
  char output[256]; /* Output string                */
  int numSend;      /* Number of players to send to */

  /* Get the number of selected players */
  if (IsDlgButtonChecked(hWnd, IDC_ALL_PLAYERS) == BST_CHECKED) {
    numSend = screenGetNumPlayers();
  } else if (IsDlgButtonChecked(hWnd, IDC_ALL_ALLIES) == BST_CHECKED) {
    numSend = screenNumAllies();
  } else if (IsDlgButtonChecked(hWnd, IDC_ALL_NEARBY) == BST_CHECKED) {
    numSend = screenNumNearbyTanks();
  } else {
    numSend = screenNumCheckedPlayers();
  }

  /* Make the appropriate message */
  if (numSend == 1) {
    sprintf(output, langGetText(STR_DLGMSG_SENDPLAYER), 1);
  } else {
    sprintf(output, langGetText(STR_DLGMSG_SENDPLAYERS), numSend);
  }
  /* Print it */
  SendDlgItemMessageA(hWnd, IDC_NUM_PLAYERS, WM_SETTEXT, 0, (LPARAM)(LPCTSTR) (output));
/*  SetFocus(GetDlgItem(hWnd, IDC_EDITSEND));  */
}
Beispiel #11
0
// fills the combobox of the options dlg for the first time
static void FillItemList(HWND hwndDlg)
{
	int n, iOff;
	UINT item;

	for (n = 0; n < ID_EXTBK_LAST - ID_EXTBK_FIRST; n++) {
		iOff = 0;
		if (strstr(StatusItems[n]->szName, "{-}")) {
			item = SendDlgItemMessageA(hwndDlg, IDC_ITEMS, LB_ADDSTRING, 0, (LPARAM)"------------------------");
			SendDlgItemMessageA(hwndDlg, IDC_ITEMS, LB_SETITEMDATA, item, ID_EXTBKSEPARATOR);
			iOff = 3;
		}
		item = SendDlgItemMessageA(hwndDlg, IDC_ITEMS, LB_ADDSTRING, 0, (LPARAM)StatusItems[n]->szName[iOff]);
		SendDlgItemMessage(hwndDlg, IDC_ITEMS, LB_SETITEMDATA, item, ID_EXTBK_FIRST + n);
	}
}
Beispiel #12
0
INT_PTR SendMessageCmd(MCONTACT hContact, char *msg, int isWchar)
{
	/* does the MCONTACT's protocol support IM messages? */
	char *szProto = GetContactProto(hContact);
	if (!szProto || (!CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND))
		return 1;

	hContact = db_mc_tryMeta(hContact);

	HWND hwnd = WindowList_Find(g_dat.hMessageWindowList, hContact);
	if (hwnd) {
		if (msg) {
			SendDlgItemMessage(hwnd, IDC_MESSAGE, EM_SETSEL, -1, SendDlgItemMessage(hwnd, IDC_MESSAGE, WM_GETTEXTLENGTH, 0, 0));
			if (isWchar)
				SendDlgItemMessageW(hwnd, IDC_MESSAGE, EM_REPLACESEL, FALSE, (LPARAM)msg);
			else
				SendDlgItemMessageA(hwnd, IDC_MESSAGE, EM_REPLACESEL, FALSE, (LPARAM)msg);
		}
		ShowWindow(hwnd, SW_RESTORE);
		SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
		SetForegroundWindow(hwnd);
	}
	else {
		NewMessageWindowLParam newData = { 0 };
		newData.hContact = hContact;
		newData.szInitialText = msg;
		newData.isWchar = isWchar;
		CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_MSG), NULL, DlgProcMessage, (LPARAM)&newData);
	}
	return 0;
}
Beispiel #13
0
/**************************************************************************
*  IShellBrowserImpl_SendControlMsg
*/
static HRESULT WINAPI IShellBrowserImpl_SendControlMsg(IShellBrowser *iface,
                                            UINT id,
                                            UINT uMsg,
                                            WPARAM wParam,
                                            LPARAM lParam,
                                            LRESULT *pret)

{
    IShellBrowserImpl *This = impl_from_IShellBrowser(iface);
    LRESULT lres;

    TRACE("(%p)->(0x%08x 0x%08x 0x%08lx 0x%08lx %p)\n", This, id, uMsg, wParam, lParam, pret);

    switch (id)
    {
      case FCW_TOOLBAR:
        lres = SendDlgItemMessageA( This->hwndOwner, IDC_TOOLBAR, uMsg, wParam, lParam);
	break;
      default:
        FIXME("ctrl id: %x\n", id);
        return E_NOTIMPL;
    }
    if (pret) *pret = lres;
    return S_OK;
}
Beispiel #14
0
INT_PTR CALLBACK CreateGameDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
	int wmId, wmEvt;
	switch(message)
	{
	case WM_CLOSE:
		EndDialog(hDlg, IDCANCEL);
		return (INT_PTR)TRUE;
	case WM_SHOWWINDOW:
		//	Set default port
		SetDlgItemText(hDlg, IDC_PORT, L"1024");
		//	Activate edit to set the text
		SendDlgItemMessage(hDlg, IDC_PORT, WM_ACTIVATE, WA_CLICKACTIVE, 0);
		//	Select text in text box. This should be checked if there exists nicer way to achieve the selection
		SendDlgItemMessage(hDlg, IDC_PORT, WM_LBUTTONDBLCLK, 0, 0);
		return (INT_PTR)TRUE;
	case WM_COMMAND:
		{
			wmId = LOWORD(wParam);
			wmEvt= HIWORD(wParam);
			switch(wmId)
			{
			case IDOK:
				{
					Communication::ConnectionSettings connectionSettings;
					LPARAM textLength = SendDlgItemMessageA(hDlg, IDC_PORT, WM_GETTEXTLENGTH, 0, 0);
					char *portText = new char[textLength + 1];
					SendDlgItemMessageA(hDlg, IDC_PORT, WM_GETTEXT, textLength + 1, (LPARAM)portText);
					connectionSettings.port = atoi(portText);
					if(connectionSettings.port <= 0)
						connectionSettings.port = 1024;
					delete[] portText;
					//connectionSettings.port = 
					appState.gameServer().connectionDispatcher()->setConnectionSettings(connectionSettings);
					EndDialog(hDlg, IDOK);
					return (INT_PTR)TRUE;
				}
			case IDCANCEL:
				{
					EndDialog(hDlg, IDCANCEL);
					return (INT_PTR)TRUE;
				}
			}
		}
	}
	return (INT_PTR)FALSE;
}
Beispiel #15
0
static INT_PTR CALLBACK Window_StopwatchExportDlg(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
	(void)lParam; // unused
	switch(msg) {
	case WM_INITDIALOG:{
		wchar_t buf[128];
		api.GetStr(L"Timers", L"SwExT", buf, _countof(buf), L"");
		SetDlgItemText(hDlg,IDC_SWE_TOTAL,buf);
		api.GetStr(L"Timers", L"SwExL", buf, _countof(buf), L"");
		SetDlgItemText(hDlg, IDC_SWE_LAP, buf);
		SendMessage(hDlg, WM_COMMAND,IDOK, 0);
		Edit_SetSel(GetDlgItem(hDlg,IDC_SWE_OUT), 0, -1);
		SetFocus(GetDlgItem(hDlg,IDC_SWE_OUT));
		return FALSE;}
	case WM_DESTROY:{
		break;}
	case WM_COMMAND: {
			switch(LOWORD(wParam)) {
			case IDC_SWE_EXPORT:{
				wchar_t filename[MAX_PATH];
				unsigned buflen = (unsigned)SendDlgItemMessageA(hDlg,IDC_SWE_OUT,WM_GETTEXTLENGTH,0,0);
				char* buf = malloc(buflen + 1);
				if(buf && buflen){
					GetDlgItemTextA(hDlg, IDC_SWE_OUT, buf, buflen+1);
					*filename = '\0';
					if(SaveFileDialog(hDlg,filename,_countof(filename))){
						FILE* fp = _wfopen(filename, L"wb");
						if(fp){
							fwrite(buf, sizeof(buf[0]), buflen, fp);
							fclose(fp);
						}
					}
				}
				free(buf);
				break;}
			case IDOK:{
				wchar_t buf[128];
				GetDlgItemText(hDlg, IDC_SWE_TOTAL, buf, _countof(buf));
				if(!*buf){
					api.DelValue(L"Timers", L"SwExT");
					SetDlgItemText(hDlg, IDC_SWE_TOTAL, L"\\n--------------------\\n\\t");
				}else
					api.SetStr(L"Timers", L"SwExT", buf);
				GetDlgItemText(hDlg, IDC_SWE_LAP, buf, _countof(buf));
				if(!*buf){
					api.DelValue(L"Timers", L"SwExL");
					SetDlgItemText(hDlg, IDC_SWE_LAP, L"Lap \\#\\f: \\l (\\t)\\n");
				}else
					api.SetStr(L"Timers", L"SwExL", buf);
				export_text(hDlg);
				break;}
			case IDCANCEL:
				EndDialog(hDlg, TRUE);
			}
			return TRUE;
		}
	}
	return FALSE;
}
Beispiel #16
0
static INT_PTR CALLBACK YahooSearchAdvancedDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch ( msg ) {
	case WM_INITDIALOG:
		TranslateDialogDefault(hwndDlg);
			
		SendDlgItemMessageA(hwndDlg, IDC_SEARCH_PROTOCOL, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"Yahoo! Messenger");
		SendDlgItemMessageA(hwndDlg, IDC_SEARCH_PROTOCOL, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"Lotus Sametime");
		SendDlgItemMessageA(hwndDlg, IDC_SEARCH_PROTOCOL, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"LCS");
		SendDlgItemMessageA(hwndDlg, IDC_SEARCH_PROTOCOL, CB_ADDSTRING, 0, (LPARAM)(LPCSTR)"Windows Live (MSN)");
		
		// select the first one
		SendDlgItemMessage(hwndDlg, IDC_SEARCH_PROTOCOL, CB_SETCURSEL, 0, 0);
		return TRUE;
	}
	return FALSE;
}
Beispiel #17
0
int ListView_GetTextSelItemA(HWND hDlg, int nIDDlgItem, int iSubItem, LPSTR text, int cchTextMax)
{
   LVITEMA itemdata;
   int cursel=(int)SendDlgItemMessageA(hDlg, nIDDlgItem, LVM_GETNEXTITEM, -1, LVNI_SELECTED);

   if (cursel == -1)
      return cursel;

   itemdata.mask = LVIF_TEXT;
   itemdata.iItem = cursel;
   itemdata.iSubItem = iSubItem;
   itemdata.pszText = text;
   itemdata.cchTextMax = cchTextMax;
   SendDlgItemMessageA(hDlg, nIDDlgItem, LVM_GETITEM, 0, (LPARAM)&itemdata);

   return cursel;
}
Beispiel #18
0
/* load the list of available libraries from a given dir */
static void load_library_list_from_dir( HWND dialog, const char *dir_path, int check_subdirs )
{
    char *buffer = NULL, name[256];
    struct dirent *de;
    DIR *dir = opendir( dir_path );

    if (!dir) return;

    if (check_subdirs)
        buffer = HeapAlloc( GetProcessHeap(), 0, strlen(dir_path) + 2 * sizeof(name) + 10 );

    while ((de = readdir( dir )))
    {
        size_t len = strlen(de->d_name);
        if (len > sizeof(name)) continue;
        if (len > 3 && !strcmp( de->d_name + len - 3, ".so"))
        {
            len -= 3;
            if (len > 4 && !strcmp( de->d_name + len - 4, ".dll.so")) len -= 4;
            memcpy( name, de->d_name, len );
            name[len] = 0;
            if (!show_dll_in_list( name )) continue;
            SendDlgItemMessageA( dialog, IDC_DLLCOMBO, CB_ADDSTRING, 0, (LPARAM)name );
        }
        else if (check_subdirs)
        {
            struct stat st;
            if (!show_dll_in_list( de->d_name )) continue;
            sprintf( buffer, "%s/%s/%s.dll.so", dir_path, de->d_name, de->d_name );
            if (!stat( buffer, &st ))
            {
                SendDlgItemMessageA( dialog, IDC_DLLCOMBO, CB_ADDSTRING, 0, (LPARAM)de->d_name );
                continue;
            }
            sprintf( buffer, "%s/%s/%s.so", dir_path, de->d_name, de->d_name );
            if (!stat( buffer, &st ))
            {
                SendDlgItemMessageA( dialog, IDC_DLLCOMBO, CB_ADDSTRING, 0, (LPARAM)de->d_name );
                continue;
            }
        }
    }
    closedir( dir );
    HeapFree( GetProcessHeap(), 0, buffer );
}
Beispiel #19
0
void ListView_InsertTextColumnA(HWND hDlg, int nIDDlgItem, int width, int id, LPCSTR text)
{
   LVCOLUMNA coldata;
        
   coldata.mask = LVCF_TEXT | LVCF_WIDTH;
   coldata.pszText = (LPSTR)text;
   coldata.cchTextMax = (int)lstrlenA(coldata.pszText);
   coldata.cx = width;
   SendDlgItemMessageA(hDlg, nIDDlgItem, LVM_INSERTCOLUMN, (WPARAM)id, (LPARAM)&coldata);
}
Beispiel #20
0
/*********************************************************
*NAME:          dialogNetInfoUpdate
*AUTHOR:        John Morrison
*CREATION DATE: 3/3/99
*LAST MODIFIED: 1/9/99
*PURPOSE:
* Updates the network info dialog box
*
*ARGUMENTS:
*  hWnd - The dialog window handle
*********************************************************/
void dialogNetInfoUpdate(HWND hWnd) {
  int ping;               /* Downstream delay */
  int ppsec;              /* Packets per second */
  int numErrors;          /* Number of errors */
  char str[FILENAME_MAX]; /* Strings to display */

  /* Get addresses */
  netGetServerAddressStr(str);
  SendDlgItemMessageA(hWnd, IDC_SERVER, WM_SETTEXT, 0, (LPARAM)(LPCTSTR) (str));
  /* Get data */
  netGetStats(str, &ping, &ppsec, &numErrors);
  /* Print data items */
  SendDlgItemMessageA(hWnd, IDC_NETSTATUS, WM_SETTEXT, 0, (LPARAM)(LPCTSTR) (str));
  sprintf(str, "%i", ping);
  SendDlgItemMessageA(hWnd, IDC_PING, WM_SETTEXT, 0, (LPARAM)(LPCTSTR) (str));
  sprintf(str, "%i", ppsec);
  SendDlgItemMessageA(hWnd, IDC_PACKETSPERSECOND, WM_SETTEXT, 0, (LPARAM)(LPCTSTR) (str));
  sprintf(str, "%i", numErrors);
  SendDlgItemMessageA(hWnd, IDC_NETERRORS, WM_SETTEXT, 0, (LPARAM)(LPCTSTR) (str));
}
void initGameTypeCombo(HWND hWnd)
{
	int i, j, sel=0;

	for(i=0; i<sizeA(gameTypeComboOrder); i++){
		j=gameTypeComboOrder[i];
		if(j==gameType) sel=i;
		SendDlgItemMessageA(hWnd, 170, CB_ADDSTRING, 0, (LPARAM)gameTypeA[j].name);
	}
	SendDlgItemMessage(hWnd, 170, CB_SETCURSEL, sel, 0);
}
Beispiel #22
0
static MMRESULT MSACM_GetWFX(HWND hWnd, PACMFORMATCHOOSEA afc)
{
    ACMFORMATTAGDETAILSA	aftd;
    struct MSACM_FillFormatData	affd;

    memset(&aftd, 0, sizeof(aftd));
    aftd.cbStruct = sizeof(aftd);

    affd.hWnd = hWnd;
    affd.mode = WINE_ACMFF_WFX;
    affd.afc = afc;
    affd.ret = MMSYSERR_NOERROR;
    SendDlgItemMessageA(hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMATTAG,
			CB_GETLBTEXT,
			SendDlgItemMessageA(hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMATTAG,
					    CB_GETCURSEL, 0, 0),
			(DWORD)affd.szFormatTag);

    acmFormatTagEnumA(NULL, &aftd, MSACM_FillFormatTagsCB, (DWORD)&affd, 0);
    return affd.ret;
}
Beispiel #23
0
int GetFileSizes(HWND hwndDlg)
{
	char buf[MAX_PATH];
	SIZE sz={0};
	SendDlgItemMessageA(hwndDlg,IDC_FILE,WM_GETTEXT,(WPARAM)MAX_PATH,(LPARAM)buf);
	ske_GetFullFilename(buf,buf,0,TRUE);
	{
		HBITMAP hbmp=ske_LoadGlyphImage(buf);
		if (hbmp)
		{
			BITMAP bm={0};
			GetObject(hbmp,sizeof(BITMAP),&bm);
			sz.cx=bm.bmWidth;
			sz.cy=bm.bmHeight;
			ske_UnloadGlyphImage(hbmp);
		}
	}
	_snprintf(buf, MAX_PATH, "%s %d x %d %s",Translate("Image size is"),sz.cx, sz.cy, Translate("pixels")); 
	SendDlgItemMessageA(hwndDlg,IDC_S_SIZE,WM_SETTEXT,0,(LPARAM)buf);
	return 0;
}
static INT_PTR CALLBACK drivechoose_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    static int i, sel;
    char c;
    char drive[] = "X:";

    switch(uMsg)
    {
    case WM_INITDIALOG:
        {
        ULONG mask = ~drive_available_mask(0); /* the mask is now which drives aren't available */
        for( c = 'A'; c<= 'Z'; c++){
            drive[0] = c;
            if(!( mask & (1 << (c - 'A'))))
                SendDlgItemMessageA( hwndDlg, IDC_DRIVESA2Z, CB_ADDSTRING, 0, (LPARAM) drive);
        }
        drive[0] = lParam;
        SendDlgItemMessageA( hwndDlg, IDC_DRIVESA2Z, CB_SELECTSTRING, 0, (LPARAM) drive);
        return TRUE;
        }
    case WM_COMMAND:
        if(HIWORD(wParam) != BN_CLICKED) break;
        switch (LOWORD(wParam))
        {
        case IDOK:
            i = SendDlgItemMessageA( hwndDlg, IDC_DRIVESA2Z, CB_GETCURSEL, 0, 0);
            if( i != CB_ERR){
                SendDlgItemMessageA( hwndDlg, IDC_DRIVESA2Z, CB_GETLBTEXT, i, (LPARAM) drive);
                sel = drive[0];
            } else
                sel = -1;
            EndDialog(hwndDlg, sel);
            return TRUE;
        case IDCANCEL:
            EndDialog(hwndDlg, -1);
            return TRUE;
        }
    }
    return FALSE;
}
Beispiel #25
0
static BOOL MSACM_FillFormat(HWND hWnd)
{
    ACMFORMATTAGDETAILSA	aftd;
    struct MSACM_FillFormatData	affd;

    SendDlgItemMessageA(hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMAT, CB_RESETCONTENT, 0, 0);

    memset(&aftd, 0, sizeof(aftd));
    aftd.cbStruct = sizeof(aftd);

    affd.hWnd = hWnd;
    affd.mode = WINE_ACMFF_FORMAT;
    SendDlgItemMessageA(hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMATTAG,
			CB_GETLBTEXT,
			SendDlgItemMessageA(hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMATTAG,
					    CB_GETCURSEL, 0, 0),
			(DWORD)affd.szFormatTag);

    acmFormatTagEnumA(NULL, &aftd, MSACM_FillFormatTagsCB, (DWORD)&affd, 0);
    SendDlgItemMessageA(hWnd, IDD_ACMFORMATCHOOSE_CMB_FORMAT, CB_SETCURSEL, 0, 0);
    return TRUE;
}
Beispiel #26
0
void RefreshPrivacy(HWND hwnd, post_status_data *data)
{
	SendDlgItemMessage(hwnd, IDC_PRIVACY, CB_RESETCONTENT, 0, 0);
	int wall_id = SendDlgItemMessage(hwnd, IDC_WALL, CB_GETCURSEL, 0, 0);
	if (data->walls[wall_id]->user_id == data->proto->facy.self_.user_id) {
		for (size_t i = 0; i < _countof(privacy_types); i++)
			SendDlgItemMessageA(hwnd, IDC_PRIVACY, CB_INSERTSTRING, i, reinterpret_cast<LPARAM>(Translate(privacy_types[i].name)));
	}
	else {
		SendDlgItemMessage(hwnd, IDC_PRIVACY, CB_INSERTSTRING, 0, reinterpret_cast<LPARAM>(TranslateT("Default")));
	}
	SendDlgItemMessage(hwnd, IDC_PRIVACY, CB_SETCURSEL, 0, 0);
	SendDlgItemMessage(hwnd, IDC_PRIVACY, CB_SETCURSEL, data->proto->getByte(FACEBOOK_KEY_PRIVACY_TYPE, 0), 0);
}
Beispiel #27
0
/* load the list of available libraries */
static void load_library_list( HWND dialog )
{
    unsigned int i = 0;
    const char *path, *build_dir = wine_get_build_dir();
    char item1[256], item2[256];
    HCURSOR old_cursor = SetCursor( LoadCursorW(0, (LPWSTR)IDC_WAIT) );

    if (build_dir)
    {
        char *dir = HeapAlloc( GetProcessHeap(), 0, strlen(build_dir) + sizeof("/dlls") );
        strcpy( dir, build_dir );
        strcat( dir, "/dlls" );
        load_library_list_from_dir( dialog, dir, TRUE );
        HeapFree( GetProcessHeap(), 0, dir );
    }

    while ((path = wine_dll_enum_load_path( i++ )))
        load_library_list_from_dir( dialog, path, FALSE );

    /* get rid of duplicate entries */

    SendDlgItemMessageA( dialog, IDC_DLLCOMBO, CB_GETLBTEXT, 0, (LPARAM)item1 );
    i = 1;
    while (SendDlgItemMessageA( dialog, IDC_DLLCOMBO, CB_GETLBTEXT, i, (LPARAM)item2 ) >= 0)
    {
        if (!strcmp( item1, item2 ))
        {
            SendDlgItemMessageA( dialog, IDC_DLLCOMBO, CB_DELETESTRING, i, 0 );
        }
        else
        {
            strcpy( item1, item2 );
            i++;
        }
    }
    SetCursor( old_cursor );
}
Beispiel #28
0
static void SaveOptionsTreeState(HWND hdlg)
{
	TVITEMA tvi;
	char buf[130], str[128];
	tvi.mask = TVIF_TEXT | TVIF_STATE;
	tvi.pszText = str;
	tvi.cchTextMax = _countof(str);
	tvi.hItem = TreeView_GetRoot(GetDlgItem(hdlg, IDC_PAGETREE));
	while (tvi.hItem != NULL) {
		if (SendDlgItemMessageA(hdlg, IDC_PAGETREE, TVM_GETITEMA, 0, (LPARAM)&tvi)) {
			mir_snprintf(buf, "%s%s", OPTSTATE_PREFIX, str);
			db_set_b(NULL, "Options", buf, (BYTE)((tvi.state & TVIS_EXPANDED) ? 1 : 0));
		}
		tvi.hItem = TreeView_GetNextSibling(GetDlgItem(hdlg, IDC_PAGETREE), tvi.hItem);
	}
}
Beispiel #29
0
int SendToRichEdit(HWND hWindow, char *truncated, COLORREF rgbText, COLORREF rgbBack)
{
	DBVARIANT       dbv;
	DWORD  bold = 0;
	DWORD  italic = 0;
	DWORD  underline = 0;

	int len = GetWindowTextLength(GetDlgItem(hWindow, IDC_DATA));
	SetDlgItemText(hWindow, IDC_DATA, _T(""));

	CHARFORMAT2 cfFM;
	ZeroMemory(&cfFM, sizeof(cfFM));
	cfFM.cbSize = sizeof(CHARFORMAT2);
	cfFM.dwMask = CFM_COLOR | CFM_CHARSET | CFM_FACE | ENM_LINK | ENM_MOUSEEVENTS | CFM_BOLD | CFM_ITALIC | CFM_UNDERLINE | CFM_SIZE;

	if ( db_get_b(NULL, MODULENAME, FONT_BOLD_KEY, 0))
		bold = CFE_BOLD;

	if ( db_get_b(NULL, MODULENAME, FONT_ITALIC_KEY, 0))
		italic = CFE_ITALIC;

	if ( db_get_b(NULL, MODULENAME, FONT_UNDERLINE_KEY, 0))
		underline = CFE_UNDERLINE;

	cfFM.dwEffects = bold | italic | underline;

	if (!db_get_ts(NULL, MODULENAME, FONT_FACE_KEY, &dbv)) {
		lstrcpy(cfFM.szFaceName, dbv.ptszVal);
		db_free(&dbv);
	}
	else lstrcpy(cfFM.szFaceName, Def_font_face);

	HDC hDC = GetDC(hWindow);
	cfFM.yHeight = (BYTE)MulDiv(abs(lf.lfHeight), 120, GetDeviceCaps(GetDC(hWindow), LOGPIXELSY)) * (db_get_b(NULL, MODULENAME, FONT_SIZE_KEY, 14));
	ReleaseDC(hWindow, hDC);

	cfFM.bCharSet = db_get_b(NULL, MODULENAME, FONT_SCRIPT_KEY, 0);
	cfFM.bPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
	cfFM.crTextColor = rgbText;
	cfFM.crBackColor = rgbBack;
	SendDlgItemMessage(hWindow, IDC_DATA, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM) & cfFM);

	SendDlgItemMessage(hWindow, IDC_DATA, EM_SETSEL, 0, -1);
	SendDlgItemMessageA(hWindow, IDC_DATA, EM_REPLACESEL, FALSE, (LPARAM)truncated);
	SendDlgItemMessage(hWindow, IDC_DATA, EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&cfFM);
	return 1;
}
Beispiel #30
0
HTREEITEM TreeView_AddTextItemA(HWND hDlg, int nIDDlgItem, HTREEITEM hParent, HTREEITEM hInsertAfter, LPSTR lpszItem, LPARAM lParam)
{ 
    TVITEMA tvi; 
    TVINSERTSTRUCTA tvins;

    tvi.mask = TVIF_TEXT | TVIF_PARAM;

    tvi.pszText = lpszItem; 
    tvi.cchTextMax = sizeof(tvi.pszText)/sizeof(tvi.pszText[0]); 
    tvi.lParam = lParam;

    tvins.item = tvi; 
    tvins.hInsertAfter = hInsertAfter; 

    // Set the parent item based on the specified level. 
    tvins.hParent = hParent; 

    return(HTREEITEM)SendDlgItemMessageA(hDlg, nIDDlgItem, TVM_INSERTITEM, 
                                        0, (LPARAM)(LPTVINSERTSTRUCT)&tvins);
}