Beispiel #1
0
static BOOL FillStructureFromControls (HWND hwnd)
{
   HWND hwndObjectType = GetDlgItem (hwnd, IDC_LOCATE_OBJECTTYPE);
   HWND hwndDatabase   = GetDlgItem (hwnd, IDC_LOCATE_DATABASE);
   HWND hwndFind       = GetDlgItem (hwnd, IDC_LOCATE_FIND);
   LPLOCATEPARAMS lplocate   = GetDlgProp (hwnd);

   int  nSel;
   char szObjectType [MAXOBJECTNAME];
   char szDatabase   [MAXOBJECTNAME];
   char szFind       [MAXOBJECTNAME];

   ZEROINIT (szObjectType);
   ZEROINIT (szDatabase  );
   ZEROINIT (szFind      );

   ComboBox_GetText (hwndObjectType, szObjectType, sizeof (szObjectType));
   if (IsWindowEnabled (hwndDatabase))
       ComboBox_GetText (hwndDatabase  , szDatabase  , sizeof (szDatabase  ));
   Edit_GetText (hwndFind, szFind, sizeof (szFind));
   if ((nSel = ComboBox_GetCurSel (hwndObjectType)) != CB_ERR)
       lplocate->ObjectType = Obj4locate() [nSel];
   else
       lplocate->ObjectType = -1;

   x_strcpy (lplocate->DBName,     szDatabase);
   x_strcpy (lplocate->FindString, szFind);
   if (!ProhibitString_all2 (hwnd))
       return FALSE;

   return TRUE;
}
Beispiel #2
0
extern void SaveSettings(void)
{
    HKEY hKey = NULL;

    if (RegCreateKey(HKEY_CURRENT_USER, g_szGeneralRegKey, &hKey) == ERROR_SUCCESS)
    {
        if (RegOpenKeyEx(HKEY_CURRENT_USER, g_szGeneralRegKey, 0, KEY_SET_VALUE, &hKey) == ERROR_SUCCESS)
        {
            TCHAR szBuffer[MAX_PATH];

            hWnd = GetDlgItem(hCharmapDlg, IDC_FONTCOMBO);
            ComboBox_GetText(hWnd, szBuffer, MAX_PATH);

            if(*szBuffer != '\0')
                RegSetValueEx(hKey, _T("Font"), 0, REG_SZ, (LPBYTE) szBuffer, (DWORD) MAX_PATH);

            hWnd = GetDlgItem(hCharmapDlg, IDC_COMBO_CHARSET);
            ComboBox_GetText(hWnd, szBuffer, MAX_PATH);

            if(*szBuffer != '\0')
                RegSetValueEx(hKey, _T("CodePage"), 0, REG_SZ, (LPBYTE) szBuffer, (DWORD) MAX_PATH);

            RegSetValueEx(hKey, _T("Advanced"), 0, REG_DWORD, (LPBYTE)&Settings.IsAdvancedView, (DWORD) sizeof(DWORD));

            RegCloseKey(hKey);
        }
    }
}
Beispiel #3
0
bool plResponderAnimProc::IUserCommand(HWND hWnd, IParamBlock2* pb, int cmd, int resID)
{
    if (cmd == CBN_SELCHANGE && resID == IDC_LOOP_COMBO)
    {
        HWND hCombo = GetDlgItem(hWnd, IDC_LOOP_COMBO);
        int sel = ComboBox_GetCurSel(hCombo);

        // If this is an actual loop (not the entire animation) get its name and save it
        if (sel != CB_ERR)
        {
            if (ComboBox_GetItemData(hCombo, sel) == 1)
            {
                char buf[256];
                ComboBox_GetText(hCombo, buf, sizeof(buf));
                pb->SetValue(kAnimLoop, 0, buf);
            }
            else
                pb->SetValue(kAnimLoop, 0, "");
        }

        return true;
    }

    return false;
}
Beispiel #4
0
void ComboBoxArray_AddSoundFiles(HWND boxes[], int num)
{
	int i;
	char search[MAX_PATH];
	HANDLE hFind;
	WIN32_FIND_DATA FindFileData;
	memcpy(search, api.root, api.root_len);
	memcpy(search+api.root_len, "/waves/*", 9);
	for(i=0; i<num; ++i)
		ComboBox_AddString(boxes[i],"<  no sound  >");
	if((hFind=FindFirstFile(search, &FindFileData)) != INVALID_HANDLE_VALUE) {
		do{
			if(!(FindFileData.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY)) { // only files (also ignores . and ..)
				for(i=0; i<num; ++i)
					ComboBox_AddString(boxes[i], FindFileData.cFileName);
			}
		}while(FindNextFile(hFind, &FindFileData));
		FindClose(hFind);
	}
	for(i=0; i<num; ++i){
		if(ComboBox_GetTextLength(boxes[i])){
			ComboBox_GetText(boxes[i], search, sizeof(search));
			ComboBox_AddStringOnce(boxes[i], search, 1);
		}else
			ComboBox_SetCurSel(boxes[i], 0);
	}
}
void CWildcardSelectDialog::SaveState()
{
	m_pwsdps->SaveDialogPosition(m_hDlg);

	HWND hComboBox = GetDlgItem(m_hDlg,IDC_SELECTGROUP_COMBOBOX);
	ComboBox_GetText(hComboBox,m_pwsdps->m_szPattern,SIZEOF_ARRAY(m_pwsdps->m_szPattern));

	m_pwsdps->m_bStateSaved = TRUE;
}
Beispiel #6
0
static BOOL OnInitDialog (HWND hwnd, HWND hwndFocus, LPARAM lParam)
{
   LPSECURITYALARMPARAMS lpsecurity   = (LPSECURITYALARMPARAMS)lParam;
   HWND    hwndUsers    = GetDlgItem (hwnd, IDC_REFALARM_BYUSER  );
   HWND    hwndDatabase = GetDlgItem (hwnd, IDC_REFALARM_DATABASE);
   HWND    hwndTables   = GetDlgItem (hwnd, IDC_REFALARM_ONTABLE );
   char    szTitle  [MAX_TITLEBAR_LEN];
   char    szFormat [100];
   char    szDatabaseName [MAXOBJECTNAME];

   if (!AllocDlgProp (hwnd, lpsecurity))
       return FALSE;
   //
   // force catolist.dll to load
   //
   CATOListDummy();

   LoadString (hResource, (UINT)IDS_T_CREATE_SECURITY, szFormat, sizeof (szFormat));

   wsprintf (szTitle, szFormat,
       GetVirtNodeName ( GetCurMdiNodeHandle ()),
       lpsecurity->DBName);
   SetWindowText (hwnd, szTitle);
   lpHelpStack = StackObject_PUSH (lpHelpStack, StackObject_INIT ((UINT)IDD_REFALARM));

   //
   // Get the available database names and insert them into the combo box
   //
   ComboBoxFillDatabases (hwndDatabase);
   ComboBoxSelectFirstStr(hwndDatabase);
   ComboBox_GetText (hwndDatabase, szDatabaseName, sizeof (szDatabaseName));
   if (x_strlen (szDatabaseName) > 0)
       x_strcpy (lpsecurity->DBName, szDatabaseName);

   //
   // Get the available table names and insert them into the table list 
   //
   if (x_strlen (lpsecurity->DBName) > 0)
   {
       if (!CAListBoxFillTables (hwndTables, lpsecurity->DBName, FALSE))
       {
           CAListBoxDestroyItemData (hwndTables);
           return FALSE;
       }
   }
   //
   // Get the available users names and insert them into the CA list box 
   // 

   CAListBoxFillUsersP (hwndUsers);
   PreCheckItem (hwnd);
   EnableDisableOKButton (hwnd);

   richCenterDialog (hwnd);
   return TRUE;
}
	POINT NewTerrainWindow::getDropdownListPairValues(const std::string& name) const
	{
		POINT value;
		UINT id = getItemID(name);
		if (id >= 0)
		{
			char buffer[32];
			ComboBox_GetText(GetDlgItem(m_hWnd, id), buffer, 31);
			value.x = atoi(buffer);
			ComboBox_GetText(GetDlgItem(m_hWnd, id + 1), buffer, 31);
			value.y = atoi(buffer);
		}
		else
		{
			value.x = -1;
			value.y = -1;
		}
		return value;
	}
