Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS General Discussion » problems with CExtComboBox under Unicode and MBCS builds Collapse All
Subject Author Date
Swetha Kishan Apr 28, 2010 - 6:26 AM

Hi !


 


I have few issues when using CExtComboBox under ProfUIs 2.5 version (with Visual Studio 2005).


 


1) When I try to use CExtComboBox  for Unicode buid(created a var of this type and tried to add strings using AddString), I get link errors LNK2019 and LNK2001 for Create() function under CResDlg and for ProfileSetup().


 


2) When I tried MBCS build, the prj gets built very well but no strings are displayed under combo box (used AddString() to add strings to Combo box).


 


3) I tried the same code with ProfUIs 2.88 libraries. Under unicode build, it works perfectly fine !! but the same code under MBCS build the same above (pt.2) problem comes. Strings are not displayed in combo box.


 


I am confused totally. Can anyone help in this ? I greatly appreciate the quickest response.


Regards


SK

Swetha Kishan Apr 29, 2010 - 6:26 AM


Hi,


I think I am asking you novice questions ! Please clarify the follow -


1) Does ProfUI 2.50 work for unicode configuration applications or only later versions support Unicode ?


2) Do we need to create ProfUI controls only at run time ? Can’t we create it at compile time ? If so, I want to use Visual Studio’s toolbox to drag and drop the controls onto dialog box. In this case, I create a control, say combo box through VS’s toolbox; but my code has CExtComboBox’s variable for which I add strings. Now, how does VS understand that the combo box created must be mapped to CExtComboBox ? I even used DDX_Control with combo box’s id with respective variable. But I don’t see any strings added to combo box when I run the app.


3) I saw in your portal that ProfUI’s seperate toolbox is provided. Is it not for FreeWare ?


4) I got the installable "95727-profuis250_trial.exe" for 2.5 version. But I realized after installation that very few include files are present in Include dir and ’Src’ folder has just few .h files and not source files. I was getting compiler errors (asking for remaining .h files) when building ProfUISLib project. As I had a different copy of 2.5 version (not installable, direct files ! ) I copied entire Include and Src folders after this installation. I just want to know if any thing went wrong there.


4) Here is a small sample prj (SampProfUI) that has just one combobox and an edit control in a dialog box :


 


4.1) SampProfUI.h



#pragma



once __AFXWIN_H__

#error "include ’stdafx.h’ before including this file for PCH"



#endif


#include


"resource.h" // main symbols

class


{


CSampProfUIApp : public CWinApp

public


CSampProfUIApp();


~CSampProfUIApp();


:

public


 


DECLARE_MESSAGE_MAP()


};


4.2) SampProfUI.cpp


:virtual BOOL InitInstance();

// SampProfUI.cpp : Defines the class behaviors for the application.


//



#include


"stdafx.h"

#include


"SampProfUI.h"

#include


"SampProfUIDlg.h"

#ifdef


_DEBUG

#define


new DEBUG_NEW

#undef


THIS_FILE

static


char THIS_FILE[] = __FILE__;

#endif


#define


BEGIN_MESSAGE_MAP(CSampProfUIApp, CWinApp)


ON_COMMAND(ID_HELP, CWinApp::OnHelp)


END_MESSAGE_MAP()


 


CSampProfUIApp::CSampProfUIApp()


{


}


CSampProfUIApp::~CSampProfUIApp()


{


}


CSampProfUIApp theApp;


BOOL CSampProfUIApp::InitInstance()


{


VERIFY( AfxOleInit() );


VERIFY( AfxInitRichEdit() );


 


free( (


m_pszProfileName = _tcsdup( _T(


ASSERT( m_pszProfileName != NULL );


VERIFY( g_CmdManager->ProfileSetup(m_pszProfileName) );


SetRegistryKey(_T(


ASSERT( m_pszRegistryKey != NULL );


 


CSampProfUIDlg dlg;


m_pMainWnd = &dlg;


dlg.DoModal();


 


 


}


 


4.3) SampProfUIDlg.h


CMD_PROFILE_NAME _T("SK-profile")if( m_pszProfileName != NULL )void*)m_pszProfileName );"SK_Sample_Controls") );"SK_Sample"));return FALSE;

#pragma


class


