<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Array zurückgeben]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich kämpfe hier mit nem Problem, dass für euch wahrscheinlich ein Klacks ist, aber ich bin ein richtiger newbie in Sachen c++</p>
<p>Folgendes:<br />
Ich hab ein MFC-Programm, dass von mir ein neues Feature bekommt:<br />
Einen POP3-Mailchecker.<br />
Nun soll der User den Intervall einstellen können - dafür bekommt er die chance diese auch festzulegen.</p>
<p>Das funzt so:</p>
<p>Ich überprüfe ob die Datei mailchecker.ini da ist und ob einer der Werte kleiner 5 ist (ich will nicht, dass einer weniger als 5 MInuten einstellen kann (weil: IMHO unsinn).</p>
<pre><code class="language-cpp">void CPreferences::CheckMailIntervalFile(){
	if (!PathFileExists(configdir+&quot;mailchecker.ini&quot;)){
	theApp.glob_prefs-&gt;CreateMailIntervalFile();
	}
	if (PathFileExists(configdir+&quot;mailchecker.ini&quot;)){
		CIni ini;
		int strVar;
		int strCounter;
			strCounter = 0;
		for (int i = 0; i &lt; 10; i++){
			strVar = ini.GetInt(&quot;Interval%i&quot;);
			if (strVar &lt; 5){
			strCounter = strCounter + 1;
			}
			if (strCounter &gt; 0){
			theApp.glob_prefs-&gt;CreateMailIntervalFile();
			}
		}
	}
}
</code></pre>
<p>Mal völlig egal, ob das schneller code ist, oder nicht (sicher nicht *g*), habe ich ja die Sicherung eingebaut, bei der er die Datei anlegen soll, wenn sie nicht vorhanden ist:</p>
<pre><code class="language-cpp">// Mailchecker----&gt;
void CPreferences::CreateMailIntervalFile(){
	CString mailinf;
	mailinf.Format(&quot;%smailchecker.ini&quot;,configdir);
	CIni ini(mailinf, &quot;Mailchecker-Intervals&quot; );
	remove (mailinf);
			ini.WriteInt(&quot;Interval0&quot;,5);
			ini.WriteInt(&quot;Interval1&quot;,10);
			ini.WriteInt(&quot;Interval2&quot;,15);
			ini.WriteInt(&quot;Interval3&quot;,20);
			ini.WriteInt(&quot;Interval4&quot;,30);
			ini.WriteInt(&quot;Interval5&quot;,45);
			ini.WriteInt(&quot;Interval6&quot;,60);
			ini.WriteInt(&quot;Interval7&quot;,75);
			ini.WriteInt(&quot;Interval8&quot;,90);
			ini.WriteInt(&quot;Interval9&quot;,120);
}
</code></pre>
<p>Diese Werte sind die Standard-Werte (in Minuten sozusagen).</p>
<p>Nun das laden der Daten aus der mailchecker.ini:</p>
<pre><code class="language-cpp">void CPreferences::LoadMailIntervalFile(){
	if (!PathFileExists(configdir+&quot;mailchecker.ini&quot;)){
	theApp.glob_prefs-&gt;CreateMailIntervalFile();
	}
	if (PathFileExists(configdir+&quot;mailchecker.ini&quot;)){
		CIni ini;
		int strVar[10];
		for (int i = 0; i &lt; 10; i++){
			strVar[10] = ini.GetInt(&quot;Interval%i&quot;);
		}
//		return strVar[10];
	}
}
</code></pre>
<p>Aber ich bekomme es einfach nicht hin, dass die</p>
<pre><code class="language-cpp">LoadMailIntervalFile
</code></pre>
<p>das Array zurückgibt.</p>
<p>Ich hab schon diverse Modifikationen versucht, etwa in der Art:</p>
<pre><code class="language-cpp">void CPreferences::LoadMailIntervalFile(unit8&amp; strArray[10]) const
{
...
}
</code></pre>
<p>Aber leider funzt das nicht. Ich brauche das Array um eine Combo-Box mit den Werten aus der mailchecker.ini zu füllen.<br />
Ich stelle mir halt vor, dass ich nen Aufruf mache, der ungefähr so aussieht:</p>
<pre><code class="language-cpp">void CPPgMailchecker::LoadSettings(void)
{
	for(int i = 0; i &lt; 10; i++)
if(m_MailReqInterval.GetItemData(i) == theApp.glob_prefs-&gt;LoadMailIntervalFile(){
m_MailReqInterv.GetItemData(i)
m_MailReqInterv.SetCurSel(i);
// usw
}
</code></pre>
<p>Jemand nen Tipp?<br />
Und bitte beim Antworten nicht ausschließlich Fachtermini benutzen - ich bin halt wirklich Anfänger und kann mit der Funktionsweise von Iteratoren etc noch nix anfangen.<br />
Danke für die Antworten</p>
<p>Gruß<br />
André</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/45305/array-zurückgeben</link><generator>RSS for Node</generator><lastBuildDate>Sun, 26 Apr 2026 00:58:35 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/45305.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 08 Aug 2003 21:12:33 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Array zurückgeben on Fri, 08 Aug 2003 21:12:33 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich kämpfe hier mit nem Problem, dass für euch wahrscheinlich ein Klacks ist, aber ich bin ein richtiger newbie in Sachen c++</p>
<p>Folgendes:<br />
Ich hab ein MFC-Programm, dass von mir ein neues Feature bekommt:<br />
Einen POP3-Mailchecker.<br />
Nun soll der User den Intervall einstellen können - dafür bekommt er die chance diese auch festzulegen.</p>
<p>Das funzt so:</p>
<p>Ich überprüfe ob die Datei mailchecker.ini da ist und ob einer der Werte kleiner 5 ist (ich will nicht, dass einer weniger als 5 MInuten einstellen kann (weil: IMHO unsinn).</p>
<pre><code class="language-cpp">void CPreferences::CheckMailIntervalFile(){
	if (!PathFileExists(configdir+&quot;mailchecker.ini&quot;)){
	theApp.glob_prefs-&gt;CreateMailIntervalFile();
	}
	if (PathFileExists(configdir+&quot;mailchecker.ini&quot;)){
		CIni ini;
		int strVar;
		int strCounter;
			strCounter = 0;
		for (int i = 0; i &lt; 10; i++){
			strVar = ini.GetInt(&quot;Interval%i&quot;);
			if (strVar &lt; 5){
			strCounter = strCounter + 1;
			}
			if (strCounter &gt; 0){
			theApp.glob_prefs-&gt;CreateMailIntervalFile();
			}
		}
	}
}
</code></pre>
<p>Mal völlig egal, ob das schneller code ist, oder nicht (sicher nicht *g*), habe ich ja die Sicherung eingebaut, bei der er die Datei anlegen soll, wenn sie nicht vorhanden ist:</p>
<pre><code class="language-cpp">// Mailchecker----&gt;
void CPreferences::CreateMailIntervalFile(){
	CString mailinf;
	mailinf.Format(&quot;%smailchecker.ini&quot;,configdir);
	CIni ini(mailinf, &quot;Mailchecker-Intervals&quot; );
	remove (mailinf);
			ini.WriteInt(&quot;Interval0&quot;,5);
			ini.WriteInt(&quot;Interval1&quot;,10);
			ini.WriteInt(&quot;Interval2&quot;,15);
			ini.WriteInt(&quot;Interval3&quot;,20);
			ini.WriteInt(&quot;Interval4&quot;,30);
			ini.WriteInt(&quot;Interval5&quot;,45);
			ini.WriteInt(&quot;Interval6&quot;,60);
			ini.WriteInt(&quot;Interval7&quot;,75);
			ini.WriteInt(&quot;Interval8&quot;,90);
			ini.WriteInt(&quot;Interval9&quot;,120);
}
</code></pre>
<p>Diese Werte sind die Standard-Werte (in Minuten sozusagen).</p>
<p>Nun das laden der Daten aus der mailchecker.ini:</p>
<pre><code class="language-cpp">void CPreferences::LoadMailIntervalFile(){
	if (!PathFileExists(configdir+&quot;mailchecker.ini&quot;)){
	theApp.glob_prefs-&gt;CreateMailIntervalFile();
	}
	if (PathFileExists(configdir+&quot;mailchecker.ini&quot;)){
		CIni ini;
		int strVar[10];
		for (int i = 0; i &lt; 10; i++){
			strVar[10] = ini.GetInt(&quot;Interval%i&quot;);
		}
//		return strVar[10];
	}
}
</code></pre>
<p>Aber ich bekomme es einfach nicht hin, dass die</p>
<pre><code class="language-cpp">LoadMailIntervalFile
</code></pre>
<p>das Array zurückgibt.</p>
<p>Ich hab schon diverse Modifikationen versucht, etwa in der Art:</p>
<pre><code class="language-cpp">void CPreferences::LoadMailIntervalFile(unit8&amp; strArray[10]) const
{
...
}
</code></pre>
<p>Aber leider funzt das nicht. Ich brauche das Array um eine Combo-Box mit den Werten aus der mailchecker.ini zu füllen.<br />
Ich stelle mir halt vor, dass ich nen Aufruf mache, der ungefähr so aussieht:</p>
<pre><code class="language-cpp">void CPPgMailchecker::LoadSettings(void)
{
	for(int i = 0; i &lt; 10; i++)
if(m_MailReqInterval.GetItemData(i) == theApp.glob_prefs-&gt;LoadMailIntervalFile(){
m_MailReqInterv.GetItemData(i)
m_MailReqInterv.SetCurSel(i);
// usw
}
</code></pre>
<p>Jemand nen Tipp?<br />
Und bitte beim Antworten nicht ausschließlich Fachtermini benutzen - ich bin halt wirklich Anfänger und kann mit der Funktionsweise von Iteratoren etc noch nix anfangen.<br />
Danke für die Antworten</p>
<p>Gruß<br />
André</p>
]]></description><link>https://www.c-plusplus.net/forum/post/327524</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/327524</guid><dc:creator><![CDATA[_André_]]></dc:creator><pubDate>Fri, 08 Aug 2003 21:12:33 GMT</pubDate></item><item><title><![CDATA[Reply to Array zurückgeben on Fri, 08 Aug 2003 21:58:00 GMT]]></title><description><![CDATA[<p>eine moeglichkeit waere es das array in der funktion als<br />
static zu deklarieren:</p>
<pre><code class="language-cpp">int* CPreferences::LoadMailIntervalFile(){ 
    if (!PathFileExists(configdir+&quot;mailchecker.ini&quot;)){ 
    theApp.glob_prefs-&gt;CreateMailIntervalFile(); 
    } 
    if (PathFileExists(configdir+&quot;mailchecker.ini&quot;)){ 
        CIni ini; 
        static int strVar[10]; 
        for (int i = 0; i &lt; 10; i++){ 
            strVar[10] = ini.GetInt(&quot;Interval%i&quot;); 
        } 
        return strVar[10]; 
    } 
}
</code></pre>
<p>oder:</p>
<pre><code class="language-cpp">/* strVar wird in der funktion veraendert. 
 */
void CPreferences::LoadMailIntervalFile( int* strVar, size_t arraygroesse ){ 
    if (!PathFileExists(configdir+&quot;mailchecker.ini&quot;)){ 
    theApp.glob_prefs-&gt;CreateMailIntervalFile(); 
    } 
    if (PathFileExists(configdir+&quot;mailchecker.ini&quot;)){ 
        CIni ini; 
        for (int i = 0; i &lt; arraygroesse ; i++){ 
            strVar[i] = ini.GetInt(&quot;Interval%i&quot;); 
        } 
    } 
}
</code></pre>
<p>wobei ich die 2. loesung sauberer finde.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/327554</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/327554</guid><dc:creator><![CDATA[entelechie]]></dc:creator><pubDate>Fri, 08 Aug 2003 21:58:00 GMT</pubDate></item><item><title><![CDATA[Reply to Array zurückgeben on Fri, 08 Aug 2003 23:06:23 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>erstmal vielen Dank für Deine Antwort <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
<p>Aufruf</p>
<pre><code class="language-cpp">BOOL CPPgMailchecker::OnInitDialog()
{
	CPropertyPage::OnInitDialog();

	int* strVar;
	for (int i = 0; i &lt; 10; i++){
		m_MailReqInterval.SetItemData(i, theApp.glob_prefs-&gt;LoadMailIntervalFile());
	}
</code></pre>
<p>Rückgabefunktion:</p>
<pre><code class="language-cpp">int* CPreferences::LoadMailIntervalFile(){  
    if (!PathFileExists(configdir+&quot;mailchecker.ini&quot;)){  
    theApp.glob_prefs-&gt;CreateMailIntervalFile();  
    }  
    if (PathFileExists(configdir+&quot;mailchecker.ini&quot;)){  
        CIni ini;  
        static int strVar[10];  
        for (int i = 0; i &lt; 10; i++){  
            strVar[10] = ini.GetInt(&quot;Interval%i&quot;);  
        }  
        return strVar[10];  
    }  
}
</code></pre>
<p>Funzt nicht:<br />
d:\src\PPgMailchecker.cpp(94): error C2664: 'CComboBox::SetItemData' : Konvertierung des Parameters 2 von 'int *' in 'DWORD_PTR' nicht möglich<br />
(--&gt;Zeile 94 ist der Aufruf)</p>
<p>d:\src\Preferences.cpp(1490): error C2440: 'return' : 'int' kann nicht in 'int *' konvertiert werden</p>
<p>Hab hin und her probiert, die LoadMailIntervalFile ist auch korrekt angegeben (in der header-Datei), aber da will irgendwie nicht. Oder mache ich bei der Combo-Box was falsch?</p>
<p>##############################<br />
Zweite Variante:<br />
Okay - das dieser Vektor nun eine dynamische Größe hat ist sauberer - da hast Du sicher Recht.</p>
<p>Aufruf:</p>
<pre><code class="language-cpp">BOOL CPPgMailchecker::OnInitDialog()
{
	CPropertyPage::OnInitDialog();

	int* strVar;
	for (int i = 0; i &lt; 10; i++){
		m_MailReqInterval.SetItemData(i, theApp.glob_prefs-&gt;LoadMailIntervalFile(strVar, 10));
	}
</code></pre>
<p>Rückgabefunktion</p>
<pre><code class="language-cpp">void CPreferences::LoadMailIntervalFile( int* strVar, size_t arraygroesse ){  
    if (!PathFileExists(configdir+&quot;mailchecker.ini&quot;)){  
    theApp.glob_prefs-&gt;CreateMailIntervalFile();  
    }  
    if (PathFileExists(configdir+&quot;mailchecker.ini&quot;)){  
        CIni ini;  
        for (int i = 0; i &lt; arraygroesse ; i++){  
            strVar[i] = ini.GetInt(&quot;Interval%i&quot;);  
        }  
    }  
}
</code></pre>
<p>Fehler:<br />
d:\src\PPgMailchecker.cpp(94): error C2664: 'CComboBox::SetItemData' : Konvertierung des Parameters 2 von 'void' in 'DWORD_PTR' nicht möglich</p>
<p>Schade. Ich hab schon gedacht das es nun funzt.</p>
<p>Scheint ja irgendwie immer am Datentyp des Rückgabewertes zu hapern.</p>
<p>Vielleicht verdeutliche ich das nochmal:</p>
<p>In der Combo-Box sollen die Int´s aus der ini-Datei angezeigt werden (also nur die Zahlen) - daher müssen die auch in das Array (oder Vektor - wie ihr wollt). Als Index sollen einfach Werte von 0 bis 9 verwendet werden. Was für einen Datentyp brauche ich denn da? Ich dachte, einen Vektor erzeugt man so:</p>
<pre><code class="language-cpp">int strVektor[n]
</code></pre>
<p>Was ist denn das dann mit int*<br />
Ist das ein Datentyp oder ein Zeiger?</p>
<p>Naja - hab ja gesagt, dass ich ein Newbie bin</p>
<p>Gruß</p>
]]></description><link>https://www.c-plusplus.net/forum/post/327579</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/327579</guid><dc:creator><![CDATA[_André_]]></dc:creator><pubDate>Fri, 08 Aug 2003 23:06:23 GMT</pubDate></item><item><title><![CDATA[Reply to Array zurückgeben on Sat, 09 Aug 2003 07:18:23 GMT]]></title><description><![CDATA[<p>Hi!<br />
LoadMailIntervalFile hat den Rückgabewert int oder void<br />
Die MSDN sagt:</p>
<pre><code class="language-cpp">int SetItemData(
   int nIndex,
   DWORD_PTR dwItemData 
);
</code></pre>
<p>Ein Bsp.</p>
<pre><code class="language-cpp">m_csCodeOneStr = &quot;Code1&quot;;

DWORD dwCode = &amp;m_csCodeOneStr;
int nComboEntry;
nComboEntry = myCombo.AddString(&quot;Here's one&quot;);

if (nComboEntry != CB_ERR)
   myCombo.SetItemData(nComboEntry, dwCode);
</code></pre>
<p>mfg</p>
]]></description><link>https://www.c-plusplus.net/forum/post/327652</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/327652</guid><dc:creator><![CDATA[mike84]]></dc:creator><pubDate>Sat, 09 Aug 2003 07:18:23 GMT</pubDate></item><item><title><![CDATA[Reply to Array zurückgeben on Sat, 09 Aug 2003 09:14:09 GMT]]></title><description><![CDATA[<p>also das DWORD ist ein typedef fuer unsigned long<br />
(also ein alias name).<br />
du musst dein array also als:<br />
DWORD strVektor[n];<br />
deklarieren.<br />
auch in den funktionen:</p>
<pre><code class="language-cpp">void CPreferences::LoadMailIntervalFile( DWORD* strVar, size_t arraygroesse ){   
    if (!PathFileExists(configdir+&quot;mailchecker.ini&quot;)){   
    theApp.glob_prefs-&gt;CreateMailIntervalFile();   
    }   
    if (PathFileExists(configdir+&quot;mailchecker.ini&quot;)){   
        CIni ini;   
        for (size_t i = 0; i &lt; arraygroesse ; i++){ // fuer das i auch size_t
            strVar[i] = ini.GetInt(&quot;Interval%i&quot;);   
        }   
    }   
}
das size_t ist auch ein typedef fuer einen unsigned int (schau mal in die
hilfe rein):
und dann:
BOOL CPPgMailchecker::OnInitDialog() 
{ 
    CPropertyPage::OnInitDialog(); 

    DWORD strVar[10]; 
    for (int i = 0; i &lt; 10; i++){ 
        theApp.glob_prefs-&gt;LoadMailIntervalFile(strVar, 10); 
        m_MailReqInterval.SetItemData(i, strVar );
    }
----

oder:
DWORD* CPreferences::LoadMailIntervalFile(){  
    if (!PathFileExists(configdir+&quot;mailchecker.ini&quot;)){  
    theApp.glob_prefs-&gt;CreateMailIntervalFile();  
    }  
    if (PathFileExists(configdir+&quot;mailchecker.ini&quot;)){  
        CIni ini;  
        static DWORDstrVar[10];  
        for (int i = 0; i &lt; 10; i++){  
            strVar[10] = ini.GetInt(&quot;Interval%i&quot;);  
        }  
        return strVar[10];  
    }  
}
der aufruf der funktion dann so wie du es hattest.
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/327693</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/327693</guid><dc:creator><![CDATA[entelechie]]></dc:creator><pubDate>Sat, 09 Aug 2003 09:14:09 GMT</pubDate></item><item><title><![CDATA[Reply to Array zurückgeben on Sat, 09 Aug 2003 12:08:45 GMT]]></title><description><![CDATA[<p>Also - es tut mir leid, aber das klappt alles nicht.</p>
<p>Ich versuche wirklich zu verstehen, was da falsch läuft, und es entsprechend zu ändern. Doch irgendwie raffe ich das einfach nicht. Hier mal der Code der Dateien:</p>
<p>[PPgMailchecker.cpp]</p>
<pre><code class="language-cpp">// PPgMailchecker.cpp : Implementierungsdatei
//

#include &quot;stdafx.h&quot;
#include &quot;appdlg.h&quot;
#include &quot;PreferencesDlg.h&quot;

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

// CPPgMailchecker-Dialogfeld

IMPLEMENT_DYNAMIC(CPPgMailchecker, CPropertyPage)
CPPgMailchecker::CPPgMailchecker()
	: CPropertyPage(CPPgMailchecker::IDD)
{
}

CPPgMailchecker::~CPPgMailchecker()
{
}

void CPPgMailchecker::DoDataExchange(CDataExchange* pDX)
{
	CPropertyPage::DoDataExchange(pDX);
	DDX_Control(pDX, IDC_MAIL_INT, m_MailReqInterval);
}

BEGIN_MESSAGE_MAP(CPPgMailchecker, CPropertyPage)
		ON_BN_CLICKED(IDC_MAIL_USE, OnSettingsChange)
		ON_BN_CLICKED(IDC_MAIL_USE_SOU, OnSettingsChange)
		ON_BN_CLICKED(IDC_MAIL_DEAC_NOT, OnSettingsChange)
		ON_CBN_SELCHANGE(IDC_MAIL_INT, OnSettingsChange)
		ON_CBN_SELCHANGE(IDC_MAIL_SOU, OnSettingsChange)
		ON_BN_CLICKED(IDC_MAIL_BROWSE_SOU, OnBnClickedBtnMailBrowseWav)
END_MESSAGE_MAP()

void CPPgMailchecker::LoadSettings(void)
{
	CEdit* editPtr;

	/*
	for(int i = 0; i &lt; 10; i++)
if(m_MailReqInterval.GetItemData(i) == theApp.glob_prefs-&gt;GetMailSelectedInterv())
	m_MailReqInterval.SetCurSel(i);
	*/

	if(app_prefs-&gt;prefs-&gt;m_MailChkrIsActive)
		CheckDlgButton(IDC_MAIL_USE,1);
	else
		CheckDlgButton(IDC_MAIL_USE,0);

    if(app_prefs-&gt;prefs-&gt;m_MailUseSoundfile)
		CheckDlgButton(IDC_MAIL_USE_SOU,1);
	else
		CheckDlgButton(IDC_MAIL_USE_SOU,0);

    if(app_prefs-&gt;prefs-&gt;m_MailNotificationYN)
		CheckDlgButton(IDC_MAIL_DEAC_NOT,1);
	else
		CheckDlgButton(IDC_MAIL_DEAC_NOT,0);

	editPtr = (CEdit*) GetDlgItem(IDC_MAIL_SOU);
	editPtr-&gt;SetWindowText(LPCTSTR(app_prefs-&gt;prefs-&gt;m_MailNotificationSound));

}

BOOL CPPgMailchecker::OnInitDialog()  
{  
    CPropertyPage::OnInitDialog();  

    DWORD strVar[10];  
    for (int i = 0; i &lt; 10; i++){  
        theApp.glob_prefs-&gt;LoadMailIntervalFile(strVar, 10);  
        m_MailReqInterval.SetItemData(i, strVar ); 
    }

	LoadSettings();
	Localize();

	return TRUE;  // return TRUE unless you set the focus to a control
	// EXCEPTION: OCX Property Pages should return FALSE
}

void CPPgMailchecker::OnBnClickedBtnMailBrowseWav()
{
	CString strWavPath;
	GetDlgItemText(IDC_MAIL_SOU, strWavPath);
	CString buffer;
    if (DialogBrowseFile(buffer, &quot;Audio-Wav (*.wav)|*.wav||&quot;, strWavPath)){
		SetDlgItemText(IDC_MAIL_SOU, buffer);
		SetModified();
	}
}

BOOL CPPgMailchecker::OnApply()
{
    CEdit* editPTR;
	CString buffer;	
	editPTR = (CEdit*) GetDlgItem(IDC_MAIL_SOU);
	editPTR-&gt;GetWindowText(buffer);
	sprintf(app_prefs-&gt;prefs-&gt;m_MailNotificationSound,&quot;%s&quot;,buffer);
	app_prefs-&gt;prefs-&gt;m_MailChkrIsActive = IsDlgButtonChecked(IDC_MAIL_USE);
	app_prefs-&gt;prefs-&gt;m_MailUseSoundfile = IsDlgButtonChecked(IDC_MAIL_USE_SOU);
	app_prefs-&gt;prefs-&gt;m_MailNotificationYN = IsDlgButtonChecked(IDC_MAIL_DEAC_NOT);

	SetModified(FALSE);
	return CPropertyPage::OnApply();
}

void CPPgMailchecker::Localize(void)
{
	if(m_hWnd)
	{
	GetDlgItem(IDC_MAIL_USE)-&gt;SetWindowText(GetResString(IDS_MAIL_USE));	
	GetDlgItem(IDC_MAIL_USE_SOU)-&gt;SetWindowText(GetResString(IDS_MAIL_USE_SOU));	
	GetDlgItem(IDC_MAIL_DEAC_NOT)-&gt;SetWindowText(GetResString(IDS_MAIL_DEAC_NOT));
	GetDlgItem(IDC_MAIL_BROWSE_SOU)-&gt;SetWindowText(GetResString(IDS_PW_BROWSE));
	}
}

// CPPgMailchecker-Meldungshandler
</code></pre>
<p>Deren Header-Datei sieht so aus:</p>
<pre><code class="language-cpp">#pragma once

#include &quot;preferences.h&quot;
#include &quot;afxwin.h&quot;

// CPPgMailchecker-Dialogfeld

class CPPgMailchecker : public CPropertyPage
{
	DECLARE_DYNAMIC(CPPgMailchecker)

public:
	CPPgMailchecker();
	virtual ~CPPgMailchecker();

	void SetPrefs(CPreferences* in_prefs) {	app_prefs = in_prefs; }

// Dialogfelddaten
	enum { IDD = IDD_PPG_MAILCHECKER };
protected:
	CPreferences *app_prefs;

protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	DECLARE_MESSAGE_MAP()

public:
	virtual BOOL OnInitDialog();
private:
	void LoadSettings(void);
public:
	virtual BOOL OnApply();
	afx_msg void OnSettingsChange()					{ SetModified(); }
	afx_msg void OnBnClickedBtnMailBrowseWav();

protected:
	CComboBox m_MailReqInterval;

public:
	void Localize(void);
};
</code></pre>
<p>Die Load-Funktion ist in der anderen cpp-Datei:<br />
[preferences.cpp]</p>
<pre><code class="language-cpp">void CPreferences::LoadMailIntervalFile( DWORD* strVar, size_t arraygroesse ){    
    if (!PathFileExists(configdir+&quot;mailchecker.ini&quot;)){    
    theApp.glob_prefs-&gt;CreateMailIntervalFile();    
    }    
    if (PathFileExists(configdir+&quot;mailchecker.ini&quot;)){    
        CIni ini;    
        for (size_t i = 0; i &lt; arraygroesse ; i++){ // fuer das i auch size_t 
            strVar[i] = ini.GetInt(&quot;Interval%i&quot;);    
        }    
    }    
}
</code></pre>
<p>und in deren Header-Datei steht es so:<br />
[preferences.h]</p>
<pre><code class="language-cpp">public:
//......
void LoadMailIntervalFile(DWORD* strVar, size_t arraygroesse);   // Mailchecker
//.....
</code></pre>
<p>Die Varibale m_Mailchecker, die in der preferences.h public deklariert ist, soll den aktuell gespeicherten Intervall enthalten - zurückgeben erfolgt so:<br />
[preferences.cpp]</p>
<pre><code class="language-cpp">uint8 CPreferences::GetMailSelectedInterv() const
{
	return prefs-&gt;m_MailReqInterval;
}
</code></pre>
<p>speichern kommt noch - soweit komme ich ja nicht <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
<p>Fehler:<br />
d:\src\PPgMailchecker.cpp(96): error C2664: 'CComboBox::SetItemData' : Konvertierung des Parameters 2 von 'DWORD [10]' in 'DWORD_PTR' nicht möglich</p>
<p>Zeile 96 ist der Aufruf:</p>
<pre><code class="language-cpp">theApp.glob_prefs-&gt;LoadMailIntervalFile(strVar, 10);
</code></pre>
<p>in der PPgMailchecker.cpp</p>
<p>Sorry, dass ich euch so mit code vollballere, aber ich hab da schon über 15 Stunden Zeit mit verbracht, die MSDN gewälzt, aber ich habe (*zugeb*) noch nicht genug Ahnung um das alles umsetzen zu können.<br />
Aber ich versuch´s immerhin</p>
<p>Wäre es nicht besser, die Auslese-Operation der Datei (mailchecker.ini) einfach da zu machen, wo die Combo-Box erzeugt wird? Wäre zwar ein wenig &quot;hingebastelt&quot; aber hätte ich die Probleme dann immernoch?</p>
<p>Danke für eure Hilfe<br />
Gruß</p>
]]></description><link>https://www.c-plusplus.net/forum/post/327807</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/327807</guid><dc:creator><![CDATA[_André_]]></dc:creator><pubDate>Sat, 09 Aug 2003 12:08:45 GMT</pubDate></item><item><title><![CDATA[Reply to Array zurückgeben on Sat, 09 Aug 2003 18:44:57 GMT]]></title><description><![CDATA[<p>Fein - ich weiß ja das ich anstrengend bin <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
<p>Wenn ihr schon keine Lösung habt, könnt ihr mir dann wenigstens ne Informationsquelle empfehlen, in der ich das nachlesen kann? Es kann doch nicht sein, dass ich alles andere hinbekommen habe, aber ich an dieser Kleinigkeit scheitere.</p>
<p>Und nun bitte nicht <a href="http://www.microsoft.com/germany/msdn/" rel="nofollow">http://www.microsoft.com/germany/msdn/</a> - die wälze ich schon den ganzen Tag <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
<p>Danke<br />
Grüße</p>
]]></description><link>https://www.c-plusplus.net/forum/post/328046</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/328046</guid><dc:creator><![CDATA[_André_]]></dc:creator><pubDate>Sat, 09 Aug 2003 18:44:57 GMT</pubDate></item><item><title><![CDATA[Reply to Array zurückgeben on Sat, 09 Aug 2003 20:28:19 GMT]]></title><description><![CDATA[<p>hm, hast du auch an den index gedacht, is bissher untergegangen:</p>
<pre><code class="language-cpp">BOOL CPPgMailchecker::OnInitDialog()  
{  
    CPropertyPage::OnInitDialog();  

    DWORD strVar[10];  
    for (int i = 0; i &lt; 10; i++){  
        theApp.glob_prefs-&gt;LoadMailIntervalFile(strVar, 10);  
        m_MailReqInterval.SetItemData(i, strVar[i] );  // hier
// sollte das nicht gehen caste mal nach DWORD_PTR:
// m_MailReqInterval.SetItemData(i, (DWORD_PTR)strVar[i] );
    }
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/328109</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/328109</guid><dc:creator><![CDATA[entelechie]]></dc:creator><pubDate>Sat, 09 Aug 2003 20:28:19 GMT</pubDate></item><item><title><![CDATA[Reply to Array zurückgeben on Sat, 09 Aug 2003 21:09:23 GMT]]></title><description><![CDATA[<p>Ahh: Vielen Dank! Das funzt. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
<p>Ich hätte zwar schwören können, dass ich das bereits so (oder so ähnlich) verscuht hatte, aber anscheinend ja nicht.<br />
Fein - vielen Dank.</p>
<p>Leider stehen jetzt keine Werte in der ComboBox, aber immerhin gibbet keine Compile-Fehler mehr.</p>
<p>Ich gehe mal davon aus, das die Auslesen-Operation der ini-Datei korrekt läuft, also muß das woanders dran liegen. Aber vielen Dank erstmal. Hab zumindest was gelernt <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
<p>Gruß<br />
André</p>
]]></description><link>https://www.c-plusplus.net/forum/post/328134</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/328134</guid><dc:creator><![CDATA[_André_]]></dc:creator><pubDate>Sat, 09 Aug 2003 21:09:23 GMT</pubDate></item><item><title><![CDATA[Reply to Array zurückgeben on Sun, 10 Aug 2003 11:26:53 GMT]]></title><description><![CDATA[<p>Hhmm,</p>
<p>ist an der Auslese-Operation doch was falsch?</p>
<pre><code class="language-cpp">void CPreferences::LoadMailIntervalFile( DWORD* strVar, size_t arraygroesse ){    
    if (!PathFileExists(configdir+&quot;mailchecker.ini&quot;)){    
    theApp.glob_prefs-&gt;CreateMailIntervalFile();    
    }    
    if (PathFileExists(configdir+&quot;mailchecker.ini&quot;)){    
        CIni ini;   
        for (size_t i = 0; i &lt; arraygroesse ; i++){ 
            strVar[i] = ini.GetInt(&quot;Interval%i&quot;);    
        }    
    }    
}
</code></pre>
<p>Wenn die Datei folgendermaßen aufgebaut ist:</p>
<pre><code>[Mailchecker-Intervals]
Interval0=5
Interval1=10
Interval2=15
Interval3=20
Interval4=30
Interval5=45
Interval6=60
Interval7=75
Interval8=90
Interval9=120
</code></pre>
<p>Das sollte doch stimmen, oder? Wieso ist der Verkot der an die ComboBox übergeben wird dann leer?</p>
<p><img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /> Das ist auch bestimmt meine letzte Frage zu dem Thema <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
<p>Gruß</p>
]]></description><link>https://www.c-plusplus.net/forum/post/328316</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/328316</guid><dc:creator><![CDATA[_André_]]></dc:creator><pubDate>Sun, 10 Aug 2003 11:26:53 GMT</pubDate></item><item><title><![CDATA[Reply to Array zurückgeben on Sun, 10 Aug 2003 11:57:18 GMT]]></title><description><![CDATA[<p>ja du musst da noch was formatieren:</p>
<pre><code class="language-cpp">void CPreferences::LoadMailIntervalFile( DWORD* strVar, size_t arraygroesse ){     
    if (!PathFileExists(configdir+&quot;mailchecker.ini&quot;)){     
    theApp.glob_prefs-&gt;CreateMailIntervalFile();     
    }     
    if (PathFileExists(configdir+&quot;mailchecker.ini&quot;)){     
        CIni ini;
        CString s;
        for (size_t i = 0; i &lt; arraygroesse ; i++){
// evtl. musst du den string vorher immer wieder loeschen, ka...
            s.Format( &quot;%s%d&quot;, &quot;Interval&quot;, i );
            strVar[i] = ini.GetInt(&quot;Interval%i&quot;);     
        }     
    }     
}
</code></pre>
<p>probier es aus, ich hoffen das funktioniert... <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/328340</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/328340</guid><dc:creator><![CDATA[entelechie]]></dc:creator><pubDate>Sun, 10 Aug 2003 11:57:18 GMT</pubDate></item><item><title><![CDATA[Reply to Array zurückgeben on Sun, 10 Aug 2003 12:54:17 GMT]]></title><description><![CDATA[<p>Nochmal: Danke für Deine Hilfe</p>
<p>Aber das funktioniert leider auch nicht. Ich hab alternativ versucht, wie geraten, den String zu löschen, aber das hat auch nicht geklappt (oder ich habs falsch gemacht - ka).</p>
<p>Ich häng da jetzt über zwei Tage dran - so langsam hab ich Zweifel, ob es ein einfaches Edit-Control nicht auch getan hätte. Andererseits würde ich das jetzt echt gerne schaffen und begreifen. Das kann doch eingentlich nicht so schwer sein - so mit der MFC im Rücken...</p>
<p>Noch ne Idee?</p>
<p>Ansonsten werde ich spätestens morgen dann auf ein Edit-Control umsteigen. Heute gebe ich mir noch Zeit zum austesten.</p>
<p>MfG</p>
]]></description><link>https://www.c-plusplus.net/forum/post/328394</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/328394</guid><dc:creator><![CDATA[_André_]]></dc:creator><pubDate>Sun, 10 Aug 2003 12:54:17 GMT</pubDate></item><item><title><![CDATA[Reply to Array zurückgeben on Sun, 10 Aug 2003 14:40:12 GMT]]></title><description><![CDATA[<p>hast du dem ini-file auch eine datei zugeordnet??</p>
]]></description><link>https://www.c-plusplus.net/forum/post/328470</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/328470</guid><dc:creator><![CDATA[entelechie]]></dc:creator><pubDate>Sun, 10 Aug 2003 14:40:12 GMT</pubDate></item><item><title><![CDATA[Reply to Array zurückgeben on Sun, 10 Aug 2003 15:35:51 GMT]]></title><description><![CDATA[<p><img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /> der ini eine Datei zugeordnet?</p>
<p>Hhmm - ich bin mir sicher, ob weiß was Du meinst.</p>
<p>Die mailchecker.ini wird halt im Unterverzeichnis &quot;config&quot; des Hauptprogrammes erstellt - und das in jedem Falle. Beim ersten Programmstart eine Reihe solcher Files erstellt und dann die globalen Variablen mit Standardwerten gefüllt - d.h. die ini-Dateien gibt es in jedem Falle. So funzt das im allgemeinen.</p>
<p>Das witzige ist ja, dass der Code zum checken, ob die Werte kleiner 5 sind ja funktioniert. Wenn ich da manuell nen Wert von 2 reinschreibe, wird beim schließen des Programms automatisch die Check...-Funktion aufgerufen (da fehlt noch ne Prüfung, aber da bin ich ja noch nicht) - und die behebt den Eintrag 2 direkt, indem sie das File komplett neu anlegt/überschreibt.<br />
Wenn der Zugriff mit ini.GetInt also alleine klappt, muß das doch auch im Vektor gehen?</p>
<p>Ansonsten passiert alles, wie oben im Code ersichtlich.</p>
<p>Sorry, ich glaub ich weiß nicht ganz wie Du das meinst.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/328503</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/328503</guid><dc:creator><![CDATA[_André_]]></dc:creator><pubDate>Sun, 10 Aug 2003 15:35:51 GMT</pubDate></item><item><title><![CDATA[Reply to Array zurückgeben on Sun, 10 Aug 2003 15:52:42 GMT]]></title><description><![CDATA[<p>aso.<br />
ich meinte weil du nur<br />
CIni ini;<br />
schreibst.<br />
ist das CIni eine klasse von dir (konnte nirgens so ne klasse finden...)?<br />
falls ja, zeig die mal her.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/328519</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/328519</guid><dc:creator><![CDATA[entelechie]]></dc:creator><pubDate>Sun, 10 Aug 2003 15:52:42 GMT</pubDate></item><item><title><![CDATA[Reply to Array zurückgeben on Sun, 10 Aug 2003 16:58:27 GMT]]></title><description><![CDATA[<p>Okay, kein Problem. Die sind n bissel lang, daher uppe ich die eben auf Webspace:</p>
<p><a href="http://mitglied.lycos.de/neuessternentor/CIni.h" rel="nofollow">http://mitglied.lycos.de/neuessternentor/CIni.h</a><br />
<a href="http://mitglied.lycos.de/neuessternentor/CIni.cpp" rel="nofollow">http://mitglied.lycos.de/neuessternentor/CIni.cpp</a></p>
<p>Die heißen zwar bei mir nicht CIni, aber das spielt ja keine Rolle - richtig eingebunden sind sie definitiv.</p>
<p>Gruß</p>
]]></description><link>https://www.c-plusplus.net/forum/post/328562</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/328562</guid><dc:creator><![CDATA[_André_]]></dc:creator><pubDate>Sun, 10 Aug 2003 16:58:27 GMT</pubDate></item><item><title><![CDATA[Reply to Array zurückgeben on Sun, 10 Aug 2003 17:52:32 GMT]]></title><description><![CDATA[<p>also wenn du einfach:<br />
CIni ini;</p>
<p>schreibst sucht der nach einem ini-file mit dem namen deines projektes<br />
(also z.B. MailProjekt.ini).<br />
du musst ihm also den namen der ini datei mitgeben:</p>
<pre><code class="language-cpp">// ...

CIni ini( &quot;mailchecker.ini&quot;, &quot;sektion&quot; ); // datei und sektion beachten

// in der for-schleife
CString intervall;
intervall.Format( &quot;%s%d&quot;, &quot;Intervall&quot;, 0 );
... = ini.GetInt( intervall );
</code></pre>
<p>also die ini dateien sind ja immer so aufgebaut:<br />
[sektion]<br />
Intervall0=123<br />
Intervall1=456</p>
<p>[irgendwas]<br />
KeineAhnung=abc</p>
<p>usw.</p>
<p>deshalb musst du auch noch eine sektion angeben.</p>
<p>schau deshalb nach, wie dein ini-file aufgebaut ist und gib die<br />
parameter entsprechend im konstruktor von CIni an.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/328598</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/328598</guid><dc:creator><![CDATA[entelechie]]></dc:creator><pubDate>Sun, 10 Aug 2003 17:52:32 GMT</pubDate></item><item><title><![CDATA[Reply to Array zurückgeben on Sun, 10 Aug 2003 20:47:03 GMT]]></title><description><![CDATA[<p>Okay, ich weiß was Du meinst und habs auch gemacht.</p>
<p>Alerdings bin ich mir nach 2 Stunden herumprobieren nun sehr sicher, dass es daran nicht liegt. Bei der Check-Funktion, die Prüft, ob einer der Werte kleiner ist als 5 greife ich ja auch erfolgreich drauf zu, ohne dass ich was anders machen müsste. Das kann ich nachprüfen, weil ich ja händisch kleinere Werte eintragen kann (in die mailchecker.ini) - und da er die Datei, wie gewünscht neu schreibt, wenn er einen Wert kleiner 5 findet, kann es das eigentlich nicht sein.</p>
<p>Darüberhinaus legt das Programm ja ne ganze Reihe von Dateien an, manche mit dem Dateityp &quot;ini&quot; andere mit dem Typ &quot;dat&quot; (dat ist dasnn ge-scrambelt, also nicht im Klartext lesbar) - und keine von denen ist irgendwie in der CIni-Klasse erwähnt.</p>
<p>Ich hab jetzt mal das Füllen der Combo-Box nochmal angesehen:</p>
<p>Wenn ich da folgendes eingebe:</p>
<pre><code class="language-cpp">BOOL CPPgMailchecker::OnInitDialog()   
{   
    CPropertyPage::OnInitDialog();   

    DWORD strVar[10];   
    for (int i = 0; i &lt; 10; i++){   
        theApp.glob_prefs-&gt;LoadMailIntervalFile(strVar, 10);   
	// NÄCHSTE ZEILE!
m_MailReqInterval.SetItemData(m_MailReqInterval.AddString(&quot;Interval&quot;+strVar[i]), i ); 
	// m_MailReqInterval.SetItemData(i, (DWORD_PTR)strVar[i] ); 
    }

	LoadSettings();
	Localize();

	return TRUE;  // return TRUE unless you set the focus to a control
	// EXCEPTION: OCX Property Pages should return FALSE
}
</code></pre>
<p>Dann hab ich folgendes Ergebnis:<br />
&quot;Interval&quot; steht in der Combo-Box aber nichts dahinter. IMHO ist der Vektor nach wie vor leer. Wieso weiß ich immer noch nicht. Für mich steht außer Zweifel dass ich auf die mailchecker.ini zugreifen kann (wie gesagt, das programm erstellt einen ganzen Haufen Dateien, und keine davon wird irgendwie anders angesprochen, als ich meine mailchecker.ini anspreche.</p>
<p>Der Vektor ist leer, weil ich wohl die Daten falsch auslese, aber auf die Daten zugreifen und auslesen kann ich (siehe Check-Funktion). Nur wenn sie in den Vektor kommen geht wohl was schief.</p>
<p>Naja - trotzdem vielen Dank für Deine Hilfe - erlebt man nicht so häufig, dass jemand so viel Geduld. Vielen Dank dafür.</p>
<p>Gruß</p>
]]></description><link>https://www.c-plusplus.net/forum/post/328689</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/328689</guid><dc:creator><![CDATA[_André_]]></dc:creator><pubDate>Sun, 10 Aug 2003 20:47:03 GMT</pubDate></item></channel></rss>