|
You should be able to do that with bind2nd if you add an operator=(int) to CMyClass .
|
|
|
|
|
I considered that approach but decided against it since he only wants to search keyed on one member.
Steve
|
|
|
|
|
Sometimes I'm using operators to solve such issues:
class CMyClass
{
...
operator TType() const {return m_type;}
...
}
remove_if(begin(), end(), bind2nd(equal_to<CMyClass::TType>(), 999)
and was wondering is there another solution, without additional comparators or operators.
PS thank you for pointing me to the right direction
|
|
|
|
|
I want to write a ActiveX control for word, which has the transparent effect,which can't envelop the test in word document no matter what drawn in the control. But I don't know how to achieve the transparent effect. My English is poor. I hope you can follow me and can help me
|
|
|
|
|
Ni Hao,
To draw your control as transparent must Override the OnDraw() of the ActiveX.
If you Do nothing there the control will never be written ad you should see what lies bellow it.
Also you could use the function TransparentBlt() to draw any overlay you want.
A third option could be capturing the screen below the control an drawing it (for avoiding the .
HRESULT CCAxQuantMaster::OnDraw(ATL_DRAWINFO& di)
{
RECT& rc = *(RECT*)di.prcBounds;
// Set Clip region to the rectangle specified by di.prcBounds
HRGN hRgnOld = NULL;
if (GetClipRgn(di.hdcDraw, hRgnOld) != 1)
hRgnOld = NULL;
bool bSelectOldRgn = false;
HRGN hRgnNew = CreateRectRgn(rc.left, rc.top, rc.right, rc.bottom);
if (hRgnNew != NULL)
{
bSelectOldRgn = (SelectClipRgn(di.hdcDraw, hRgnNew) != ERROR);
}
//Select Transparent Brush
SelectObject(di.hdcDraw, GetStockObject(NULL_BRUSH));
Rectangle(di.hdcDraw, rc.left, rc.top, rc.right, rc.bottom);
}
JO
|
|
|
|
|
Thank you all the same!
|
|
|
|
|
Hi there,
A number of years ago Kevin Kostrzewa published an article entitle "STL-Style Iterators for MFC", would anybody out there have a recently maintained version of his iterator class suite?. The current version I have contains a number of compiler errors and before I embark on fixing them I just though I'd ask around first to same a bit of time.
Regards
|
|
|
|
|
Hello dear ATL experts,
While trying to compile a VC++ 6.0 project with VC++ 7.1, I have got the following error :
d:\TESTINGONLY\dbstudio\DSIFormat.h(58) : error C2664: '_com_ptr_t<_IIID>::_com_ptr_t(int)' : cannot convert parameter 1 from 'ATL::CComPtr<T>' to 'int'
with
[
_IIID=_com_IIID<StdFormat::IStdDataFormatDisp,& _GUID_6c51b910_900b_11d0_9484_00a0c91110ed>
]
and
[
T=StdFormat::IStdDataFormatDisp
]
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
This error is caused by the following instanciation
CComPtr<StdFormat::IStdDataFormatDisp> m_fmtBinary;
StdFormat::IStdDataFormatDisp is located in a .tlh file.
I am a newbee with COM and I guess it is an interface generated by the compiler.
Here is its definition
struct __declspec(uuid("6c51b910-900b-11d0-9484-00a0c91110ed"))
IStdDataFormatDisp : IDataFormatDisp
{
//
// Property data
//
__declspec(property(get=GetType,put=PutType))
enum FormatType Type;
__declspec(property(get=GetFormat,put=PutFormat))
_bstr_t Format;
}
It derives from
struct __declspec(uuid("e675f3f0-91b5-11d0-9484-00a0c91110ed"))
IDataFormatDisp : IDispatch
{};
IDataFormatDisp does nothing so I wonder why not deriving IStdDataFormatDisp direcly from IDispatch
Indeed the project works fine with visual c++ 6.0.
I thank you very much for your help.
|
|
|
|
|
Hi everybody,
If I can't find the question here, I wouldn't know were to look.
We handle 500 MB plus point cloud files from a CT Scanner in the dental field, from which large parts needs to be cut away and the output of material difference/artifacts needs to be cleaned up, before we can file this data as STL File. Now opening and working with these large files consume quit a lot of time. I am looking for a tool that enables us to work on these large files more easily.
For your information, I am not a programmer, for that reason I can only express myself in describing how I think it could work, which is as follows;
The tool could be a kind of pre point cloud reducer in form of an STL. This tool being able to reduce very large files, such as 500 MB or more point cloud, into 10% or less, then cutting and cleaning the surface in this <50MB file, and translating this information back to the original pointcloud file, in which all the cut areas and artifactes then are removed. The endresult is filled as STL.
Is there someone that has experience in this matter. It would be a great help if there was some kind of application that does this trick.
Thanks for your help, it's highly appreciated.
Malte de Moll
|
|
|
|
|
By STL, do you mean this[^]? Because the STL discussed in this forum is this one[^], which is very different. If this is the case, I suspect you're not going to get any useful responses
|
|
|
|
|
Hello dear friends,
How can we use the events of the JScript in ATL COM DLL?
Application scenario:
I've toolbar which is written in ATL.I want the toolbar to communicate with the the JScript.For example in Google toolbar you can add new button in the toolbar by clicking a button on the webpage.
I've webpage and when user pressed for example a link, I want that my
toolbar should be informed of this thing with the name of the link pressed to the toolbar.
A sample code is greatly appreciated.
ritz1234
|
|
|
|
|
Hi all,
How do I manipulate a checkbox?
I declared it as:
bool Check;
BEGIN_DDX_MAP(CPreferenceDlg)
DDX_CHECK(IDC_CHECK1, Check)
END_DDX_MAP()
How can I know if the checkbox is checked or not? If CComboBox is for combo box what is for a check box and listbox? How will I also declare a listbox?
This is what I do if its a textbox:
c_edEdit4.GetLine(0, Mail.GetBuffer(c_edEdit4.LineLength(0)));
Mail.ReleaseBuffer();
Email = Mail;
if (RegSetValueEx(Regentry,
_T("EmailAddress"),
0,
REG_SZ,
(LPBYTE) Email.c_str(),
(DWORD) (lstrlen(Email.c_str())+1)*sizeof(TCHAR)))
{
printf("Could not set the event message file.");
RegCloseKey(Regentry);
return 0;
}
Thanks,
Jayjay
|
|
|
|
|
I got it how i will get the value of the checkbox. Another question though. Now I am able to save at the registry if the checkbox is checked or not question is how can I make the checkbox checked already if it was saved as checked.
|
|
|
|
|
If you're using WTL/MFC and you've wrapped the control in a WTL/MFC CButton class, you use the SetCheck methods.
If you're using raw Win32, send the BM_SETCHECK message to the control's window.
|
|
|
|
|
Hi Stuart,
Thank I now got it sorted. Now arise another puzzle for me, with a checkbox unchecked I will have to disable two comboboxes, now how can I enable and disable it everytime the checkbox is being checked and unchecked.
Thanks,
Jj
|
|
|
|
|
1. In the checkbox's 'OnClick' handler, enable/disable the combo-boxes.
2. If you're using WTL, check out this article[^].
|
|
|
|
|
I made this button thats supposed to open an choose folder window then the user will choose a folder or create a folder where the files will be saved then the address of the folder after the user chooses will be put into a text box.
Any ideas how to do that?
Thanks
|
|
|
|
|
If you're using WTL, then you want CFolderDialog - see Michael Dunn's excellent article[^].
Otherwise, You need SHBrowseForFolder[^] for the whole choosing/creating a folder thing. I'll give you 10 extra bonus points if you can get it to start up displaying a folder of your choice (hint: you need to register a callback in the lpfn member of the structure whose address you pass as a parameter, and that callback needs to respond to BFFM_INITIALIZED by sending the BFFM_SETSELECTION with the folder).
Oh, and retrieving the folder that was selected? Yeah, you'll need to get friendly with PIDL s.
Alternatively, you could use the nice, easy to use wrapper for SHBrowseForFolder from this CP article[^]. Might be a little easier than using SHBrowseForFolder yourself.
|
|
|
|
|
Now i am having trouble with this:
BufferSize = TOTALBYTES;
PPERF_DATA_BLOCK PerfData = (PPERF_DATA_BLOCK) malloc( BufferSize );
Size = BufferSize;
dwRet = RegQueryValueEx(Regentry, _T("DownloadPath"), NULL, &Type, reinterpret_cast<LPBYTE>(DownloadPath), &Size);
while( dwRet == ERROR_MORE_DATA )
{
BufferSize += BYTEINCREMENT;
PerfData = (PPERF_DATA_BLOCK) realloc( PerfData, BufferSize );
Size = BufferSize;
dwRet = RegQueryValueEx(Regentry, _T("DownloadPath"), NULL, &Type, reinterpret_cast<LPBYTE>(DownloadPath), &Size);
}
if( dwRet == ERROR_SUCCESS )
{
Path = DownloadPath;
}
else if ( dwRet == ERROR_FILE_NOT_FOUND )
{
if (RegSetValueEx(Regentry,
_T("DownloadPath"),
0,
REG_SZ,
(LPBYTE) &dwData,
(DWORD) (lstrlen(Path.c_str())+1)*sizeof(TCHAR)))
{
printf("Could not set the DownloadPath.");
RegCloseKey(Regentry);
return 0;
}
}
else
{
printf("Could not set the DownloadPath.");
RegCloseKey(Regentry);
return 0;
}
I am getting 'PPERF_DATA_BLOCK' : undeclared identifier, what can I do for that? What do I need to include?
These are my headers:
#include <atlapp.h>
#include <atlframe.h>
#include <atlctrls.h>
#include <atldlgs.h>
#include <atlctrlw.h>
#include <atlwin.h>
#include <iostream>
#include <atlmisc.h>
#include <malloc.h>
#include <stdio.h>
#include <windows.h>
#include <stdlib.h>
#include <string.h>
|
|
|
|
|
Looking at PERF_DATA_BLOCK in MSDN, it says 'Header: Declared in Winperf.h; include Windows.h.'.
You have included Windows.h, which makes me suspect there's a macro getting in the way. Looking at Windows.h, it won't include WinPerf.h if the macro WIN32_LEAN_AND_MEAN is defined - I seem to remember that an auto-generated stdafx.h does define WIN32_LEAN_AND_MEAN . Check for that.
PS - I compiled this code successfully (just these two lines) using the command-line C++ compiler, which says that there must be something in your setup or software that's stopping PPERF_DATA_BLOCK being defined.
#include <Windows.h>
PPERF_DATA_BLOCK p = new PERF_DATA_BLOCK;
|
|
|
|
|
Thanks already done with it.
|
|
|
|
|
Hi EveryOne,
I am savitri.I am new to Com programming.I am doing project on GSM modem to send and receive message.I want to use existing dll file for example(comdlg32.dll).Please tell me how shall i use that in my program.please tell me procedure.
it is urgent.Help me.
Regards,
savitri
|
|
|
|
|
Don't cross-post, this is considered rude !
|
|
|
|
|
hi moonen,
it means..wt i did tell me.
regards
savitri
|
|
|
|
|
savitri wrote: it means..wt i did tell me.
Could you please translate that into english so that I can understand ?
|
|
|
|