Can't add new page in properties

Problems compiling? Don't understand the source code? Don't know how to code your feature? Post here.

Moderator: Moderators

Locked
adrian_007
Posts: 32
Joined: 2006-03-06 10:54
Location: Poland

Post by adrian_007 » 2006-03-06 14:28

hi, i'm new here ;) ... oh.. and sorry for my english, it's not good :\
... i have some problems. i cant add new page in properties :/
i do something like that:
create new, clean page in .rc file, set name IDD_EXTRA, and save it ;)
in PropertiesDlg.cpp i add

Code: Select all

#include "extra.h" 
(...)
pages[n++] = new Extra(s);
and change no. of pages in PropertiesDlg.h file to 15
and my questions are:
1. what i must write in my files (extra.cpp and extra.h) if this page is clean for now?
2. what else i must do to add new page in proper. ?
thx ;)

ullner
Forum Moderator
Posts: 333
Joined: 2004-09-10 11:00
Contact:

Post by ullner » 2006-03-06 15:18

Last edited by ullner on 2006-03-09 05:20, edited 1 time in total.

GargoyleMT
DC++ Contributor
Posts: 3212
Joined: 2003-01-07 21:46
Location: .pa.us

Post by GargoyleMT » 2006-03-07 12:15

I split your thread, since it had little to do with the previous one. Please be mindful of that. ;)

adrian_007
Posts: 32
Joined: 2006-03-06 10:54
Location: Poland

Post by adrian_007 » 2006-03-08 09:00

hum... i do something wrong, because i still can't add new page :\ i have some errors:

Code: Select all

c:\Documents and Settings\Adrian\Pulpit\DCPlusPlus-0.687-src\windows\NewPage.h(16) : error C2039: 'SETTINGS_NEWPAGE' : is not a member of 'ResourceManager'
c:\Documents and Settings\Adrian\Pulpit\DCPlusPlus-0.687-src\windows\NewPage.cpp(21): error C2653: 'Advanced3Page' : is not a class or namespace name
c:\Documents and Settings\Adrian\Pulpit\DCPlusPlus-0.687-src\windows\NewPage.h(16): error C2228: left of '.c_str' must have class/struct/union type
c:\Documents and Settings\Adrian\Pulpit\DCPlusPlus-0.687-src\windows\NewPage.h(16): error C2065: 'SETTINGS_NEWPAGE' : undeclared identifier
c:\Documents and Settings\Adrian\Pulpit\DCPlusPlus-0.687-src\windows\NewPage.cpp(22): error C2065: 'items' : undeclared identifier
this are my .cpp and .h files:
NewPage.cpp

Code: Select all

#include "stdafx.h"
#include "../client/DCPlusPlus.h"
#include "Resource.h"

#include "NewPage.h"
#include "CommandDlg.h"

#include "../client/SettingsManager.h"

//6) Add:
LRESULT NewPage::onInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
 PropPage::translate((HWND)(*this), texts); // 'texts' here is a static TextItem array. Omit if desired.
 PropPage::read((HWND)*this, items, 0, 0); // 'items' here is a static Item array. Omit if desired.

 // Do specialized reading here
 return TRUE;
}

//7) Add:
void Advanced3Page::write() {
 PropPage::write((HWND)*this, items, 0, 0); // 'items' here is a static Item array, the very same variable as on 6). Omit if desired.
};

//8.1) If you want to have text in your page, add:
//PropPage::TextItem NewPage::texts[] = {
 //{ IDC_SETTINGS_SOME_SETTING, ResourceManager::SOME_TEXT },
// { IDC_SETTINGS_ANOTHER_SETTING, ResourceManager::ANOTHER_TEXT },
// { 0, ResourceManager::SETTINGS_AUTO_AWAY } // Pretty much used everywhere else... You can might aswell include it.
//};
//Remember that you have to have the 'texts' array included.

//8.2) If you want to have items in your page, add:
//PropPage::Item Advanced3Page::items[] = {
// { IDC_SOME_ITEM, SettingsManager::SOME_TEXT_BLAH, PropPage::T_INT },
// { IDC_ANOTHERITEM, SettingsManager::ANOTHER_TEXT_BLAH, PropPage::T_STRING },
// { 0, 0, PropPage::T_END }
//};
//Depending on the item, use T_INT or T_STRING.

//Well, you get the hang of it there.
NewPage.h

Code: Select all

#ifndef NEWPAGE_H
#define NEWPAGE_H

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <atlcrack.h>
#include "PropPage.h"
#include "ExListViewCtrl.h"

class NewPage : public CPropertyPage<IDD_NEWPAGE>, public PropPage
{
public:
 NewPage(SettingsManager *s) : PropPage(s) {
  SetTitle(CTSTRING(SETTINGS_NEWPAGE));
  m_psp.dwFlags |= PSP_HASHELP;
 };

 virtual ~NewPage() {
 };

 BEGIN_MSG_MAP(NewPage)
  MESSAGE_HANDLER(WM_INITDIALOG, onInitDialog)
 END_MSG_MAP()

 LRESULT onInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);

 // Common PropPage interface
 PROPSHEETPAGE *getPSP() { return (PROPSHEETPAGE *)*this; }
 virtual void write();
 
