|
Create a separate static library project for the CPP files and get that to build a static library from the cpp files for you. Then, tell the project that uses that functionality to link against the static library.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Yeah that's what I did.. Thank you.
I create a static library put all my .h and .cpp files in it and compile create my .lib file. And put it into my application. Now it works..
Thank you again.
|
|
|
|
|
Ribbon application crash on some systems while it works fine on others. I have statically linked to MFC. Still it crashes on random systems. I debugged it on the system on which it crashed and found that the FindByID returns NULL for CMFCRibbonSlider in OnUpdate.. function. Other ribbon controls are working fine.
CMFCRibbonBar* pRibbon = ((CMainFrame*) GetTopLevelFrame())->GetRibbonBar();<br />
ASSERT_VALID(pRibbon);<br />
CMFCRibbonSlider* pSlider = DYNAMIC_DOWNCAST(CMFCRibbonSlider, pRibbon->GetCategory(0)->FindByID(ID_EDIT_EXPAND_COLLAPSE));
Why does it return NULL only on some systems ?
What might be the problem?
Thanks in Advanc
|
|
|
|
|
i want to open particular (C directoy in separate browser window .how i do this?
|
|
|
|
|
Hello Pooja,
You can use ShellExecute() . Please see the code snippet.
ShellExecute( NULL, _T("explore"), _T("c:\\"), 0, 0, SW_SHOW );
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Hi i am using a grid in feature .
My requirement is to make a first 3 columns read only. and last i.e 4 th column
write only.
Please tell me which property should i use..
I am not able to find it . Please help
|
|
|
|
|
Finally i got the answer after lot of Hit & Trial methods..
if we have a pointer to VSFlexGrid say
m_pGrid ;
then
call m_pGrid->AutoSize (0,ComVariant(1L)) in the OnInitDialog()
|
|
|
|
|
#include "stdafx.h"
#include "MyPar.h"
#include "MyParDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
enum { IDD = IDD_ABOUTBOX };
protected:
virtual void DoDataExchange(CDataExchange* pDX);
protected:
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
END_MESSAGE_MAP()
CMyParDlg::CMyParDlg(CWnd* pParent )
: CDialog(CMyParDlg::IDD, pParent)
{
m_sCity = _T("");
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CMyParDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_IMAGE, m_Image);
DDX_Control(pDX, IDC_COMBO_CHECKOUT_MONTHYEAR, m_cbCheckoutMonthYear);
DDX_Control(pDX, IDC_COMBO_GUEST_ROOMS, m_cbGuestRooms);
DDX_Control(pDX, IDC_COMBO_HOTELS, m_cbHotels);
DDX_Control(pDX, IDC_COMBO_STATE_PROV, m_cbStateProv);
DDX_Control(pDX, IDC_COMBO_CHECKIN_DAY, m_cbCheckinDay);
DDX_Control(pDX, IDC_COMBO_CHECKIN_MONTH_YEAR, m_cbCheckinMonthYear);
DDX_Control(pDX, IDC_COMBO_CHECKOUT_DAY, m_cbCheckoutDay);
DDX_Control(pDX, IDC_COMBO_COUNTRY, m_cbCountry);
DDX_Control(pDX, IDC_COMBO_SEARCH_WITHIN, m_cbSearchWithin);
DDX_Text(pDX, IDC_EDIT_CITY, m_sCity);
}
BEGIN_MESSAGE_MAP(CMyParDlg, CDialog)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDC_BUTTON1, OnStart)
END_MESSAGE_MAP()
BOOL CMyParDlg::OnInitDialog()
{
CDialog::OnInitDialog();
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
SetIcon(m_hIcon, TRUE);
SetIcon(m_hIcon, FALSE);
m_BMP.LoadBitmap(IDB_HILTON);
m_Image.SetBitmap(m_BMP);
FillSearchWithin();
FillStateProv();
FillCountry();
FillCheckinDay();
FillCheckinMonthYear();
FillCheckoutDay();
FillCheckoutMonthYear();
FillHotels();
FillGuestRooms();
m_cbSearchWithin.SetCurSel(4);
m_cbHotels.SetCurSel(0);
m_cbGuestRooms.SetCurSel(0);
m_cbCountry.SetCurSel(89);
UpdateData();
return FALSE;
}
void CMyParDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}
void CMyParDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this);
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
HCURSOR CMyParDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
void CMyParDlg::OnOK()
{
CDialog::OnOK();
}
void CMyParDlg::OnStart()
{
BSTR bsStatus;
m_bReady=0;
m_bNextPage = 1;
CString sTemp;
UpdateData();
CString mPass("*****");
CString mUser("*****");
CString mCity("London");
CString mTopDestination("Test");
CString mState("Washington");
CString mCountry("United Kingdom");
CString mCheckInDay("28");
CString mCheckInMonthYr("Dec 2007");
CString mCheckOutDay("29");
CString mCheckOutMonthYr("Dec 2007");
BSTR bsCity = m_sCity.AllocSysString();
BSTR bsTopDestination = mTopDestination.AllocSysString();
int i = 0;
i = m_cbStateProv.GetCurSel();
i = m_cbCountry.GetCurSel();
i = m_cbCheckinDay.GetCurSel();
i = m_cbCheckinMonthYear.GetCurSel();
i = m_cbCheckoutDay.GetCurSel();
i = m_cbCheckoutMonthYear.GetCurSel();
CString mStr;
HRESULT hr1 ;
hr1 = CoInitialize(NULL);
if(!SUCCEEDED(hr1))
return ;
hr1 = CoCreateInstance (CLSID_InternetExplorer,
NULL, CLSCTX_LOCAL_SERVER,
IID_IWebBrowser2, (LPVOID *)&m_pBrowser);
if(hr1==S_OK)
{
VARIANT_BOOL pBool=true;
m_pBrowser->put_Visible( pBool ) ;
COleVariant vaURL("http://www.hilton.com/") ;
COleVariant null;
m_pBrowser->Navigate2(vaURL,null,null,null,null) ;
while(!m_bReady)
{
m_pBrowser->get_StatusText(&bsStatus);
mStr=bsStatus;
if(mStr=="Done")m_bReady=1;
}
IDispatch* pDisp;
hr1=m_pBrowser->get_Document(&pDisp);
if (pDisp != NULL )
{
IHTMLDocument2* pHTMLDocument2;
HRESULT hr;
hr = pDisp->QueryInterface( IID_IHTMLDocument2,
(void**)&pHTMLDocument2 );
if (hr == S_OK)
{
IHTMLElementCollection* pColl = NULL;
hr = pHTMLDocument2->get_all( &pColl );
if (hr == S_OK && pColl != NULL)
{
LONG celem;
hr = pColl->get_length( &celem );
if ( hr == S_OK )
{
for ( int i=0; i< celem; i++ )
{
VARIANT varIndex;
varIndex.vt = VT_UINT;
varIndex.lVal = i;
VARIANT var2;
VariantInit( &var2 );
IDispatch* pDisp;
hr = pColl->item( varIndex,
var2, &pDisp );
if ( hr == S_OK )
{
IHTMLElement* pElem;
hr = pDisp->QueryInterface(
IID_IHTMLElement,
(void **)&pElem);
if ( hr == S_OK )
{
BSTR bstr;
hr = pElem->get_tagName(&bstr);
CString strTag;
strTag = bstr;
IHTMLInputTextElement* pUser;
hr = pDisp->QueryInterface(
IID_IHTMLInputTextElement,
(void **)&pUser );
if ( hr == S_OK )
{
pUser->get_name(&bstr);
mStr=bstr;
if(mStr=="city"){
pUser->put_value(bsCity);
}
pUser->Release();
}
else
{
IHTMLSelectElement* pUser;
hr = pDisp->QueryInterface(
IID_IHTMLSelectElement,
(void **)&pUser );
if ( hr == S_OK )
{
pUser->get_name(&bstr);
mStr=bstr;
if(mStr=="topDestination"){
}
else if(mStr == "state"){
pUser->put_selectedIndex(m_cbStateProv.GetCurSel() + 1);
}
else if(mStr == "country"){
pUser->put_selectedIndex(m_cbCountry.GetCurSel() + 1);
}
else if(mStr == "checkInDay"){
pUser->put_selectedIndex(m_cbCheckinDay.GetCurSel() + 1);
}
else if(mStr == "checkInMonthYr"){
pUser->put_selectedIndex(m_cbCheckinMonthYear.GetCurSel() +1);
}
else if(mStr == "checkOutDay"){
pUser->put_selectedIndex(m_cbCheckoutDay.GetCurSel() + 1);
}
else if(mStr == "checkOutMonthYr"){
pUser->put_selectedIndex(m_cbCheckoutMonthYear.GetCurSel() + 1);
}
}
IHTMLAnchorElement* pButton;
hr = pDisp->QueryInterface(
IID_IHTMLAnchorElement,
(void **)&pButton );
if ( hr == S_OK )
{
pButton->get_name(&bstr);
mStr=bstr;
}
}
pElem->Release();
}
pDisp->Release();
}
}
}
pColl->Release();
}
pHTMLDocument2->Release();
}
pDisp->Release();
}
}
MoreSearchOptions("fnSetRoomsReqSubmit");
}
void CMyParDlg::MoreSearchOptions(CString sLink)
{
BSTR bsStatus;
CString mStr,mLocation;
m_bReady=0;
HRESULT hr1;
IDispatch* pDisp;
hr1=m_pBrowser->get_Document(&pDisp);
if (pDisp != NULL )
{
IHTMLDocument2* pHTMLDocument2;
HRESULT hr;
hr = pDisp->QueryInterface( IID_IHTMLDocument2,
(void**)&pHTMLDocument2 );
if (hr == S_OK)
{
IHTMLElementCollection* pColl = NULL;
hr = pHTMLDocument2->get_all( &pColl );
if (hr == S_OK && pColl != NULL)
{
LONG celem;
hr = pColl->get_length( &celem );
if ( hr == S_OK )
{
for ( int i=0; i< celem; i++ )
{
VARIANT varIndex;
varIndex.vt = VT_UINT;
varIndex.lVal = i;
VARIANT var2;
VariantInit( &var2 );
IDispatch* pDisp;
hr = pColl->item( varIndex, var2, &pDisp );
if ( hr == S_OK )
{
IHTMLElement* pElem;
hr = pDisp->QueryInterface(
IID_IHTMLElement,
(void **)&pElem);
if ( hr == S_OK)
{
IHTMLAnchorElement* pLink;
hr = pDisp->QueryInterface(
IID_IHTMLAnchorElement,
(void **)&pLink);
if ( hr == S_OK)
{
BSTR bstr;
hr = pLink->get_href(&bstr);
if(hr == S_OK){
CString strTag;
strTag = bstr;
if(strTag.Find(sLink)>=0 ){
pElem->click();
i=celem;
}
}
pLink->Release();
}
pElem->Release();
}
pDisp->Release();
}
}
pColl->Release();
}
}
pHTMLDocument2->Release();
}
pDisp->Release();
}
CString statustext="OK";
m_pBrowser->put_StatusText(statustext.AllocSysString());
m_bReady=0;
while(!m_bReady)
{
m_pBrowser->get_StatusText(&bsStatus);
mStr=bsStatus;
if(mStr=="Done")m_bReady=1;
}
while(m_bNextPage)
{
GoToNextPage("next.gif");
}
AfxMessageBox("Completed!");
}
void CMyParDlg::GoToNextPage(CString sLink)
{
BSTR bsStatus;
CString mStr,mLocation;
m_bReady=0;
HRESULT hr1;
IDispatch* pDisp;
hr1=m_pBrowser->get_Document(&pDisp);
if (pDisp != NULL )
{
IHTMLDocument2* pHTMLDocument2;
HRESULT hr;
hr = pDisp->QueryInterface( IID_IHTMLDocument2,
(void**)&pHTMLDocument2 );
if (hr == S_OK)
{
IHTMLElementCollection* pColl = NULL;
hr = pHTMLDocument2->get_all( &pColl );
if (hr == S_OK && pColl != NULL)
{
LONG celem;
hr = pColl->get_length( &celem );
if ( hr == S_OK )
{
for ( int i=0; i< celem; i++ )
{
VARIANT varIndex;
varIndex.vt = VT_UINT;
varIndex.lVal = i;
VARIANT var2;
VariantInit( &var2 );
IDispatch* pDisp;
hr = pColl->item( varIndex, var2, &pDisp );
if ( hr == S_OK )
{
IHTMLElement* pElem;
hr = pDisp->QueryInterface(
IID_IHTMLElement,
(void **)&pElem);
if ( hr == S_OK)
{
IHTMLImgElement* pLink;
hr = pDisp->QueryInterface(
IID_IHTMLImgElement,
(void **)&pLink);
if ( hr == S_OK)
{
BSTR bstr;
hr = pLink->get_href(&bstr);
if(hr == S_OK){
CString strTag;
strTag = bstr;
if(strTag.Find(sLink)>=0 ){
pElem->click();
i=celem;
m_bNextPage = TRUE;
}
else
{
m_bNextPage = FALSE;
}
}
pLink->Release();
}
pElem->Release();
}
pDisp->Release();
}
}
pColl->Release();
}
}
pHTMLDocument2->Release();
}
pDisp->Release();
}
CString statustext="OK";
m_pBrowser->put_StatusText(statustext.AllocSysString());
m_bReady=0;
while(!m_bReady)
{
m_pBrowser->get_StatusText(&bsStatus);
mStr=bsStatus;
if(mStr=="Done")m_bReady=1;
}
}
void CMyParDlg::FillSearchWithin()
{
m_cbSearchWithin.AddString("5");
m_cbSearchWithin.AddString("10");
m_cbSearchWithin.AddString("25");
m_cbSearchWithin.AddString("30");
m_cbSearchWithin.AddString("40");
m_cbSearchWithin.AddString("50");
}
void CMyParDlg::FillStateProv()
{
m_cbStateProv.AddString("AE (Area Europe)");
m_cbStateProv.AddString("Alabama");m_cbStateProv.AddString("Alaska");
m_cbStateProv.AddString("AP (Area Pacific)");m_cbStateProv.AddString("Arizona");
m_cbStateProv.AddString("Arkansas");m_cbStateProv.AddString("California");
m_cbStateProv.AddString("Colorado");m_cbStateProv.AddString("Connecticut");
m_cbStateProv.AddString("Delaware");m_cbStateProv.AddString("District of Columbia");
m_cbStateProv.AddString("Florida");m_cbStateProv.AddString("Georgia");
m_cbStateProv.AddString("Hawaii");m_cbStateProv.AddString("Idaho");
m_cbStateProv.AddString("Illinois");m_cbStateProv.AddString("Indiana");
m_cbStateProv.AddString("Iowa");m_cbStateProv.AddString("Kansas");
m_cbStateProv.AddString("Kentucky");m_cbStateProv.AddString("Louisiana");
m_cbStateProv.AddString("Maine");m_cbStateProv.AddString("Maryland");
m_cbStateProv.AddString("Massachusetts");m_cbStateProv.AddString("Michigan");
m_cbStateProv.AddString("Minnesota");m_cbStateProv.AddString("Mississippi");
m_cbStateProv.AddString("Missouri");m_cbStateProv.AddString("Montana");
m_cbStateProv.AddString("Nebraska");m_cbStateProv.AddString("Nevada");
m_cbStateProv.AddString("New Hampshire");m_cbStateProv.AddString("New Jersey");
m_cbStateProv.AddString("New Mexico");m_cbStateProv.AddString("New York");
m_cbStateProv.AddString("North Carolina");m_cbStateProv.AddString("North Dakota");
m_cbStateProv.AddString("Ohio");m_cbStateProv.AddString("Oklahoma");
m_cbStateProv.AddString("Oregon");m_cbStateProv.AddString("Pennsylvania");
m_cbStateProv.AddString("Puerto Rico");m_cbStateProv.AddString("Rhode Island");
m_cbStateProv.AddString("South Carolina");m_cbStateProv.AddString("South Dakota");
m_cbStateProv.AddString("Tennessee");m_cbStateProv.AddString("Texas");
m_cbStateProv.AddString("Utah");m_cbStateProv.AddString("Vermont");
m_cbStateProv.AddString("Virginia");m_cbStateProv.AddString("Washington");
m_cbStateProv.AddString("West Virginia");m_cbStateProv.AddString("Wisconsin");
m_cbStateProv.AddString("Wyoming");m_cbStateProv.AddString("Alberta");
m_cbStateProv.AddString("British Columbia");m_cbStateProv.AddString("Manitoba");
m_cbStateProv.AddString("New Brunswick");m_cbStateProv.AddString("Newfoundland");
m_cbStateProv.AddString("Northwest Territories");m_cbStateProv.AddString("Nova Scotia");
m_cbStateProv.AddString("Nunavut");m_cbStateProv.AddString("Ontario");
m_cbStateProv.AddString("Prince Edward Island");m_cbStateProv.AddString("Quebec");
m_cbStateProv.AddString("Saskatchewan");m_cbStateProv.AddString("Yukon Territory");
}
void CMyParDlg::FillCountry()
{
m_cbCountry.AddString("Canada");m_cbCountry.AddString("Algeria");
m_cbCountry.AddString("Argentina");m_cbCountry.AddString("Australia");
m_cbCountry.AddString("Austria");m_cbCountry.AddString("Bahamas");
m_cbCountry.AddString("Bahrain");m_cbCountry.AddString("Barbados");
m_cbCountry.AddString("Belgium");m_cbCountry.AddString("Brazil");
m_cbCountry.AddString("British Ind. Ocean Territory");m_cbCountry.AddString("Bulgaria");
m_cbCountry.AddString("Cameroon");m_cbCountry.AddString("Canada");
m_cbCountry.AddString("China");m_cbCountry.AddString("Colombia");
m_cbCountry.AddString("Costa Rica");m_cbCountry.AddString("Croatia");
m_cbCountry.AddString("Curacao");m_cbCountry.AddString("Cyprus");
m_cbCountry.AddString("Czech Republic");m_cbCountry.AddString("Denmark");
m_cbCountry.AddString("Dominican Republic");m_cbCountry.AddString("Ecuador");
m_cbCountry.AddString("Egypt");m_cbCountry.AddString("El Salvador");
m_cbCountry.AddString("Estonia");m_cbCountry.AddString("Ethiopia");
m_cbCountry.AddString("Fiji");m_cbCountry.AddString("Finland");
m_cbCountry.AddString("France");m_cbCountry.AddString("Germany");
m_cbCountry.AddString("Greece");m_cbCountry.AddString("Guam");
m_cbCountry.AddString("Honduras");m_cbCountry.AddString("Hungary");
m_cbCountry.AddString("Iceland");m_cbCountry.AddString("India");
m_cbCountry.AddString("Indonesia");m_cbCountry.AddString("Ireland");
m_cbCountry.AddString("Israel");m_cbCountry.AddString("Italy");
m_cbCountry.AddString("Ivory Coast(Cote D'Ivoire)");m_cbCountry.AddString("Jamaica");
m_cbCountry.AddString("Japan");m_cbCountry.AddString("Kenya");
m_cbCountry.AddString("Kuwait");m_cbCountry.AddString("Lithuania");
m_cbCountry.AddString("Luxembourg");m_cbCountry.AddString("Madagascar");
m_cbCountry.AddString("Malaysia");m_cbCountry.AddString("Maldives");
m_cbCountry.AddString("Malta");m_cbCountry.AddString("Mauritius");
m_cbCountry.AddString("Mexico");m_cbCountry.AddString("Mongolia");
m_cbCountry.AddString("Morocco");m_cbCountry.AddString("Netherlands");
m_cbCountry.AddString("New Zealand");m_cbCountry.AddString("Nicaragua");
m_cbCountry.AddString("Nigeria");m_cbCountry.AddString("Norway");
m_cbCountry.AddString("Oman");m_cbCountry.AddString("Peru");
m_cbCountry.AddString("Philippines");m_cbCountry.AddString("Poland");
m_cbCountry.AddString("Portugal");m_cbCountry.AddString("Puerto Rico");
m_cbCountry.AddString("Romania");m_cbCountry.AddString("Russian Federation");
m_cbCountry.AddString("Saint Lucia");m_cbCountry.AddString("Saudi Arabia");
m_cbCountry.AddString("Seychelles");m_cbCountry.AddString("Singapore");
m_cbCountry.AddString("South Africa");m_cbCountry.AddString("South Korea");
m_cbCountry.AddString("Spain");m_cbCountry.AddString("Sri Lanka");
m_cbCountry.AddString("Sudan");m_cbCountry.AddString("Sweden");
m_cbCountry.AddString("Switzerland");m_cbCountry.AddString("Taiwan");
m_cbCountry.AddString("Thailand");m_cbCountry.AddString("Trinidad/Tobago");
m_cbCountry.AddString("Tunisia");m_cbCountry.AddString("Turkey");
m_cbCountry.AddString("U.A.E");m_cbCountry.AddString("United Kingdom");
m_cbCountry.AddString("Uruguay");m_cbCountry.AddString("USA");
m_cbCountry.AddString("Venezuela");m_cbCountry.AddString("Vietnam");
}
void CMyParDlg::FillCheckinDay()
{
m_cbCheckinDay.AddString("1");m_cbCheckinDay.AddString("2");
m_cbCheckinDay.AddString("3");m_cbCheckinDay.AddString("4");
m_cbCheckinDay.AddString("5");m_cbCheckinDay.AddString("6");
m_cbCheckinDay.AddString("7");m_cbCheckinDay.AddString("8");
m_cbCheckinDay.AddString("9");m_cbCheckinDay.AddString("10");
m_cbCheckinDay.AddString("11");m_cbCheckinDay.AddString("12");
m_cbCheckinDay.AddString("13");m_cbCheckinDay.AddString("14");
m_cbCheckinDay.AddString("15");m_cbCheckinDay.AddString("16");
m_cbCheckinDay.AddString("17");m_cbCheckinDay.AddString("18");
m_cbCheckinDay.AddString("19");m_cbCheckinDay.AddString("20");
m_cbCheckinDay.AddString("21");m_cbCheckinDay.AddString("22");
m_cbCheckinDay.AddString("23");m_cbCheckinDay.AddString("24");
m_cbCheckinDay.AddString("25");m_cbCheckinDay.AddString("26");
m_cbCheckinDay.AddString("27");m_cbCheckinDay.AddString("28");
m_cbCheckinDay.AddString("29");m_cbCheckinDay.AddString("30");
m_cbCheckinDay.AddString("31");
}
void CMyParDlg::FillCheckinMonthYear()
{
m_cbCheckinMonthYear.AddString("Dec 2007");m_cbCheckinMonthYear.AddString("Jan 2008");
m_cbCheckinMonthYear.AddString("Feb 2008");m_cbCheckinMonthYear.AddString("Mar 2008");
m_cbCheckinMonthYear.AddString("Apr 2008");m_cbCheckinMonthYear.AddString("May 2008");
m_cbCheckinMonthYear.AddString("Jun 2008");m_cbCheckinMonthYear.AddString("Jul 2008");
m_cbCheckinMonthYear.AddString("Sep 2008");m_cbCheckinMonthYear.AddString("Oct 2008");
m_cbCheckinMonthYear.AddString("Nov 2008");m_cbCheckinMonthYear.AddString("Dec 2008");
}
void CMyParDlg::FillCheckoutDay()
{
m_cbCheckoutDay.AddString("1");m_cbCheckoutDay.AddString("2");
m_cbCheckoutDay.AddString("3");m_cbCheckoutDay.AddString("4");
m_cbCheckoutDay.AddString("5");m_cbCheckoutDay.AddString("6");
m_cbCheckoutDay.AddString("7");m_cbCheckoutDay.AddString("8");
m_cbCheckoutDay.AddString("9");m_cbCheckoutDay.AddString("10");
m_cbCheckoutDay.AddString("11");m_cbCheckoutDay.AddString("12");
m_cbCheckoutDay.AddString("13");m_cbCheckoutDay.AddString("14");
m_cbCheckoutDay.AddString("15");m_cbCheckoutDay.AddString("16");
m_cbCheckoutDay.AddString("17");m_cbCheckoutDay.AddString("18");
m_cbCheckoutDay.AddString("19");m_cbCheckoutDay.AddString("20");
m_cbCheckoutDay.AddString("21");m_cbCheckoutDay.AddString("22");
m_cbCheckoutDay.AddString("23");m_cbCheckoutDay.AddString("24");
m_cbCheckoutDay.AddString("25");m_cbCheckoutDay.AddString("26");
m_cbCheckoutDay.AddString("27");m_cbCheckoutDay.AddString("28");
m_cbCheckoutDay.AddString("29");m_cbCheckoutDay.AddString("30");
m_cbCheckoutDay.AddString("31");
}
void CMyParDlg::FillCheckoutMonthYear()
{
m_cbCheckoutMonthYear.AddString("Dec 2007");m_cbCheckoutMonthYear.AddString("Jan 2008");
m_cbCheckoutMonthYear.AddString("Feb 2008");m_cbCheckoutMonthYear.AddString("Mar 2008");
m_cbCheckoutMonthYear.AddString("Apr 2008");m_cbCheckoutMonthYear.AddString("May 2008");
m_cbCheckoutMonthYear.AddString("Jun 2008");m_cbCheckoutMonthYear.AddString("Jul 2008");
m_cbCheckoutMonthYear.AddString("Sep 2008");m_cbCheckoutMonthYear.AddString("Oct 2008");
m_cbCheckoutMonthYear.AddString("Nov 2008");m_cbCheckoutMonthYear.AddString("Dec 2008");
}
void CMyParDlg::FillHotels()
{
m_cbHotels.AddString("Hilton Hotels");m_cbHotels.AddString("All Hilton Family Hotels");
}
void CMyParDlg::FillGuestRooms()
{
m_cbGuestRooms.AddString("1-4");
m_cbGuestRooms.AddString("5");m_cbGuestRooms.AddString("6");
m_cbGuestRooms.AddString("7");m_cbGuestRooms.AddString("8");
m_cbGuestRooms.AddString("9");m_cbGuestRooms.AddString("10");
m_cbGuestRooms.AddString("11");m_cbGuestRooms.AddString("12");
m_cbGuestRooms.AddString("13");m_cbGuestRooms.AddString("14");
m_cbGuestRooms.AddString("15");m_cbGuestRooms.AddString("16");
m_cbGuestRooms.AddString("17");m_cbGuestRooms.AddString("18");
m_cbGuestRooms.AddString("19");m_cbGuestRooms.AddString("20");
m_cbGuestRooms.AddString("21");m_cbGuestRooms.AddString("22");
m_cbGuestRooms.AddString("23");m_cbGuestRooms.AddString("24");
m_cbGuestRooms.AddString("25");m_cbGuestRooms.AddString("26 or more");
}
|
|
|
|
|
|
1. I got bored after the 83rd paragraph.
2. We play by rules[^] here.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
What is it?
if its an article you can submit it on the codeproject
if you have any question please say it
if you have any bug in this code please dont copy all your code.
and please use of correct title.
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
42....well someone had to do it.
|
|
|
|
|
Hi all
i m using GotoDlgCtrl for set focus on button control in dialog box.becoz setfocus function not working on button control.
but GotoDlgCtrl is not working in form view.
so please tell me what can i use for setfocus on button control in formview.
thanks in advance.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
If this is MFC, a formview is just a wrapper around a modeless dialog box.
So, rather than setfocus...
WM_NEXTDLGCTL
This message performs additional dialog box management operations beyond those performed by the SetFocus function WM_NEXTDLGCTL updates the default pushbutton border, sets the default control identifier, and automatically selects the text of an edit control (if the target window is an edit control).
Hope that helps!
Iain.
Codeproject MVP for C++, I can't believe it's for my lounge posts...
|
|
|
|
|
Thanks sir its done now.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
modified on Friday, February 27, 2009 7:22 AM
|
|
|
|
|
If you have used DDX_Control on the formview item you can do:
m_controlVariable.SetFocus()
if not, you can use
GetDlgItem(IDC_CONTROL_ID)->SetFocus();
If you vote me down, my score will only get lower
|
|
|
|
|
not sir its not working.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
hi...
i am new to serial port programmming...my problem is as folloes...
i have to write a command to a plc connected to my serial port of windows os and then read the data from the same serial port.both read and writre take place continously for every one minute..how do i go about doing this...i am programing using c..also do i need to use threaads??
is there any code available for this??
|
|
|
|
|
rao_abhilash wrote: also do i need to use threaads??
Probably.
rao_abhilash wrote: is there any code available for this??
Yes, free code at my magic site www.cpallini.free.serialport.threadz.codez.com.
Or you may try the CP article search engine [^].
BTW: Have you read forum guidelines [^]?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
In addition to codeproject, the following web page explains a lot of the problems / misconceptions / solutions to working with serial ports.
http://www.flounder.com/serial.htm[^]
Very well worth a read, even if I don't follow everything he says like gospel.
Iain.
Codeproject MVP for C++, I can't believe it's for my lounge posts...
|
|
|
|
|
rao_abhilash wrote: do i need to use threaads??
No, so long as you don't mind your application not responding to any input while the serial IO is occurring. If it's a console application, then that is probably fine.
rao_abhilash wrote: how do i go about doing this
The general procedure is this:
- Create a handle to the port with
CreateFile - Set the port parameters with
SetCommState - Send data to your plc with
WriteFile - Get data sent by your plc with
ReadFile - When you're done, close the port handle
Really, it's as simple as that if you ignore things like asynchronous IO etc.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
The PLC manual will tell you:
What start and stops codes to use before and after the body of the messages. Possibly something like no start-code and a stop code of CR LF after the message, though the PLC programmer may have changed it to use custom start and stop codes.
The PLC manual will also give you the default baud rate, parity and so on to set your PC port up to.
I'd definitely recommend using a port monitor tool such as PortMon on the PC to see what's really being transmitted and Received (as opposed to what you think should be).
I've had a PC communicating with an Omron PLC and my biggest headache w as having to relearn the PLC's ladder logic!
|
|
|
|
|
thnk everybody for ur kind suggestion....how ever i have done serial programming before werin i transferred around 30 bytes of binary data to and fro between windows and linux machine...it was succesfull... my question now is when i have to read and write data alternatly one at a time using same serial port, does the initailaiztion or tyhe code change??.. if yes what changes are to be done..??
|
|
|
|
|
One port both covers reading and writing which, though there are ways of squeezing out extra performance, can be done basically and quite simply using the steps Stuart gave then just repeating Read, Write, Read, Write etc.
|
|
|
|
|
Hi All
How can i get USB Drive Letter size?Plz help me
|
|
|
|
|