|
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.
|
|
|
|
|
Krishnakumartg wrote: I want to use similar code in one of my projects.
I see no reason not to. However if you have a further question please post it.
|
|
|
|
|
You mean that its an obvious thing.. right??
i am just confirming it
|
|
|
|
|
Krishnakumartg wrote: You mean that its an obvious thing.. right??
What is? I am still not sure what your concerns are.
|
|
|
|
|
Hi all!
I am developing an add-in for Word 2003. It can insert a bitmap into .doc file after some operations by user.
Question:
When I insert only one BMP into .doc file, the picture can display correctly. If more than one BMP inserted, the picture can't displayed after save and re-open. I research this problem and find that the method named "InPlaceActivate" is called while only one BMP inserted. If more BMPs are inserted, this method can't be called. I am not sure which interface owned this method. So I research the interfaces be queried in both scenery. The different between them is that the interface as "IID_IOleXXX" will be queried if I add only one BMP. If I add more BMP into .doc file, those interfaces as "IID_IOleXXX" aren't be queried. Then the BMP can't be displayed. I think this is the reason. I try to resolve it by many ways. But all failed. Is there anybody could be kind to help me? Thank you!
Best regards!
There is some white cloud floating on the blue sky. That's the landscape I like.
modified on Tuesday, March 29, 2011 4:06 AM
|
|
|
|
|
Hi
I just wanted to replace a '%' character in CComBSTR with "%%". But the code does not support CString. The solution should be UNICODE support.
Any methods to perform this operation ?
Thanks In Advance.
Babu
Today is a gift, that's why it is called the present.
|
|
|
|
|
CComBstr class doesn't have a method to replace a sub-string with another or to insert another string in specified position. All you can do is, get BSTR which is wrapped in CComBSTR class ( either by m_str member or by operator BSTR). You need to copy this to another CComBSTR. You may use its Append() method or overloaded += operators for ease.
CComBSTR str("here%are%percentages%");
CComBSTR newstr;
WCHAR split[] = L"%";
WCHAR* pos = wcstok(str.m_str, split);
while(0 != pos) {
newstr.Append(pos);
newstr.Append(L"%%");
pos = wcstok(NULL, split);
}
NOTE:
I would like to remind that BSTR data type has preceding header components, and the final string is terminated with double null characters. This is how system allocates memory for BSTR. There can be embedded single null characters in BSTR string data. In that case, wcslen() and wcstok() functions won't work as expected. Use CComBSTR::Length() or SysStringLen() to get length of string. You may need to examine each character in string till you find two continuous '\0' characters. During this, whenever you find a '%' add an additional '%' more tho the new string.
Unicode support is completely ensured.
modified on Thursday, March 24, 2011 9:09 AM
|
|
|
|