|
You can try
template< typename T >
struct curve_lt : public binary_function <T, T, bool>
{
bool operator()( const T &rhs, const T &lhs )
{
return rhs.getDate() < lhs.getData();
}
};
......
i = lower_bound(vector.begin(), vector.end(), &c, curve_lt());
|
|
|
|
|
It turned out that I called the routine correctly 5 times, on the sixth call, I had the wrong kind of parameter there, (an iterator as opposed to the actual class). Somehow that caused an error in all six places the function was called.
|
|
|
|
|
On a side note, a few changes will makes things better. First change this function by adding the underlined bits:
bool exp_LT(const curvePoint<double> &lhs, const curvePoint<double> &rhs) { return (lhs.getExp() < rhs.getExp()); }
Now change the class as follows (again, by adding the underlined bits):
public:
void setValue(_Ty p) { _mValue = p; }
_Ty getValue() const { return _mValue; }
void setDate(Date d) { _mDate = d; }
inline void setDate(long d) { _mDate = d; }
Date getDate() const { return _mDate; }
void setExp(Date d) { _expDate = d; }
void setExp(long d) { _expDate = d; }
Date getExp() const { return _expDate; }
Steve
|
|
|
|
|
Hi All,
I am working on a project which has 2 seperate processes.
1. MFC Dialog application
2. Windows Service written in C#
I want to send a user defined message from MDF Dialog application to the Windows service written in C#
Send message/post message dosent work as it need a handle to the window of the receiver, which we will not have in case of a service.
How can i accomplish this.
Thanks everyone.
|
|
|
|
|
There are many other IPC methods - named pipes, shared memory, mailslots, etc. I've unsed name pipes in the past, but I can;t say they're the best.
Iain.
Codeproject MVP for C++, I can't believe it's for my lounge posts...
|
|
|
|
|
Dear sir,
I am using the "MimeSniffer.dll" for opening the eml files.
The eml files without the attachment is opened perfectly without any problems.
But when i tried to open the eml file having attachments, i was not able to get the body text of that eml file.
Sir, i have pasted the content of eml file, that i tried to open, below:
Please suggest me some solution for this.
Thanks & Regards
Sandeep
/****************************************************************************/
From: <xyz@xyz.com>
To: <abc@abc.com>
Subject: test mail
Date: Mon, 19 Jan 2009 16:42:46 +0530
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="----=_NextPart_000_0019_01C97A54.F7104550"
X-Priority: 3
X-MSMail-Priority: Normal
X-Unsent: 1
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3350
This is a multi-part message in MIME format.
------=_NextPart_000_0019_01C97A54.F7104550
Content-Type: multipart/alternative;
boundary="----=_NextPart_001_001A_01C97A54.F7104550"
------=_NextPart_001_001A_01C97A54.F7104550
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
hi=20
this is test mail.
hi=20
this is test mail.
hi=20
this is test mail.
hi=20
this is test mail.
hi=20
this is test mail.
------=_NextPart_001_001A_01C97A54.F7104550
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
charset=3Diso-8859-1">
|
|
|
|
|
I have some richedit controls in form view.
When doing mouse wheel scroll, I am getting notification message to OnNotify() function by setting ENM_SCROLLEVENTS mask to the richedit control.
But I want the OnMouseWheel() function to be called as I want to do scrolling of Form view like this inside "OnMouseWheel()":
<br />
OnMouseWheel(UINT fFlags, short zDelta, CPoint point)<br />
{<br />
if (fFlags & (MK_SHIFT | MK_CONTROL))<br />
return FALSE;<br />
<br />
return DoMouseWheel(fFlags, zDelta, point);<br />
}<br />
How to do this.
Or can I do scrolling by using OnNotify() itself?
Thanks & Regards,
Sabapathy
|
|
|
|
|
Looking at the docs[^], you'll get sent an EN_MSGFILTER[^] notification, which includes a pointer to a MSGFILTER[^] structure. This structure includes the original mouse wheel message, which you could send to the form? So, if I understand your question correctly, you could do the scrolling by forwarding the mouse wheel message to the form.
|
|
|
|
|
Hello All,
I am doing SDI application in MFC (VC++) . In that parent, window is having a Menu Bar. When I select one of the Menu option from parent window, another child window will be created. This child window is having its own Menu Bar.
Problem is that this Menu Bar’s submenu is disabled at starting. But when I click on child window’s view, this child window’s submenu item is enabled. How can I enable child window’s submenu item without clicking on child window’s view.
I written the follwing code in the Parent window's MenuBar. When i click on this Parent window sub menu item, child window is created of the name "Bed1" and attach the MenuBar IDR_MENU1 to this chile window
//////
CFrameWnd* pFrame ;
pFrame = new CFrameWnd;
if(!pFrame->Create(NULL,_T("Bed1"),WS_OVERLAPPEDWINDOW ,CRect(0,0,200,200),this,MAKEINTRESOURCE(IDR_MENU1),NULL,&newContext))
{
TRACE0("Failed to create MenuBar");
}
pFrame->SetWindowPos(NULL,rect.left,rect.top,rect.Width()/2,rect.Height()/2,SWP_SHOWWINDOW);
//////
If anybody know the solution, please help.
|
|
|
|
|
I want to show hotkey for menu items like "Ctrl + L" etc.
I have given it with "\t" like "E-mail\tCtrl + E" to align it in right side.
But when running application, the hotkey text is not visible.
Instead of tab, if I give spaces, it is showing, but alignment is varying between systems.
How to solve this, is there any other way to do this?
|
|
|
|
|
Are you doing any sort of menu owner drawing?
If in doubt, create a brand new project, SDI app, and try tweaking that menu. If the new project works, and yours does not - you need to track down the error.
Iain.
Codeproject MVP for C++, I can't believe it's for my lounge posts...
|
|
|
|
|
I am using Xtreme Toolkit's CXTPToolbar to load the menu and other toolbars.
Instead of CFrameWnd, I am deriving my mainframe class from CXTPFrameWnd as I am using many stuff from Xtreme Toolkit for GUI style & design.
|
|
|
|
|
Well, you can do the step I suggested and create a virgin project. If that works correctly, you have either found a bug in CXTPxxxx, or a bug in your useage of it.
If you can confirm then, then maybe they have a forum there that can help you? You can still try here of course - just because I have no clue about this tookit doesn't mean nobody does - but you'll stand a better chance on their forums.
Good luck,
Iain.
Codeproject MVP for C++, I can't believe it's for my lounge posts...
|
|
|
|
|
Hello,
I'm facing problems with the two-stage name lookup for templates, and I'm wondering what could be the right way to deal with it.
The issue is that non dependent names of template base class can not be "seen" at parse time in the derived class, and must therefore be made dependent, either using "this->" or qualification "base<T>::"
I can understand the usefullness of 2 stage name lookup, but also having all members and functions of base class used through "this->" in the derived class is "not a standard" and is ugly.
So What should be the right way of coding to work around this?
Thanks.
BR.
|
|
|
|
|
Can you post a sample code? What's the version of your compiler?
-Sarath.
"Great hopes make everything great possible" - Benjamin Franklin
|
|
|
|
|
One alternative mentioned by the GCC docs[^] is this:
template <typename T> struct Base
{
int i;
};
template <typename T> struct Derived : public Base<T>
{
using Base<T>::i;
int get_i()
{
return i;
}
};
i.e. have a using declaration to bring the base classes name into the derived classes scope. This declaration has to be at the class, not in the method(s) that use the base classes name.
[edit] PS - as far as I can tell, no Microsoft C++ compiler up to and including the one in Visual Studio 2008 does this as per the standard - it will see the non-dependent name even though it's not meant to. g++ does conform to the standard, however, and has done since at least gcc 3.4.2 (which is the earliest one I've got access to). [/edit]
|
|
|
|
|
Thanks Stuart for the reply.
"using" declaration can be in fact more practical...
About the compiler, I tried with gcc4.0.1.
|
|
|
|
|
In the same context, I'm trying to minimize the changes and extra code to be added in derived class, is there a way to group together the non dependent names? Can the keyword "export" be of any help?
Thanks for any suggestion.
Regards.
|
|
|
|
|
f_jo wrote: Can the keyword "export" be of any help?
Unlikely, given that export is supported by Comeau ++ and Borland C++ (possibly) and...well, that's it...
f_jo wrote: In the same context, I'm trying to minimize the changes and extra code to be added in derived class, is there a way to group together the non dependent names?
Not entirely sure what you mea.
|
|
|
|
|
Hi,
I'm writing a small app that uses plug ins in for of DLLs that export a class, to get the best compatibility I used am abstract interface as described in http://www.codeproject.com/KB/DLL/dlltips.aspx[^]
But I'm not sure what to do with functions that has to return a string, or that takes a reference to a string as parameter and modifyed it so that one function fills 3 strings.
afaik I should only use LPWSTR as parameter and in such functions and dont return any strings directly, but this brings the problem that I have to know prior how long the string may become, or define a max length that is always prealocated and the string cant be longer.
Is there some way that does not require much code how to properly pass the strings to the application?
Using 3x (GetStrLen & PutStr) functions isn't that prety.
I thought about allocating a WCHAR array in the dll and passing it to the client copying there and unalocating but afaik to be 100% correct i would need to dealocate it again inside the dll so it would have to give me an free function.
What would be the best way here?
|
|
|
|
|
There's not really one 'proper' way to do it - Microsoft use both techniques at different places in Windows (the Win32 API generally requires you to allocate strings in user code, while OLE has a custom allocator[^].
I'd probably go with the user pre-allocating buffers and telling me how large they were, like Win32.
Alternatively, you could probably design a string class (yet another string class!) that ensured that memory allocation and deallocation was performed inside your DLL (via constructor and destructor) without the DLL's client having to do too much work.
|
|
|
|
|
Hi
Is there a way to convert a text file into an image file(tiff file).
Thank you
Saadhinchaali
|
|
|
|
|
1. Open your text file in notepad.
2. Alt+Print Screen,
3. Copy to your favorite image editor save as TIFF(Paint .NET is free and a nice choice)
Normally Text file contains ASCII characters and TIFF file contains binary data with image headers, pixel data and any other associated information related to TIFF....
Please make your question clear. What's the content of your text file? and how you want to be converted?
-Sarath.
"Great hopes make everything great possible" - Benjamin Franklin
|
|
|
|
|
Nice steps...
- ns -
|
|
|
|
|
HI,
Thats the esaiest way. Thank you for ur reply.
Saadhinchaali
|
|
|
|
|