{


once CSampProfUIDlg : public CExtResizableDialog

public


DECLARE_DYNAMIC(CSampProfUIDlg)


CSampProfUIDlg(CWnd* pParent = NULL);


~CSampProfUIDlg();


 


 


 


 


:enum { IDD = IDD_SAMPPROFUI_DIALOG };protected:virtual void DoDataExchange(CDataExchange* pDX); virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);

protected


HICON m_hIcon;


:

virtual


afx_msg


afx_msg HCURSOR OnQueryDragIcon();


DECLARE_MESSAGE_MAP()


BOOL OnInitDialog();void OnPaint();

public


afx_msg


:void OnBnClickedOk();

private


CExtEdit m_Edit;


CExtComboBox m_Combo;


CString m_ComboStr;


:

public


afx_msg


afx_msg


};


:void OnBnClickedCancel();void OnCbnSelchangeCombo1();

 


4.4) SampProfUIDlg.cpp



// SampProfUIDlg.cpp : implementation file


//



#include


"stdafx.h"

#include


"SampProfUI.h"

#include


"SampProfUIDlg.h"

#ifdef


_DEBUG

#define


new DEBUG_NEW

#endif


 



IMPLEMENT_DYNAMIC(CSampProfUIDlg, CExtResizableDialog)


 


CSampProfUIDlg::CSampProfUIDlg(CWnd* pParent )


: CExtResizableDialog(CSampProfUIDlg::IDD, pParent)


{


m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);


}


CSampProfUIDlg::~CSampProfUIDlg()


{


}



void


{


CExtResizableDialog ::DoDataExchange(pDX);


DDX_Control(pDX, IDC_EDIT1, m_Edit);


DDX_Control(pDX, IDC_COMBO1, m_Combo);


}


BEGIN_MESSAGE_MAP(CSampProfUIDlg, CExtResizableDialog)


ON_WM_PAINT()


ON_WM_QUERYDRAGICON()


ON_BN_CLICKED(IDOK, &CSampProfUIDlg::OnBnClickedOk)


ON_BN_CLICKED(IDCANCEL, &CSampProfUIDlg::OnBnClickedCancel)


ON_CBN_SELCHANGE(IDC_COMBO1, &CSampProfUIDlg::OnCbnSelchangeCombo1)


END_MESSAGE_MAP()


 


BOOL CSampProfUIDlg::OnInitDialog()


{


 


{


ASSERT( FALSE );


 


}


SetIcon(m_hIcon, TRUE);


SetIcon(m_hIcon, FALSE);


CSampProfUIDlg::DoDataExchange(CDataExchange* pDX)if (!CExtResizableDialog ::OnInitDialog())return FALSE;

m_Combo.AddString(


m_Combo.AddString(


m_Combo.AddString(


m_Combo.AddString(


m_Combo.AddString(


 


 


}


"Ramakrishna");"Kishan Rao");"Rama");"Saritha");"Shobitha");return TRUE;

void


{


 


{


CPaintDC dc(


CExtMemoryDC dcExt(&dc);


 


SendMessage(WM_ICONERASEBKGND,


 


 


CRect rect;


GetClientRect(&rect);


 


 


dcExt.DrawIcon(x, y, m_hIcon);


}


 


CSampProfUIDlg::OnPaint()if (IsIconic())this); reinterpret_cast<WPARAM>(dcExt.GetSafeHdc()), 0);int cxIcon = GetSystemMetrics(SM_CXICON);int cyIcon = GetSystemMetrics(SM_CYICON);int x = (rect.Width() - cxIcon + 1) / 2;int y = (rect.Height() - cyIcon + 1) / 2;else

{


CExtResizableDialog ::OnPaint();


}


}


HCURSOR CSampProfUIDlg::OnQueryDragIcon()


{


 


}


LRESULT CSampProfUIDlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)


{


LRESULT lResult = CExtResizableDialog :: WindowProc( message, wParam, lParam );


 


}


return static_cast<HCURSOR>(m_hIcon);return lResult;

void


{


CString str;


m_Edit.GetWindowText(str);


AfxMessageBox(str);


AfxMessageBox(m_ComboStr);


}


CSampProfUIDlg::OnBnClickedOk()

void


{


CExtResizableDialog::OnCancel();


}


CSampProfUIDlg::OnBnClickedCancel()

void


{


CString temp;


 


m_Combo.GetLBText(iComboSelInd, temp );


m_ComboStr =


m_ComboStr.Append(temp);


}


