|
On a side issue, try to make r static const . The static is particularly important: the regular expression should only be "compiled" once, not every time.
Steve
|
|
|
|
|
Thanks, but that did not matter...
This is the exact error message:
Unhandled exception at 0x7c81eb33 in Hierarchy Explorer.exe: Microsoft C++ exception: boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::regex_error> > at memory location 0x0012ddc4..
|
|
|
|
|
I knew it wouldn't help, it was a side issue. Can you post a small self-contained program that exhibits the problem?
Steve
|
|
|
|
|
Your regular expression isn't valid. What's more, the program is trying to tell you what's wrong. I used the following code:
void Go()
{
try
{
CString path = _T("abcd");
static const boost::tregex r(_T("*bc"));
boost::tmatch what;
if(boost::regex_match(path, what, r))
{
}
else
{
}
}
catch (const boost::regex_error &e)
{
cout << e.what() << endl;
throw;
}
}
The following error is the result:
The repeat operator "*" cannot start a regular expression. The error occured while parsing the regular expression: '>>>HERE>>>*bc'.
The regular expression you're probably after is: .*bc
Steve
|
|
|
|
|
Thats it!
I will have to give the boost syntax more attention... thank you!!
|
|
|
|
|
The syntax isn't boost specific, it's standard regular expression syntax.
Steve
|
|
|
|
|
You're right.
I've played a while with the syntax... you can use it for almost enything!
Actually I have been looking for filter like it is used in SQL queries. I Only wanted to use the *, ?, bracket, AND, OR-statements.
Are regular expressions perhaps a bit too complex for that purpose?
I don't want people to study regular expressions before using my program.
Do you perhaps have a recommendation to me?
|
|
|
|
|
A basic understanding of regular expressions is kind of an must have these days.
Steve
|
|
|
|
|
Hi ALL,
outside a while loop, I declare a 3-D vector array
vector<struct Person> Psodu;
Psodu.reserve(10);
vector<vector<vector<struct Person> > > structPersonVar(2, vector<vector<struct Person> >(2,Psodu));
in the while loop, i have to change the size of the array in every iteration.
First, I use the following code to release the memory
<br />
for(int j=0; j < 2; j++)<br />
{<br />
for(int k =0; k < 2; k++)<br />
{<br />
vector<struct Person>().swap(structPersonVar[j][k]);<br />
}<br />
vector<vector<struct Person> >().swap(structPersonVar[j]);<br />
}<br />
<br />
vector<vector<vector<struct Person> > >().swap(structPersonVar);<br />
<br />
Then, I resize the array
structPersonVar.resize(20);
for(j=0; j < 12; j++)
{
structPersonVar[j].resize(2);
for(int k =0; k < 2; k++)
{
structPersonVar[j][k].reserve(10);
}
}
I am not very sure whether i am correct by doing in this way,though it works fine with testing program.
|
|
|
|
|
Hello ALL,
Initially, I declare Var[1][1] as
vector<vector<string> > Var(1, vectort<string> (1));
later, I want to expand Var to be Var[5][6]
How to do this.
Thanks
modified on Monday, April 18, 2011 11:10 AM
|
|
|
|
|
You want Var to grow to 5 and each element in Var to grow to 6. If i got it correctly, this can be a solution.
vector<vector<string> > Var(1, vector<string>(1));
Var.resize(5);
for (int i=0; i<5; ++i)
{
Var[i].resize(6);
}
|
|
|
|
|
My Configuration is VS2008 MFC statically linked app. I have been compiling my app over a 1000 times and am intune with the size of the exe. It has slightly more than doubled in size as of this week ever since the windows update on April 14. For the time being I am compiling at my alternate computer that has "Automatic Windows Update" turned off and get the usual size of the executable. Has anyone else observed this. I have compiled other projects and have noticed the same pattern - exe doubles in size.
|
|
|
|
|
try turning the MAP file on as a link option, on both machines and compare the output
is this release or debug?
|
|
|
|
|
Thank you for responding barnyman.
This is a release build (both of them). Since reporting the problem I have some additional information. I ran both executables (the big and the small one) on the same computer and used the ProcessMonitor tool to determine and compare the dll's that each was loading. The results show the larger exe is loading 4 additional dll's. They are:
dwmapi.dll
msimg32.dll
winmm.dll
gdiplus.dll
I am not using any code the needs these dll's.
In my projects settings: Linker->Input->Ignore Specific Libray settings, I blocked all of the lib files that depend on these dll's and can't compile the project. This tells me there is some new dependency that has formed.
In searching the Internet I learned that programmers that have moved to VS2010 are having the same problem. It seems there are some MFC files that have some built in dependencies to the MFC feature pack even though their project is not using them. I suspect that is what is going on with my project even though I am still using VS2008. The most latest Windows update made that happen. (I have used the MFC feature pack in some other projects but don't do that anymore. I can do it all without it.)
This experience gives new meaning to the concept of VC_EXTRALEAN and dare I say WIN32_LEAN_AND_MEAN from back in the day. More to come.
Once again thanks for your time barneyman.
Art
|
|
|
|
|
Please let us know if you find a way around this.
|
|
|
|
|
The problem has been fixed with the recent June 15, 2011 Windows update. Back to normal. What a relief!
|
|
|
|
|
Thanks for letting us know.
|
|
|
|
|
Hi,
I am facing a strange problem with the existing code. it suddenly started failing. The problem happens only in one of the machines, while the same code works in other machines.
It fails at the below line.
obj1 = new _objifptr(_uuidof(objif));
I did check that __uuidof returns the correct uuid. but fails when "new _objifprt" is called. The .dll, .tlb and .pdb are all available in the working directory. They have been registered using regasm successfully.
I see that the errors thrown are
FileLoadException followed by TypeInitializationException.
Please help with your thoughts.
Thanks,
Dhana.
|
|
|
|
|
I Want to draw one line in two windows, when I move my mouse in one window, I draw one line from top to bottom。
There is another window at the bottom of this window,I also want to draw one line in this window, if I Sendmessage to do it,
It looks like draw two lines。
|
|
|
|
|
You need to give some more details about this, the normal way is to capture the details of the line(s) in your program somewhere (e.g. on mouse moves) and then render the actual details in your paint procedure(s), and each window should have its own paint handler.
|
|
|
|
|
I am developing a viz plugin for WMP and I'm having an issue with the property page "saving" the changes I make. I generated the plugin files from the wizard found in the latest Windows SDK - this is mainly straight from the wizard and doesn't work out of the box. Great job, Microsoft!
The plugin dumps out color values over a network socket. That part works fine and no issues. I have implemented a 'property page' dialog box that, in theory, lets you pick the color value that will be sent.
In my property page dialog box code, I am setting a pointer to the plugin class itself so I can access it's variables. After exiting the dialog box though, the vis plugin class' constructor gets called again, thereby re-initializing the variable i just modified. because of this, i am unable to change any variables and the property page dialog box is useless.
My plugin class is named <b>CWmpplugin1</b>
Here are the methods of the plugin I think are relevant to this issue:
CWmpplugin1::CWmpplugin1() :
m_hwndParent(NULL),
m_clrForeground(0x0000FF),
m_nPreset(0)
{
wcsncpy_s(m_wszPluginText, sizeof(m_wszPluginText) / sizeof(m_wszPluginText[0]), L"DEFAULT", sizeof(m_wszPluginText) / sizeof(m_wszPluginText[0]));
}
wcsncpy initializes the public variable m_wsxPluginText to "DEFAULT". Problem is, this gets called after leaving the property page dialog box, so that string is always set to "DEFAULT"
STDMETHODIMP CWmpplugin1::DisplayPropertyPage(HWND hwndOwner)
{
CPropertyDialog dialog(this);
dialog.DoModal(hwndOwner);
return S_OK;
}
STDMETHODIMP CWmpplugin1::GetCapabilities(DWORD * pdwCapabilities)
{
if (NULL == pdwCapabilities)
{
return E_POINTER;
}
*pdwCapabilities = EFFECT_HASPROPERTYPAGE;
return S_OK;
}
My dialog implementation (ATL):
#include "atlwin.h"
class CPropertyDialog : public CDialogImpl<CPropertyDialog>
{
public:
enum { IDD = IDD_PROPERTYDIALOG };
BEGIN_MSG_MAP(CPropertyDialog)
MESSAGE_HANDLER( WM_INITDIALOG, OnInitDialog )
COMMAND_ID_HANDLER( IDOK, OnOK )
COMMAND_ID_HANDLER( IDCANCEL, OnCancel )
END_MSG_MAP()
CPropertyDialog(CWmpplugin1 *pPlugin)
{
m_pPlugin = pPlugin;
}
private:
CWmpplugin1 *m_pPlugin;
On constructor being called, I am getting the pointer to the plugin object.
LRESULT OnOK(WORD wNotifyCode, WORD wID, HWND hwndCtl, BOOL& fHandled)
{
wcsncpy_s(m_pPlugin->m_wszPluginText, sizeof(m_pPlugin->m_wszPluginText) / sizeof(m_pPlugin->m_wszPluginText[0]), L"CHANGED!", sizeof(m_pPlugin->m_wszPluginText) / sizeof(m_pPlugin->m_wszPluginText[0]));
EndDialog( IDOK );
return 0;
}
After you click the OK button on the dialog box, wcsncpy copies "CHANGED!" to mpPlugin->m_wszPluginText.
I attached a debugger and verified that the string is actually changing the value, but again, once the dialog exits, the plugin object constructor is called again and the string changes back to "DEFAULT" like before.
Anybody know what I'm doing wrong? Is the constructor getting called again normal operation? I thought once the DLL was loaded by WMP, it would create an instance of the plugin object that lasts for the entire time WMP is in memory.
Much thanks for any help!
|
|
|
|
|
I would like to handle LVN_DELETEITEM in my subclass:
class DailyProgramListView :
public ATL::CWindowImpl<DailyProgramListView, WTL::CListViewCtrl, ATL::CWinTraitsOR<LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SINGLESEL>>,
public WTL::CCustomListViewDraw<DailyProgramListView> {
BEGIN_MSG_MAP_EX(DailyProgramListView)
MSG_WM_CREATE(OnCreate)
MSG_WM_SIZE(OnSize)
REFLECTED_NOTIFY_CODE_HANDLER_EX(LVN_DELETEITEM, onDeleteItem)
NOTIFY_CODE_HANDLER_EX(LVN_DELETEITEM, onDeleteItem)
CHAIN_MSG_MAP_ALT(WTL::CCustomListViewDraw<DailyProgramListView>, 1)
DEFAULT_REFLECTION_HANDLER()
END_MSG_MAP()
};
For some reason, the LVN_DELETEITEM is still only posted to the parent of the listview.
The parent has REFLECT_NOTIFICATIONS_EX() in its MSGMAP.
Happy coding,
Philipp Kursawe
|
|
|
|
|
Dears,
Please see the below code.
int main(int argc, char* argv[])
{
int* p = new int;
*p = 0;
int& k = *p;
k = 15;
return 0;
}
Doubt is regarding the reference usage as specified in int& k = *p; .
Actually this code works fine. But I want to know whether this code is OK or not. I mean whether any issues will happen in future.
Thanks in advance,
Krishnakumar
|
|
|
|
|
Krishnakumartg wrote: I mean whether any issues will happen in future.
In respect of what? Since this code effectively does nothing it's impossible to guess what issue you are facing.
|
|
|
|
|
Actually i wrote the sample code here.
I want to use similar code in one of my projects.
|
|
|
|