Beispiel #8
0
static void EnableDisableOKButton (HWND hwnd)
{
    HWND hwndUser = GetDlgItem (hwnd, IDC_USR2GRP_USERBOX);
    char szUser [MAXOBJECTNAME];

    ComboBox_GetText (hwndUser, szUser, sizeof (szUser));

    if (x_strlen (szUser) == 0)
        EnableWindow (GetDlgItem (hwnd, IDOK), FALSE);
    else
        EnableWindow (GetDlgItem (hwnd, IDOK), TRUE);
}
Beispiel #9
0
/*
 * TextInputKey:  User pressed a key on text input box.
 *   Return True iff key should NOT be passed on to Windows for default processing.
 */
Bool TextInputKey(HWND hwnd, UINT key, Bool fDown, int cRepeat, UINT flags)
{
   Bool held_down = (flags & 0x4000) ? True : False;  /* Is key being held down? */
   char string[MAXSAY + 1];
   int action;
   BOOL bValid;
   void *action_data;

   if (key == VK_RETURN && !held_down)
   {
      UserDidSomething();

      ComboBox_GetText(hwndInput, string, MAXSAY + 1);
      if (string[0] == 0)
	 return True;

      SetFocus(hMain);
      bValid = ParseGotText(string);

      // Add it to the history.
      if (*string && bValid)
      {
	 BOOL bAdd = TRUE;
	 int iCount;
	 char achHead[MAXSAY+1];
	 iCount = ComboBox_GetCount(hwndInput);
	 if (iCount > 0)
	 {
	    ComboBox_GetLBText(hwndInput, 0, achHead);
	    if (0 == strcmp(achHead, string))
	       bAdd = FALSE;
	 }
	 if (bAdd)
	 {
	    ComboBox_InsertString(hwndInput, 0, string);
	    if (iCount > EDITBOX_HISTORY)
	       ComboBox_DeleteString(hwndInput, iCount);
	 }
      }

      return True;
   }
   
   // Check for special keys
   action = TranslateKey(key, textin_key_table, &action_data);

   if (action == A_NOACTION)
      return False;

   PerformAction(action, action_data);

   return True;
}
Beispiel #10
0
const char *plNoteTrackDlg::IGetSel(HWND hCombo)
{
    int sel = ComboBox_GetCurSel(hCombo);
    if (sel != CB_ERR && ComboBox_GetItemData(hCombo, sel) == kName)
    {
        char buf[256];
        ComboBox_GetText(hCombo, buf, sizeof(buf));
        return (*fSegMap)[plString::FromUtf8(buf)]->fName.c_str();
    }

    return "";
}
Beispiel #11
0
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
VOID ChangeShowOption(HWND hwndCtl)
{
    TCHAR tch[10];

    ComboBox_GetText(hwndCtl, tch, 10);
    if (_tcscmp(tch, TEXT("Both")) == 0)
        fShow = SHOW_BOTH;
    else if (_tcscmp(tch, TEXT("'Yes' only")) == 0)
        fShow = SHOW_YES;
    else
        fShow = SHOW_NO;
}
Beispiel #12
0
/* This function handles the WM_NOTIFY message.
 */ 
LRESULT FASTCALL RASBlinkProperties_OnNotify( HWND hwnd, int code, LPNMHDR lpnmhdr )
{
   switch( lpnmhdr->code )
      {
      case PSN_HELP:
         HtmlHelp( hwnd, szHelpFile, HH_HELP_CONTEXT, idsBLINK_RAS );
         break;

      case PSN_APPLY: {
         LPBLINKENTRY lpbe;
         HWND hwndTab;

         /* Update the blink entry structure.
          */
         lpbe = (LPBLINKENTRY)GetWindowLong( hwnd, DWL_USER );
         hwndTab = PropSheet_GetTabControl( GetParent( hwnd ) );
         if( !TabCtrl_GetEnable( hwndTab, idRasTab ) )
            lpbe->rd.fUseRAS = FALSE;
         else
            lpbe->rd.fUseRAS = IsDlgButtonChecked( hwnd, IDD_USERAS );

         /* If we use RAS, we'll need the entry name.
          */
         if( lpbe->rd.fUseRAS )
            {
            HWND hwndList;

            /* Get the entry name.
             */
            hwndList = GetDlgItem( hwnd, IDD_LIST );
            ComboBox_GetText( hwndList, lpbe->rd.szRASEntryName, RAS_MaxEntryName+1 );

            /* Get username and password.
             */
            Edit_GetText( GetDlgItem( hwnd, IDD_USERNAME ), lpbe->rd.szRASUserName, UNLEN+1 );
            Edit_GetText( GetDlgItem( hwnd, IDD_PASSWORD ), lpbe->rd.szRASPassword, PWLEN+1 );
            if( ( strlen( lpbe->rd.szRASEntryName ) == 0 ) || ( strlen( lpbe->rd.szRASUserName ) == 0 ) || ( strlen( lpbe->rd.szRASPassword ) == 0 ) )
            {
               fMessageBox( hwnd, 0, GS(IDS_STR1242), MB_OK|MB_ICONEXCLAMATION );
               return( PSNRET_INVALID_NOCHANGEPAGE );
            }
            Amuser_Encrypt( lpbe->rd.szRASPassword, rgEncodeKey );
            }

         /* Force the Apply button to be disabled.
          */
         PropSheet_UnChanged( GetParent( hwnd ), hwnd );
         return( PSNRET_NOERROR );
         }
      }
   return( FALSE );
}
//----------------------------------------------------------------------------------------------
//  VARS TO STRING
//----------------------------------------------------------------------------------------------
void cDlgSetTrigger :: vars_to_string ( cStrW * pRet )
{
	if ( IsDlgButtonChecked ( hwnd, ID_CAPSLOCK_ON ) )
		(*pRet) += L"CapsLockOn ";

	else if ( IsDlgButtonChecked ( hwnd, ID_CAPSLOCK_OFF ) )
		(*pRet) += L"CapsLockOff ";

	if ( IsDlgButtonChecked ( hwnd, ID_NUMLOCK_ON ) )
		(*pRet) += L"NumLockOn ";

	else if ( IsDlgButtonChecked ( hwnd, ID_NUMLOCK_OFF ) )
		(*pRet) += L"NumLockOff ";

	if ( IsDlgButtonChecked ( hwnd, ID_SCROLLLOCK_ON ) )
		(*pRet) += L"ScrollLockOn ";

	else if ( IsDlgButtonChecked ( hwnd, ID_SCROLLLOCK_OFF ) )
		(*pRet) += L"ScrollLockOff ";

	//---------------------------------
	//  GET ALL KEYS (NON-BLANK COMBOS)
	//---------------------------------

	int iQtyKeys = 0;

	for ( unsigned i = 0; i < aCombo.qty(); i++ )
	{
		wchar_t awBuf[100];

		if ( 0 == ComboBox_GetText ( aCombo[i].hwnd, awBuf, sizeof(awBuf)/sizeof(wchar_t) ) )
			continue;

#ifdef DEBUG

		WORD wExVK = cKeyboard::pretty_name_to_ex_vk ( awBuf );
		assert ( 0 != wExVK && wExVK < 512 );
#endif

		(*pRet) += awBuf;
		(*pRet) += L" ";

		iQtyKeys++;
	}

	if ( 0 == iQtyKeys )
		pRet->erase();

	else
		pRet->trim_right_space();
}
Beispiel #14
0
/*
 * GetCurrentGroupName:  Fill in group_name with name of currently selected
 *   group in group list box and return True, if a group is selected.
 *   Otherwise return False.
 */