CSampProfUIDlg::OnCbnSelchangeCombo1()int iComboSelInd = m_Combo.GetCurSel();"You selected : " ;

4.5) stdafx.h



#pragma


#ifndef


once _SECURE_ATL

#define


_SECURE_ATL 1

#endif


#ifndef


VC_EXTRALEAN

#define


VC_EXTRALEAN

#endif


#ifndef


WINVER

#define


WINVER 0x0501

#endif


#ifndef


_WIN32_WINNT

#define


_WIN32_WINNT 0x0501

#endif



#ifndef


_WIN32_WINDOWS

#define


_WIN32_WINDOWS 0x0410

#endif


#ifndef


_WIN32_IE

#define


_WIN32_IE 0x0600

#endif


#define


_ATL_CSTRING_EXPLICIT_CONSTRUCTORS

#define


_AFX_ALL_WARNINGS

#include


<afxwin.h>

#include


<afxext.h>

 



#include


<afxdisp.h>

 


 



#ifndef


_AFX_NO_OLE_SUPPORT

#include


<afxdtctl.h>

#endif


#ifndef


_AFX_NO_AFXCMN_SUPPORT

#include


<afxcmn.h>

#endif



#include


<Prof-UIS.h>

#ifdef


_UNICODE

#if defined _M_IX86


#pragma comment(linker,"/manifestdependency:\"type=’win32’ name=’Microsoft.Windows.Common-Controls’ version=’6.0.0.0’ processorArchitecture=’x86’ publicKeyToken=’6595b64144ccf1df’ language=’*’\"")


#elif defined _M_IA64


#pragma comment(linker,"/manifestdependency:\"type=’win32’ name=’Microsoft.Windows.Common-Controls’ version=’6.0.0.0’ processorArchitecture=’ia64’ publicKeyToken=’6595b64144ccf1df’ language=’*’\"")


#elif defined _M_X64


#pragma comment(linker,"/manifestdependency:\"type=’win32’ name=’Microsoft.Windows.Common-Controls’ version=’6.0.0.0’ processorArchitecture=’amd64’ publicKeyToken=’6595b64144ccf1df’ language=’*’\"")


#else


#pragma comment(linker,"/manifestdependency:\"type=’win32’ name=’Microsoft.Windows.Common-Controls’ version=’6.0.0.0’ processorArchitecture=’*’ publicKeyToken=’6595b64144ccf1df’ language=’*’\"")


#endif



#endif


I think I am running short of time for my project and I am strucked at the very initial stage! Can you please guide me step-by-step how to create an exe (Static-Static for EXE build configuration) ? I want to create controls through Visual Studio IDE (tool box) and if possible I want to totally avoid run time creation of controls .



Eagerly looking for the response.




Regards


Swetha Kishan



 



#ifndef

Technical Support Apr 30, 2010 - 5:16 AM

Here are the answers to your questions:

1) Yes. It works. But please note, 2.50 is enough old version and it may not work and even may not with the latest Visual C++ versions, especially 64 bit targets.

2) You can create Prof-UIS controls either at run time or use the Custom Control item in toolbox for creating Prof-UIS controls on dialogs. MFC does not support user defined items in Visual Studio toolbox. Here is the article describing how to insert custom controls, including Prof-UIS controls, into the dialog template resources:

http://www.codeproject.com/KB/miscctrl/customcontrol.aspx

3) You probably saw the toolbox controls of the Elegant UI product. Please note, the Elegant UI is absolutely different product and it’s not related neither to Prof-UIS, nor to MFC, nor to C++.

4) Prof-UIS trial version is provided without source code. You cannot compile the ProfUISDLL and ProfUISLIB projects because their CPP files are not included into the Prof-UIS trial installation. The compiled libraries are provided instead.

5) We recommend you that read the following articles first of all:

http://www.prof-uis.com/prof-uis/tech-support/feature-articles/getting-started-with-prof-uis.aspx
http://www.prof-uis.com/prof-uis/tech-support/feature-articles/prof-uis-build-configurations.aspx

You can drop us an e-mail with your test project compressed into ZIP file to the support mail box at this web site. This will let us to review it better and provide you with advices

Technical Support Apr 28, 2010 - 10:25 AM

We can compile any configuration of any sample app with combo box using VS 2005. May be you can create some simplest possible project demonstrating this issue and send it to us?