protected:

 static Item items[];  // If you want it that is...
 static TextItem texts[]; // If you want it that is...
};

#endif //NEWPAGE_H
what i do wrong? or what else i should do? any ideas? ;)
thx ;)

ullner
Forum Moderator
Posts: 333
Joined: 2004-09-10 11:00
Contact:

Post by ullner » 2006-03-08 09:52

Add SETTINGS_NEWPAGE to StringDefs.h. I seem to have forgot to put that in the post... And change Advanced3Page::write to NewPage::write and Advanced3Page::items to NewPage::items. (I copy-pasted an old patch... I must have missed that too...)

adrian_007
Posts: 32
Joined: 2006-03-06 10:54
Location: Poland

Post by adrian_007 » 2006-03-08 14:22

okay... i do what you tell but it still doesn't work :/
see this, i have only 2 errors:

Code: Select all

DCPlusPlus error LNK2019: unresolved external symbol "public: long __thiscall Extra::onTextChanged(unsigned short,unsigned short,struct HWND__ *,int &)" (?onTextChanged@Extra@@QAEJGGPAUHWND__@@AAH@Z) referenced in function "public: virtual int __thiscall Extra::ProcessWindowMessage(struct HWND__ *,unsigned int,unsigned int,long,long &,unsigned long)" (?ProcessWindowMessage@Extra@@UAEHPAUHWND__@@IIJAAJK@Z)
and

Code: Select all

DCPlusPlus fatal error LNK1120: 1 unresolved externals
any ideas? ;)

ullner
Forum Moderator
Posts: 333
Joined: 2004-09-10 11:00
Contact:

Post by ullner » 2006-03-09 05:23

Which version of Visual Studios are you using?
Can you post your current code?

adrian_007
Posts: 32
Joined: 2006-03-06 10:54
Location: Poland

Post by adrian_007 » 2006-03-09 10:01

i'm using vs 2003 but i have 2005 too (not installed ;))
my code for now:

Code: Select all

#include "stdafx.h"
#include "../client/DCPlusPlus.h"
#include "Resource.h"

#include "Extra.h"
#include "CommandDlg.h"

#include "../client/SettingsManager.h"


LRESULT Extra::onInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/) {
		PropPage::translate((HWND)(*this), texts); // 'texts' here is a static TextItem array. Omit if desired.
		PropPage::read((HWND)*this, items, 0, 0); // 'items' here is a static Item array. Omit if desired.

// Do specialized reading here
	return TRUE;
}


void Extra::write() {
	PropPage::write((HWND)*this, items, 0, 0); // 'items' here is a static Item array, the very same variable as on 6). Omit if desired.
}

//	PropPage::TextItem Extra::texts[] = {
//		{ IDC_DIALOG1, ResourceManager::DIALOG1 },
//		{ 0, ResourceManager::SETTINGS_AUTO_AWAY } // Pretty much used everywhere else... You can might aswell include it.
//};

	PropPage::Item Extra::items[] = {
		{ IDC_DIALOG1, SettingsManager::DIALOG1, PropPage::T_STR},
		{ 0, 0, PropPage::T_END }
};

Code: Select all

#ifndef EXTRA_H
#define EXTRA_H

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <atlcrack.h>
#include "PropPage.h"
#include "ExListViewCtrl.h"

class Extra : public CPropertyPage<IDD_EXTRA>, public PropPage
{
	public:
		Extra(SettingsManager *s) : PropPage(s) {
			SetTitle(CTSTRING(SETTINGS_EXTRA));
		m_psp.dwFlags |= PSP_HASHELP;
	};

	virtual ~Extra() {
};

	BEGIN_MSG_MAP(Extra)
		MESSAGE_HANDLER(WM_INITDIALOG, onInitDialog)
		COMMAND_HANDLER(IDC_DIALOG1, EN_CHANGE, onTextChanged)
	END_MSG_MAP()

	LRESULT onInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
//	LRESULT onHelp(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
	LRESULT onTextChanged(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
//	LRESULT onHelpInfo(LPNMHDR /*pnmh*/);


// Common PropPage interface
PROPSHEETPAGE *getPSP() { return (PROPSHEETPAGE *)*this; }
virtual void write();

protected:

static Item items[]; // If you want it that is...
static TextItem texts[]; // If you want it that is...
};

#endif //EXTRA_H


joakim_tosteberg
Forum Moderator
Posts: 587
Joined: 2003-05-07 02:38
Location: Sweden, Linkoping

Post by joakim_tosteberg » 2006-03-10 13:04

You neeed to add something like

Code: Select all

LRESULT Extra::onTextChanged(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
         // Do something.
         return TRUE;
}
to your .cpp file.

GargoyleMT
DC++ Contributor
Posts: 3212
Joined: 2003-01-07 21:46
Location: .pa.us

Post by GargoyleMT » 2006-03-12 09:10

Better yet, get rid of:

Code: Select all

COMMAND_HANDLER(IDC_DIALOG1, EN_CHANGE, onTextChanged)
Until you have a reason to use it.

adrian_007
Posts: 32
Joined: 2006-03-06 10:54
Location: Poland

Post by adrian_007 » 2006-03-13 10:23

thanks for helping ;) but i have added new page, i just copy-paste certif. page, change some things, and it's work fine ;)
thx ;)

Locked