Bool GetCurrentGroupName(HWND hDlg, char *group_name)
{
   int index;
   HWND hCombo;

   hCombo = GetDlgItem(hDlg, IDC_GROUPS);
   index = ComboBox_GetCurSel(hCombo);
   
   if (index == CB_ERR)
     return False;
   
   ComboBox_GetText(hCombo, group_name, MAX_GROUPNAME);
   return True;
}
Beispiel #15
0
//================================================================================================
//--{ START TIMER }-----//-----------------+++--> Called When "OK" Button is Clicked (Start Timer):
void OnOK(HWND hDlg)   //-------------------------------------------------------------------+++-->
{
	HWND timer_cb = GetDlgItem(hDlg, IDC_TIMERNAME);
	int idx, count, seconds, minutes, hours, days;
	char subkey[TNY_BUFF];
	size_t offset;
	char name[GEN_BUFF];
	char fname[MAX_PATH];
	
	offset=wsprintf(subkey,"%s\\Timer",g_szTimersSubKey);
	ComboBox_GetText(timer_cb, name, sizeof(name));
	
	count = ComboBox_GetCount(timer_cb);
	count -=1; // Skip the Last One Because It's the New Timer Dummy Item
	
	for(idx=0; idx<count; ++idx) {
		timeropt_t* pts;
		pts = (timeropt_t*)ComboBox_GetItemData(timer_cb, idx);
		if(!strcmp(pts->name, name)) {
			pts->bActive = TRUE;
			break;
		}
	}
	wsprintf(subkey+offset,"%d",idx+1);
	api.SetStr(subkey, "Name", name);
	seconds = GetDlgItemInt(hDlg, IDC_TIMERSECOND, 0, 0);
	minutes = GetDlgItemInt(hDlg, IDC_TIMERMINUTE, 0, 0);
	hours   = GetDlgItemInt(hDlg, IDC_TIMERHOUR,   0, 0);
	days    = GetDlgItemInt(hDlg, IDC_TIMERDAYS,   0, 0);
	if(seconds>59) for(; seconds>59; seconds-=60,++minutes);
	if(minutes>59) for(; minutes>59; minutes-=60,++hours);
	if(hours>23) for(; hours>23; hours-=24,++days);
	if(days>42) days=7;
	api.SetInt(subkey, "Seconds", seconds);
	api.SetInt(subkey, "Minutes", minutes);
	api.SetInt(subkey, "Hours",   hours);
	api.SetInt(subkey, "Days",    days);
	
	GetDlgItemText(hDlg, IDC_TIMERFILE, fname, sizeof(fname));
	api.SetStr(subkey, "File", fname);
	
	api.SetInt(subkey, "Repeat", IsDlgButtonChecked(hDlg, IDC_TIMERREPEAT));
	api.SetInt(subkey, "Blink",  IsDlgButtonChecked(hDlg, IDC_TIMERBLINK));
	api.SetInt(subkey, "Active",  TRUE);
	if(idx==count)
		api.SetInt(g_szTimersSubKey, "NumberOfTimers", idx+1);
	
	StartTimer(idx);
}
Beispiel #16
0
void
MainTabWindow::get()
{
    HpcMenuInterface &menu = HPC_MENU;
    struct HpcMenuInterface::HpcMenuPreferences &pref = HPC_PREFERENCE;

    HWND w = GetDlgItem(_window, IDC_MAIN_DIR);
    ComboBox_GetText(w, pref.dir_user_path, MAX_PATH);
    pref.dir_user = TRUE;
    w = GetDlgItem(_window, IDC_MAIN_KERNEL);
    Edit_GetText(w, pref.kernel_user_file, MAX_PATH);
    pref.kernel_user = TRUE;

    int i = ComboBox_GetCurSel(GetDlgItem(_window, IDC_MAIN_PLATFORM));
    menu.platform_set(_item_to_platid(i));

    if (_is_checked(IDC_MAIN_ROOT_WD))
        pref.rootfs = 0;
    else if (_is_checked(IDC_MAIN_ROOT_SD))
        pref.rootfs = 1;
    else if (_is_checked(IDC_MAIN_ROOT_MD))
        pref.rootfs = 2;
    else if (_is_checked(IDC_MAIN_ROOT_NFS))
        pref.rootfs = 3;

    pref.boot_ask_for_name	= _is_checked(IDC_MAIN_OPTION_A);
    pref.boot_debugger	= _is_checked(IDC_MAIN_OPTION_D);
    pref.boot_verbose	= _is_checked(IDC_MAIN_OPTION_V);
    pref.boot_single_user	= _is_checked(IDC_MAIN_OPTION_S);
    pref.boot_serial	= _is_checked(IDC_MAIN_OPTION_H);
    Edit_GetText(_edit_md_root, pref.rootfs_file, MAX_PATH);

    TCHAR tmpbuf[8];
    ComboBox_GetText(_combobox_serial_speed, tmpbuf, 8);
    pref.serial_speed = _wtoi(tmpbuf);
}
Beispiel #17
0
static void OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
{
	switch (id)
	{
		case IDOK:
		{
            int index;
            HWND hwndCombo = GetDlgItem (hwnd, IDC_COMBOPAGESIZE);

			LPTABLEPARAMS lptbl = GetDlgProp(hwnd);
         HWND hwndLocations = GetDlgItem(hwnd, IDC_LOCATIONS);
         HWND hwndSecOption = GetDlgItem(hwnd, IDC_SEC_AUDIT_OPTION);
         HWND hwndLabel = GetDlgItem(hwnd, IDC_LABEL_GRAN);
         HWND hwndKey = GetDlgItem(hwnd, IDC_SEC_AUDIT_KEY);
         int nIdx;

         FreeObjectList (lptbl->lpLocations);  // Vut adds
         lptbl->lpLocations = NULL;            // Vut adds
         lptbl->lpLocations = CreateList4CheckedObjects (hwndLocations);
         lptbl->bJournaling = IsDlgButtonChecked(hwnd, IDC_JOURNALING);
         lptbl->bDuplicates = IsDlgButtonChecked(hwnd, IDC_DUPLICATES);
         index = ComboBox_GetCurSel (hwndCombo);
         if (index != -1)
         {
                lptbl->uPage_size = (LONG)ComboBox_GetItemData (hwndCombo, index);
                if (lptbl->uPage_size == 2048L)
                    lptbl->uPage_size = 0L;
         }
         ComboBox_GetText(hwndKey, lptbl->szSecAuditKey, sizeof(lptbl->szSecAuditKey));

			nIdx = ComboBox_GetCurSel(hwndSecOption);
			lptbl->nSecAudit = (int)ComboBox_GetItemData(hwndSecOption, nIdx);

			nIdx = ComboBox_GetCurSel(hwndLabel);
			lptbl->nLabelGran = (int)ComboBox_GetItemData(hwndLabel, nIdx);

			EndDialog(hwnd, 1);
			break;
		}

		case IDCANCEL:
			EndDialog(hwnd, 0);
			break;
	}
}
Beispiel #18
0
//================================================================================================
//-----------------------//-----------------------------+++--> Delete One of the Configured Timers:
void OnDel(HWND hDlg)   //------------------------------------------------------------------+++-->
{
	HWND timer_cb = GetDlgItem(hDlg, IDC_TIMERNAME);
	char name[TNY_BUFF];
	char subkey[TNY_BUFF];
	size_t offset;
	int idx, idx2, count;
	
	offset=wsprintf(subkey, "%s\\Timer", g_szTimersSubKey);
	ComboBox_GetText(timer_cb, name, sizeof(name));
	count = ComboBox_GetCount(timer_cb) -1;
	for(idx=0; idx<count; ++idx) {
		timeropt_t* pts = (timeropt_t*)ComboBox_GetItemData(timer_cb, idx);
		if(!strcmp(name,pts->name)){
			break;
		}
	}
	if(idx==count) return;
	StopTimer(idx);
	
	for(idx2=idx+1; idx2<count; ++idx2) {
		timeropt_t* pts;
		pts = (timeropt_t*)ComboBox_GetItemData(timer_cb, idx2);
		wsprintf(subkey+offset, "%d", idx2); // we're 1 behind, as needed
		api.SetStr(subkey, "Name",		pts->name);
		api.SetInt(subkey, "Seconds",	pts->second);
		api.SetInt(subkey, "Minutes",	pts->minute);
		api.SetInt(subkey, "Hours",	pts->hour);
		api.SetInt(subkey, "Days",	pts->day);
		api.SetStr(subkey, "File",		pts->fname);
		api.SetInt(subkey, "Repeat",	pts->bRepeat);
		api.SetInt(subkey, "Blink",	pts->bBlink);
		api.SetInt(subkey, "Active",	pts->bActive);
	}
	wsprintf(subkey+offset, "%d", count);
	api.DelKey(subkey);
	api.SetInt(g_szTimersSubKey, "NumberOfTimers", --count);
	free((void*)ComboBox_GetItemData(timer_cb,idx));
	ComboBox_DeleteString(timer_cb,idx);
	
	ComboBox_SetCurSel(timer_cb, (idx>0)?(idx-1):idx);
	OnTimerName(hDlg);
	PostMessage(hDlg, WM_NEXTDLGCTL, 1, FALSE);
}
Beispiel #19
0
/*------------------------------------------------
  Apply
--------------------------------------------------*/
void OnApply(HWND hDlg,BOOL preview)
{
	const wchar_t* section = (preview ? L"Preview" : L"Clock");
	wchar_t tmp[LF_FACESIZE];
	HWND fore_cb = GetDlgItem(hDlg, IDC_COLFORE);
	HWND back_cb = GetDlgItem(hDlg, IDC_COLBACK);
	HWND font_cb = GetDlgItem(hDlg, IDC_FONT);
	HWND size_cb = GetDlgItem(hDlg, IDC_FONTSIZE);
	int sel;
	
	api.SetInt(section, L"ForeColor", ColorBox_GetColorRaw(fore_cb));
	api.SetInt(section, L"BackColor", ColorBox_GetColorRaw(back_cb));
	
	ComboBox_GetLBText(font_cb, ComboBox_GetCurSel(font_cb), tmp);
	api.SetStr(section, L"Font", tmp);
	
	sel = ComboBox_GetCurSel(size_cb);
	if(sel == -1)
		ComboBox_GetText(size_cb, tmp, _countof(tmp));
	else
		ComboBox_GetLBText(size_cb, sel, tmp);
	api.SetInt(section, L"FontSize", _wtoi(tmp));
	
	api.SetInt(section, L"Bold",   IsDlgButtonChecked(hDlg, IDC_BOLD));
	api.SetInt(section, L"Italic", IsDlgButtonChecked(hDlg, IDC_ITALIC));
	
	api.SetInt(section, L"FontQuality", ComboBox_GetCurSel(GetDlgItem(hDlg,IDC_FONTQUAL)));
	
	api.SetInt(section, L"ClockHeight", (int)SendDlgItemMessage(hDlg,IDC_SPINCHEIGHT,UDM_GETPOS32,0,0));
	api.SetInt(section, L"ClockWidth", (int)SendDlgItemMessage(hDlg,IDC_SPINCWIDTH,UDM_GETPOS32,0,0));
	api.SetInt(section, L"LineHeight", (int)SendDlgItemMessage(hDlg,IDC_SPINLHEIGHT,UDM_GETPOS32,0,0));
	api.SetInt(section, L"VertPos", (int)SendDlgItemMessage(hDlg,IDC_SPINVPOS,UDM_GETPOS32,0,0));
	api.SetInt(section, L"HorizPos", (int)SendDlgItemMessage(hDlg,IDC_SPINHPOS,UDM_GETPOS32,0,0));
	api.SetInt(section, L"Angle", (int)SendDlgItemMessage(hDlg,IDC_SPINANGLE,UDM_GETPOS32,0,0));
	
	if(!preview){
		api.SetInt(L"Taskbar", L"AlphaTaskbar", (int)SendDlgItemMessage(hDlg,IDC_SPINALPHA,UDM_GETPOS32,0,0));
		api.DelKey(L"Preview");
		m_transition = 0;
	}else
		m_transition = 1;
}
Beispiel #20
0
//-----------------------------------------------------------------------------
// Name: SaveOptions
// Object: save user interface options into pOptions object
// Parameters :
//     in  : 
//     out :
//     return : 
//-----------------------------------------------------------------------------
BOOL CFilters::SaveOptions()
{

    this->pOptions->FilterApplyToCurrentEntries=
        (IsDlgButtonChecked(this->hWndDialog,IDC_CHECK_FILTERS_APPLY_TO_CURRENT_RESULTS)==BST_CHECKED);

    if (!this->GetValue(IDC_EDIT_FILTERS_MIN_SIZE,&this->pOptions->FilterMinSize))
        return FALSE;

    if (!this->GetValue(IDC_EDIT_FILTERS_MAX_SIZE,&this->pOptions->FilterMaxSize))
        return FALSE;

    if (!this->GetValue(IDC_EDIT_FILTERS_MIN_ADDRESS,&this->pOptions->FilterMinAddress))
        return FALSE;

    if (!this->GetValue(IDC_EDIT_FILTERS_MAX_ADDRESS,&this->pOptions->FilterMaxAddress))
        return FALSE;

    TCHAR psz[MAX_PATH];
    HWND hWndComboFlags=GetDlgItem(this->hWndDialog,IDC_COMBO_FILTERS_FLAGS);
    ComboBox_GetText(hWndComboFlags,psz,MAX_PATH);

    if (_tcscmp(psz,HEAP_WALKER_MEMORY_FLAG_ALL)==0)
    {
        this->pOptions->FilterMemoryFlags=COptions::FILTERMEMORYFLAGS_ALL;
    }
    else if (_tcscmp(psz,HEAP_WALKER_MEMORY_FLAG_FIXED)==0)
    {
        this->pOptions->FilterMemoryFlags=COptions::FILTERMEMORYFLAGS_FIXED;
    }
    else if (_tcscmp(psz,HEAP_WALKER_MEMORY_FLAG_MOVABLE)==0)
    {
        this->pOptions->FilterMemoryFlags=COptions::FILTERMEMORYFLAGS_MOVABLE;
    }
    else if (_tcscmp(psz,HEAP_WALKER_MEMORY_FLAG_FREE)==0)
    {
        this->pOptions->FilterMemoryFlags=COptions::FILTERMEMORYFLAGS_FREE;
    }

    return TRUE;
}
Beispiel #21
0
/*------------------------------------------------
--------------------------------------------------*/
void SetComboFontSize(HWND hDlg, BOOL bInit)
{
	HDC hdc;
	wchar_t font[LF_FACESIZE];
	DWORD size;
	LOGFONT lf = {0};
	HWND size_cb = GetDlgItem(hDlg, IDC_FONTSIZE);
	HWND font_cb = GetDlgItem(hDlg, IDC_FONT);
	int pos;
	
	// remember old size
	if(bInit) { // on WM_INITDIALOG
		size = api.GetInt(L"Clock", L"FontSize", 9);
		if(!size || size>100) size = 9;
	} else { // when IDC_FONT has been changed
		ComboBox_GetText(size_cb, font, _countof(font));
		size = _wtoi(font);
	}
	
	ComboBox_ResetContent(size_cb);
	
	hdc = GetDC(NULL);
	m_logpixelsy = GetDeviceCaps(hdc, LOGPIXELSY);
	
	ComboBox_GetLBText(font_cb, ComboBox_GetCurSel(font_cb), font);
	
	wcscpy(lf.lfFaceName, font);
	lf.lfCharSet = DEFAULT_CHARSET;
	EnumFontFamiliesEx(hdc, &lf, EnumSizeProcEx,
					   (LPARAM)size_cb, 0);
					   
	ReleaseDC(NULL, hdc);
	
	wsprintf(font, FMT("%d"), size);
	pos = ComboBox_FindStringExact(size_cb, -1, font);
	if(pos != LB_ERR) {
		ComboBox_SetCurSel(size_cb, pos);
		return;
	}
	ComboBox_SetText(size_cb, font);
}
Beispiel #22
0
void plMtlAnimProc::IAnimComboChanged(HWND hWnd, IParamBlock2* pb)
{
    HWND hCombo = GetDlgItem(hWnd, fAnimComboID);
    int idx = ComboBox_GetCurSel(hCombo);

    if (idx != CB_ERR)
    {
        if (ComboBox_GetItemData(hCombo, idx) == 0)
            pb->SetValue(fAnimParamID, 0, "");
        else
        {
            // Get the name of the animation and save it
            char buf[256];
            ComboBox_GetText(hCombo, buf, sizeof(buf));
            pb->SetValue(fAnimParamID, 0, buf);
        }
    }

    // Update the dependencies of this
    ILoadUser(hWnd, pb);
}
Beispiel #23
0
static void OnCommand (HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
{
    LPGROUPUSERPARAMS lpusr2grp = GetDlgProp (hwnd);

    switch (id)
    {
    case IDOK:
    {
        BOOL Success;
        HWND hwndUser = GetDlgItem (hwnd, IDC_USR2GRP_USERBOX);
        char szUser [MAXOBJECTNAME];

        ComboBox_GetText (hwndUser, szUser, sizeof (szUser));
        x_strcpy (lpusr2grp->ObjectName, szUser);

        Success = CreateObject (hwnd, lpusr2grp);

        if (!Success)
            break;
        else
            EndDialog (hwnd, TRUE);
    }
    break;


    case IDCANCEL:
        EndDialog (hwnd, FALSE);
        break;

    case IDC_USR2GRP_USERBOX:
    {
        switch (codeNotify)
        {
        case CBN_SELCHANGE:
            EnableDisableOKButton (hwnd);
        }
        break;
    }
    }
}
Beispiel #24
0
//================================================================================================
//-----------------------------//-------------------+++--> Stop & Cancel a Currently Running Timer:
void OnStopTimer(HWND hWnd)   //------------------------------------------------------------+++-->
{
	HWND timer_cb = GetDlgItem(hWnd, IDC_TIMERNAME);
	char name[GEN_BUFF];
	int idx;
	
	ComboBox_GetText(timer_cb, name, sizeof(name));
	
	for(idx=0; idx<m_timers; ++idx) {
		if(!strcmp(name, m_timer[idx].name)) {
			int id=m_timer[idx].id;
			timeropt_t* pts=(timeropt_t*)ComboBox_GetItemData(timer_cb, id);;
			
			StopTimer(id);
			pts->bActive = 0;
			
			EnableDlgItem(hWnd, IDOK, 1);
			EnableDlgItemSafeFocus(hWnd, IDCB_STOPTIMER, 0, IDOK);
			break;
		}
	}
}
Beispiel #25
0
//================================================================================================
//-----------------------------//-----+++--> Load the Data Set For Timer X When Its Name is Called:
void OnTimerName(HWND hDlg)   //------------------------------------------------------------+++-->
{
	HWND timer_cb = GetDlgItem(hDlg, IDC_TIMERNAME);
	char name[TNY_BUFF];
	int idx, count;
	
	ComboBox_GetText(timer_cb, name, sizeof(name));
	count = ComboBox_GetCount(timer_cb);
	for(idx=0; idx<count; ++idx){
		timeropt_t* pts;
		pts = (timeropt_t*)ComboBox_GetItemData(timer_cb, idx);
		if(!strcmp(name, pts->name)){
			SetDlgItemInt(hDlg, IDC_TIMERSECOND,	pts->second, 0);
			SetDlgItemInt(hDlg, IDC_TIMERMINUTE,	pts->minute, 0);
			SetDlgItemInt(hDlg, IDC_TIMERHOUR,		pts->hour,   0);
			SetDlgItemInt(hDlg, IDC_TIMERDAYS,		pts->day,    0);
			ComboBox_AddStringOnce(GetDlgItem(hDlg,IDC_TIMERFILE), pts->fname, 1);
			CheckDlgButton(hDlg, IDC_TIMERREPEAT,	pts->bRepeat);
			CheckDlgButton(hDlg, IDC_TIMERBLINK,	pts->bBlink);
			if(pts->bActive){
				EnableDlgItem(hDlg, IDCB_STOPTIMER, TRUE);
				EnableDlgItem(hDlg, IDOK, FALSE);
			}else{
				EnableDlgItem(hDlg, IDCB_STOPTIMER, FALSE);
				EnableDlgItem(hDlg, IDOK, TRUE);
			}
			break;
		}
	}
	if(idx<count-1){
		SetDlgItemText(hDlg,IDOK,"Start");
	}else{
		SetDlgItemText(hDlg,IDOK,"Create");
	}
	EnableDlgItem(hDlg, IDC_TIMERDEL, idx<count-1);
}
Beispiel #26
0
static BOOL OnInitDialog (HWND hwnd, HWND hwndFocus, LPARAM lParam)
{
   LPGRANTPARAMS lpgrant = (LPGRANTPARAMS)lParam;
   HWND    hwndDatabases = GetDlgItem (hwnd, IDC_GNREF_PROCEDURE_DATABASES);
   HWND    hwndGrantees  = GetDlgItem (hwnd, IDC_GNREF_PROCEDURE_GRANTEES);
   HWND    hwndProcedures= GetDlgItem (hwnd, IDC_GNREF_PROCEDURE_PROCEDURES);
   UCHAR   szDatabaseName[MAXOBJECTNAME];
   char    szTitle [MAX_TITLEBAR_LEN];
   char    szFormat[100];

   if (!AllocDlgProp (hwnd, lpgrant))
       return FALSE;
   //
   // force catolist.dll to load
   //
   CATOListDummy();
   if (lpgrant->ObjectType == OT_PROCEDURE)
      LoadString (hResource, (UINT)IDS_T_GNREF_PROCEDURE, szFormat, sizeof (szFormat));
   else
      LoadString (hResource, (UINT)IDS_T_GNREF_SEQUENCE, szFormat, sizeof (szFormat));

   wsprintf (
       szTitle,
       szFormat,
       GetVirtNodeName (GetCurMdiNodeHandle ()));

   SetWindowText (hwnd, szTitle);
   if (lpgrant->ObjectType == OT_PROCEDURE)
      lpHelpStack = StackObject_PUSH (lpHelpStack, StackObject_INIT ((UINT)IDD_GNREF_PROCEDURE));
   else
      lpHelpStack = StackObject_PUSH (lpHelpStack, StackObject_INIT ((UINT)ID_HELPID_GNREF_SEQUENCE));


   if (lpgrant->GranteeType == OT_GROUP)
   {
       Button_SetCheck (GetDlgItem (hwnd, IDC_GNREF_PROCEDURE_GROUP), TRUE);
       FillGrantees (hwndGrantees, lpgrant->GranteeType);
   }
   else
   if (lpgrant->GranteeType == OT_ROLE)
   {
       Button_SetCheck (GetDlgItem (hwnd, IDC_GNREF_PROCEDURE_ROLE),  TRUE);
       FillGrantees (hwndGrantees, lpgrant->GranteeType);
   }
   else
   {
       if  (x_strcmp (lpgrant->PreselectGrantee, lppublicdispstring()) == 0)
           Button_SetCheck (GetDlgItem (hwnd, IDC_GNREF_PROCEDURE_PUBLIC), TRUE);
       else
       {
           Button_SetCheck (GetDlgItem (hwnd, IDC_GNREF_PROCEDURE_USER),   TRUE);
           lpgrant->GranteeType = OT_USER;
           FillGrantees (hwndGrantees, lpgrant->GranteeType);
       }
   }

   ComboBoxFillDatabases  (hwndDatabases);
   ComboBoxSelectFirstStr (hwndDatabases);
   ComboBox_GetText (hwndDatabases, szDatabaseName, sizeof (szDatabaseName));
   x_strcpy (lpgrant->DBName, szDatabaseName);
   
   if (lpgrant->ObjectType == OT_PROCEDURE) {
      if (!CAListBoxFillProcedures (hwndProcedures, szDatabaseName))
         CAListBoxDestroyItemData (hwndProcedures);
   }
   else {
       ShowWindow( GetDlgItem (hwnd,IDC_GNREF_PROCEDURE_OPTION) ,SW_HIDE);// Hided "With grant Option" control
       LoadString (hResource, (UINT)IDS_STATIC_SEQUENCE, szFormat, sizeof (szFormat));
       SetDlgItemText(  hwnd, IDC_STATIC_GNREF_PROCEDURE, szFormat ); 

       if (!CAListBoxFillSequences (hwndProcedures, lpgrant->DBName))
           CAListBoxDestroyItemData (hwndProcedures);
   }

   if (x_strlen (lpgrant->PreselectGrantee) > 1)
      PreselectGrantee (hwndGrantees, lpgrant->PreselectGrantee);
   if (x_strlen (lpgrant->PreselectObject) > 1)
      CAListBoxSelectStringWithOwner (hwndProcedures, lpgrant->PreselectObject, lpgrant->PreselectObjectOwner);
   EnableDisableOKButton (hwnd);

   richCenterDialog(hwnd);
   return TRUE;
}
Beispiel #27
0
static void OnCommand (HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
{
   LPGRANTPARAMS lpgrant   = GetDlgProp (hwnd);
   HWND hwndDatabases      = GetDlgItem (hwnd, IDC_GNREF_PROCEDURE_DATABASES);
   HWND hwndGrantees       = GetDlgItem (hwnd, IDC_GNREF_PROCEDURE_GRANTEES);
   HWND hwndProcedures     = GetDlgItem (hwnd, IDC_GNREF_PROCEDURE_PROCEDURES);
   int  ires;

   switch (id)
   {
       case IDOK:
           if (!FillStructureFromControls (hwnd, lpgrant))
               break;
           
           ires = DBAAddObject
               (GetVirtNodeName ( GetCurMdiNodeHandle ()),
               OTLL_GRANT,
               (void *) lpgrant);

           if (ires != RES_SUCCESS)
           {
               FreeAttachedPointers (lpgrant, OTLL_GRANT);
               ErrorMessage ((UINT)IDS_E_GRANT_PROCEDURE_FAILED, ires);
               break;
           }
           else 
               EndDialog (hwnd, TRUE);
           FreeAttachedPointers (lpgrant, OTLL_GRANT);
           break;

       case IDCANCEL:
           FreeAttachedPointers (lpgrant, OTLL_GRANT);
           EndDialog (hwnd, FALSE);
           break;

       case IDC_GNREF_PROCEDURE_PROCEDURES:
       case IDC_GNREF_PROCEDURE_GRANTEES:
           EnableDisableOKButton (hwnd);
           break;

       case IDC_GNREF_PROCEDURE_USER:
           CAListBox_ResetContent (hwndGrantees);
           FillGrantees (hwndGrantees, OT_USER);
           EnableDisableOKButton (hwnd);
           break;

       case IDC_GNREF_PROCEDURE_GROUP:
           CAListBox_ResetContent (hwndGrantees);
           FillGrantees (hwndGrantees, OT_GROUP);
           EnableDisableOKButton (hwnd);
           break;

       case IDC_GNREF_PROCEDURE_ROLE:
           CAListBox_ResetContent (hwndGrantees);
           FillGrantees (hwndGrantees, OT_ROLE);
           EnableDisableOKButton (hwnd);
           break;

       case IDC_GNREF_PROCEDURE_PUBLIC:
           CAListBox_ResetContent (hwndGrantees);
           EnableDisableOKButton (hwnd);
           break;

       case IDC_GNREF_PROCEDURE_DATABASES:
       {
           char selString [MAXOBJECTNAME+1];
           if (codeNotify == CBN_SELCHANGE)
           {
               CAListBoxDestroyItemData (hwndProcedures);
               CAListBox_ResetContent   (hwndProcedures);
               ComboBox_GetText (hwndDatabases, selString, sizeof (selString));
               x_strcpy (lpgrant->DBName, selString);
               if (lpgrant->ObjectType == OT_PROCEDURE) {
                  if (!CAListBoxFillProcedures (hwndProcedures, selString))
                      CAListBoxDestroyItemData (hwndProcedures);
               }
               else {
                  if (!CAListBoxFillSequences (hwndProcedures, lpgrant->DBName))
                      CAListBoxDestroyItemData (hwndProcedures);
               }
           }
           EnableDisableOKButton (hwnd);
       }
       break;

   }
}
Beispiel #28
0
VOID
ProcessCommands(
    HWND hwnd,
    INT  id,
    HWND hwndCtl,
    UINT codeNotify)
{
    DWORD        exitCode;
    CHAR         buffer[20];
    ULONG        tid;
    ULONG        units;

    switch (id) {
        case DRV_BOX:
            if (codeNotify == CBN_KILLFOCUS) {

                //
                // Determine sector size of chosen drive.
                //

                ComboBox_GetText(GetDlgItem(hwnd,DRV_BOX),buffer, 4);
                sprintf(TestDrv,"\\\\.\\");
                strcat(TestDrv,buffer);
                TestDrv[6] = '\0';
                GetSectorSize(&SectorSize,TestDrv);

            }

            break;

        case START_BUTTON:

            if (!TestFileCreated) {

                //
                // Create gauge window.
                //

                units = GetDialogBaseUnits();

                Gauge = CreateWindow("static","",
                                 WS_CHILD | WS_VISIBLE | SS_BLACKFRAME,
                                 (INT)(10 * (units & 0xFFFF) / 4),
                                 (INT)(60 * (units >> 16) / 8),
                                 (INT)(150 *  (units & 0xFFFF) / 4),
                                 (INT)(12 * (units >> 16) / 8),
                                 hwnd,
                                 (HMENU)(26),
                                 HInst,
                                 NULL);

                GaugeId = GetDlgCtrlID(Gauge);

                TestFileParams.TestDrive = TestDrv;
                TestFileParams.TestFile  = TestFile;
                TestFileParams.Window    = hwnd;

                ThrdHandle = CreateThread (NULL,0,(LPTHREAD_START_ROUTINE)CreateTestFile, &TestFileParams,CREATE_SUSPENDED,&tid);

                //
                // Disable controls
                //

                Button_Enable(GetDlgItem(hwnd,STOP_BUTTON), TRUE);
                SetFocus(GetDlgItem(hwnd,STOP_BUTTON));
                Button_Enable(GetDlgItem(hwnd,START_BUTTON), FALSE);

                SetTimer(hwnd,TIMER_ID2,1000,(TIMERPROC)NULL);

                ResumeThread(ThrdHandle);

                sprintf(buffer,"CREATING TEST FILE");
                Static_SetText(GetDlgItem(hwnd,STATUS_TEST), buffer);

                break;
            }

            //
            // Determine the test drive.
            //

            strcpy(TestDrv,"\\\\.\\");
            ComboBox_GetText(GetDlgItem(hwnd,DRV_BOX),buffer, 4);
            strcat (TestDrv,buffer);
            TestDrv[6] = '\0';

            //
            // Determine the test case.
            //

            index = Button_GetCheck(GetDlgItem(hwnd,TEST_RAD_WRITE));
            index <<= 1;
            index |= Button_GetCheck(GetDlgItem(hwnd,VAR_RAD_RAND));

            //
            // Update the status fields
            //

            sprintf(buffer,"%Lu",BufferSize);
            Static_SetText(GetDlgItem(hwnd,STATUS_BUFFER ),buffer);
            sprintf(buffer,"%d",IoCount);
            Static_SetText(GetDlgItem(hwnd,STATUS_IOCOUNT), buffer);

            sprintf(buffer,"%s",(index >> 1) ? "Write" : "Read");
            Static_SetText(GetDlgItem(hwnd,STATUS_CASE), buffer);

            sprintf(buffer,"%s",(index & 0x1) ? "Random" : "Sequential");
            Static_SetText(GetDlgItem(hwnd,STATUS_CASE1), buffer);

            sprintf(buffer,"RUNNING");
            Static_SetText(GetDlgItem(hwnd,STATUS_TEST), buffer);

            ElapsedTime = Seconds = Minutes = Hours = Days = 0;
            SetTimer(hwnd,TIMER_ID,1000,(TIMERPROC)NULL);

            //
            // Gather parameters and launch the test.
            //

            Params.BufferSize = BufferSize;
            Params.TargetFile = TestFile;
            Params.Tcount     = NumberIOs;

            RunTest = TRUE;

            //
            // Launch the thread.
            //

            ThrdHandle = CreateThread (NULL,
                                           0,
                                           TestProc[index],
                                           &Params,
                                           CREATE_SUSPENDED,
                                           &tid
                                           );

            ResumeThread(ThrdHandle);

            //
            // Disable controls
            //

            Button_Enable(GetDlgItem(hwnd,STOP_BUTTON), TRUE);
            SetFocus(GetDlgItem(hwnd,STOP_BUTTON));
            Button_Enable(GetDlgItem(hwnd,START_BUTTON), FALSE);

            break;

        case STOP_BUTTON:

            if (!TestFileCreated) {

                //
                // Kill the test file create thread.
                //

                KillFileCreate = TRUE;

                WaitForSingleObject(ThrdHandle,INFINITE);

                //
                // Redo button enable/disable/focus
                //

                Button_Enable(GetDlgItem(hwnd,START_BUTTON), TRUE);
                Button_Enable(GetDlgItem(hwnd,STOP_BUTTON), FALSE);

                SetFocus(GetDlgItem(hwnd,START_BUTTON));

                KillTimer(hwnd, TIMER_ID2);
                KillFileCreate = FALSE;

                sprintf(buffer,"STOPPED");
                Static_SetText(GetDlgItem(hwnd,STATUS_TEST), buffer);

                DestroyWindow(Gauge);
                UpdateWindow(hwnd);

                break;
            }

            KillTimer(hwnd, TIMER_ID);

            //
            // If the thread is not running disregard it.
            //

            GetExitCodeThread(ThrdHandle,&exitCode);
            if (exitCode == STILL_ACTIVE) {

                //
                // Set flag to kill the threads.
                //

                RunTest = FALSE;

                if ((WaitForSingleObject (ThrdHandle,INFINITE)) == WAIT_FAILED) {

                    //
                    // TODO: Do something drastic.
                    //

                }
            }

            //
            // Re-enable/disable buttons
            //

            Button_Enable(GetDlgItem(hwnd,START_BUTTON), TRUE);
            Button_Enable(GetDlgItem(hwnd,STOP_BUTTON), FALSE);


            SetFocus(GetDlgItem(hwnd,START_BUTTON));

            sprintf(buffer,"STOPPED");
            Static_SetText(GetDlgItem(hwnd,STATUS_TEST), buffer);


            break;

        case QUIT_BUTTON:
        case IDCANCEL:
            EndDialog(hwnd, id);
            break;
    default:
        break;
    }
Beispiel #29
0
BOOL
InitDialog (
    HWND hwnd,
    HWND hwndFocus,
    LPARAM lParam
    )
{
    BOOLEAN Found = FALSE;
    CHAR   buffer[34];
    DWORD  bytes;
    HWND   Drives = GetDlgItem (hwnd,DRV_BOX);
    PCHAR  lp;
    UINT   i = 0,
           NoDrives = 0;

    srand(GetTickCount());
    Button_Enable(GetDlgItem(hwnd,STOP_BUTTON), FALSE);


    //
    // Get attached drives, filter out non-disk drives, and fill drive box.
    //

    bytes = GetLogicalDriveStrings(0,NULL);

    DrvStrHandle = VirtualAlloc(NULL,bytes + 1,
                                MEM_COMMIT | MEM_RESERVE,
                                PAGE_READWRITE);

    GetLogicalDriveStrings( bytes, DrvStrHandle);
    for (lp = DrvStrHandle;*lp; ) {
        if (GetDriveType(lp) == DRIVE_FIXED) {
            ComboBox_AddString(Drives,lp);
            ++NoDrives;
        }
        while(*lp++);
    }

    //
    // Check for cmd line params passed in, and set the test drive to either
    // the specified drive, or to the first in the drive list.
    //

    ComboBox_SetCurSel (Drives,0);
    if (TestDrv[4] != '\0') {
        do {
            ComboBox_GetText(GetDlgItem(hwnd,DRV_BOX),buffer,4);
            if (buffer[0] == TestDrv[4]) {
                Found = TRUE;
            } else {
                if (++i >= NoDrives) {
                    Found = TRUE;
                } else {
                    ComboBox_SetCurSel (Drives,i);
                }
            }
        } while (!Found);
        if (i >= NoDrives) {

            //
            // Couldn't find the drive, exit with a message.
            //

            LogError("Incorrect Drive Letter in command line.",1,0);
            EndDialog(hwnd,0);
            return FALSE;
        }

    } else {
        ComboBox_SetCurSel (Drives,0);
    }

    //
    // Get the sector size for the default selection.
    //
    TestDrv[4] = '\0';
    ComboBox_GetText(GetDlgItem(hwnd,DRV_BOX),buffer, 4);
    strcat (TestDrv,buffer);
    TestDrv[6] = '\0';
    GetSectorSize(&SectorSize,TestDrv);

    //
    // If index is 0, use defaults, otherwise set the test according to
    // the cmdline passes in.
    //

    Button_SetCheck(GetDlgItem(hwnd,TEST_RAD_READ + (index >> 1)), TRUE);
    Button_SetCheck(GetDlgItem(hwnd,VAR_RAD_SEQ + (index & 0x01)),TRUE);

    //
    // Set buffer size.
    //

    if (BufferSize == 0) {

        BufferSize = 65536;
        NumberIOs = FILE_SIZE / BufferSize;

    } else {

        //
        // Verify that buffersize is a multiple of sector size, if not adjust it.
        //

        if (BufferSize % SectorSize) {
            BufferSize &= ~(SectorSize - 1);
        }

        NumberIOs = FILE_SIZE / BufferSize;

        //
        // Cmd line was present and has been used to config. the test. Send a message
        // to the start button to get things rolling.
        //

        SendMessage(hwnd,WM_COMMAND,(BN_CLICKED << 16) | START_BUTTON,(LPARAM)GetDlgItem(hwnd,START_BUTTON));
    }
    _ultoa(BufferSize,buffer,10);
    Static_SetText(GetDlgItem(hwnd,BUFFER_TEXT),buffer);

    return(TRUE);
}
Beispiel #30
0
static BOOL FillStructureFromControls (HWND hwnd, LPSECURITYALARMPARAMS lpsecurity)
{
   char buf        [MAXOBJECTNAME];
//   char buffowner  [MAXOBJECTNAME];
//   char bufftable  [MAXOBJECTNAME];
   char szDBE      [MAXOBJECTNAME];
   char szName     [MAXOBJECTNAME];

   LPCHECKEDOBJECTS  obj;
   LPCHECKEDOBJECTS  list = NULL;
   int i, max_database_number, checked;

   HWND hwndDB         = GetDlgItem (hwnd, IDC_SALARM_ONTABLE);
   HWND hwndUsers      = GetDlgItem (hwnd, IDC_SALARM_BYUSER );
   HWND hwndSuccess    = GetDlgItem (hwnd, IDC_SALARM_SUCCESS);
   HWND hwndFailure    = GetDlgItem (hwnd, IDC_SALARM_FAILURE);
   HWND hwndSelect     = GetDlgItem (hwnd, IDC_SALARM_SELECT);
   HWND hwndDelete     = GetDlgItem (hwnd, IDC_SALARM_DELETE);
   HWND hwndInsert     = GetDlgItem (hwnd, IDC_SALARM_INSERT);
   HWND hwndUpdate     = GetDlgItem (hwnd, IDC_SALARM_UPDATE);
   HWND hwndConnect    = GetDlgItem (hwnd, IDC_SALARM_CONNECT);
   HWND hwndDisconnect = GetDlgItem (hwnd, IDC_SALARM_DISCONNECT);
   HWND hwndDBE        = GetDlgItem (hwnd, IDC_SALARM_DBEVENT);
   HWND hwndDBEText    = GetDlgItem (hwnd, IDC_SALARM_DBEVENT_TEXT);
   HWND hwndName       = GetDlgItem (hwnd, IDC_SALARM_NAME);

   x_strcpy (lpsecurity->DBName, "iidbdb");
   ZEROINIT (szName);
   Edit_GetText (hwndName, szName, sizeof (szName));
   x_strcpy (lpsecurity->ObjectName, szName);

   lpsecurity->bsuccfail [SECALARMSUCCESS] = Button_GetCheck (hwndSuccess);
   lpsecurity->bsuccfail [SECALARMFAILURE] = Button_GetCheck (hwndFailure);
   //
   // Get selection from
   // toggle buttons (Select, Delete, Insert, Update)
   //
   lpsecurity->baccesstype [SECALARMSEL]       = Button_GetCheck (hwndSelect);
   lpsecurity->baccesstype [SECALARMDEL]       = Button_GetCheck (hwndDelete);
   lpsecurity->baccesstype [SECALARMINS]       = Button_GetCheck (hwndInsert);
   lpsecurity->baccesstype [SECALARMUPD]       = Button_GetCheck (hwndUpdate);
   lpsecurity->baccesstype [SECALARMCONNECT]   = Button_GetCheck (hwndConnect   );
   lpsecurity->baccesstype [SECALARMDISCONN]   = Button_GetCheck (hwndDisconnect);
   
   //
   // Get the names of users that have been checked and
   // insert into the list
   //
  
   if (Button_GetCheck (GetDlgItem (hwnd, IDC_SALARM_USER)))
       lpsecurity->iAuthIdType = OT_USER;
   else
   if (Button_GetCheck (GetDlgItem (hwnd, IDC_SALARM_GROUP)))
       lpsecurity->iAuthIdType = OT_GROUP;
   else
   if (Button_GetCheck (GetDlgItem (hwnd, IDC_SALARM_ROLE)))
       lpsecurity->iAuthIdType = OT_ROLE;
   else
   if (Button_GetCheck (GetDlgItem (hwnd, IDC_SALARM_PUBLIC)))
       lpsecurity->iAuthIdType = OT_PUBLIC;
   else
       lpsecurity->iAuthIdType = OT_USER;

   max_database_number = CAListBox_GetCount (hwndUsers);
   
   
   if (Button_GetCheck (GetDlgItem (hwnd, IDC_SALARM_PUBLIC)))
   {
       obj = ESL_AllocMem (sizeof (CHECKEDOBJECTS));
       if (!obj)
       {
           FreeAttachedPointers (lpsecurity, OTLL_SECURITYALARM);
           ErrorMessage   ((UINT)IDS_E_CANNOT_ALLOCATE_MEMORY, RES_ERR);
           return FALSE;
       }
       else
       {
           x_strcpy (obj->dbname, lppublicsysstring());
           obj->bchecked = TRUE;
           list = AddCheckedObject (list, obj);
       }
   }

   for (i = 0; i < max_database_number; i++)
   {
       checked = CAListBox_GetSel (hwndUsers, i);
       if (checked == 1)
       {
           CAListBox_GetText (hwndUsers, i, buf);
           obj = ESL_AllocMem (sizeof (CHECKEDOBJECTS));
           if (!obj)
           {
               FreeAttachedPointers (lpsecurity, OTLL_SECURITYALARM);
               ErrorMessage   ((UINT)IDS_E_CANNOT_ALLOCATE_MEMORY, RES_ERR);
               return FALSE;
           }
           else
           {
               if (x_strcmp (buf, lppublicdispstring()) == 0)
                   x_strcpy (obj->dbname, lppublicsysstring());
               else
                   x_strcpy (obj->dbname, QuoteIfNeeded(buf));
               obj->bchecked = TRUE;
               list = AddCheckedObject (list, obj);
           }
       }
   }
   lpsecurity->lpfirstUser = list;

   //
   // Get the names of Database that have been checked and
   // insert into the list
   //
   
   max_database_number = CAListBox_GetCount (hwndDB);
   list = NULL;
   
   for (i=0; i<max_database_number; i++)
   {
       checked = CAListBox_GetSel (hwndDB, i);
       if (checked)
       {
           CAListBox_GetText (hwndDB, i, buf);

           obj = ESL_AllocMem (sizeof (CHECKEDOBJECTS));
           if (!obj)
           {
               FreeAttachedPointers (lpsecurity, OTLL_SECURITYALARM);
               ErrorMessage   ((UINT)IDS_E_CANNOT_ALLOCATE_MEMORY, RES_ERR);
               return FALSE;
           }
           else
           {
               x_strcpy (obj->dbname, buf);
               obj->bchecked = TRUE;
               list = AddCheckedObject (list, obj);
           }
       }
   }
   lpsecurity->lpfirstTable = list;

   ComboBox_GetText (hwndDBE, szDBE, sizeof (szDBE));
   if ((x_strlen (szDBE) > 0 ) && (x_strcmp (szDBE, szSecurityDBEvent) != 0))
   {
       char szOwner [MAXOBJECTNAME];
       char szAll   [MAXOBJECTNAME];
       int  len, nSel;

       nSel = ComboBox_GetCurSel (hwndDBE);
       x_strcpy (szOwner, (char *) ComboBox_GetItemData (hwndDBE, nSel));
       StringWithOwner  (szDBE, szOwner, szAll);
       x_strcpy (lpsecurity->DBEvent, szAll);
       len = Edit_GetTextLength (hwndDBEText);
       if (len > 0)
       {
           lpsecurity->lpDBEventText = ESL_AllocMem ((len*sizeof(TCHAR)) + sizeof(TCHAR));
           if (lpsecurity->lpDBEventText)
           {
             Edit_GetText (hwndDBEText, lpsecurity->lpDBEventText, len+1); // Emb 26/06/97: +1 was missing --> lost character
             if (EscapedSimpleQuote(&lpsecurity->lpDBEventText) == RES_ERR) {
               FreeAttachedPointers (lpsecurity, OTLL_SECURITYALARM);
               ErrorMessage   ((UINT)IDS_E_CANNOT_ALLOCATE_MEMORY, RES_ERR);
               return FALSE;
             }
           }
           else
           {
               FreeAttachedPointers (lpsecurity, OTLL_SECURITYALARM);
               ErrorMessage   ((UINT)IDS_E_CANNOT_ALLOCATE_MEMORY, RES_ERR);
               return FALSE;
           }
       }
       lpsecurity->bDBEvent = TRUE;
   }
   else if (lpsecurity->lpDBEventText)
   {
       ESL_FreeMem (lpsecurity->lpDBEventText);
       lpsecurity->lpDBEventText = NULL;
   }

   return TRUE;
}