|
Do you mean a cut, copy or paste performed within Word? If so, I don't think so - the documentation[^] seems pretty clear that an ICopyHook handler is a shell extension, so would form part of Explorer, and that it only gets to approve/disapprove operations on folders or printers.
|
|
|
|
|
|
Hi Experts,
I m bit confused about ATL COM applications..and DLL
As I have already developed and using DLL(MFC/NON MFC) created in VC 6.0.
So Is there any advantages if I covert this into ATL COM. what are they??
And if I m capable of doing so..i.e. Converting DLL(MFC/NON MFC) into ATL COM application
then Whats type of care must have to be taken???
Like ...........
1> Global and local variable .or
2> Public/protected members of CLASS .or
3> Exported functions of DLL
plz guide me..and clear my confusion....
Thanx in advance..
Victory
modified on Wednesday, January 14, 2009 2:16 PM
|
|
|
|
|
Using COM makes it easier to use your DLL with languages other than C++, for example VBA or VB.
vijay.victory wrote: As I have already developed and using DLL(MFC/NON MFC) created in VC 6.0.
So Is there any advantages if I covert this into ATL COM
If it ain't broke, don't fix it.
vijay.victory wrote: And if I m capable of doing so..i.e. Converting DLL(MFC/NON MFC) into ATL COM application
then Whats type of care must have to be taken Like ...........
1> Global and local variable .or
2> Public/protected members of CLASS .or
3> Exported functions of DLL
Sounds like you need to learn about COM first...
COM defines a mechanism by which you can define and use objects in a (relatively) language independent manner. You expose objects through interfaces (a.k.a. pure abstract classes). Globals and locals aren't so much of an issue, as functionality is exposed in an OO way. Public/protected class members aren't an issue, as you only expose methods that implement (public!) interface methods. Exported functions aren't an issue - the COM specification tells you what functions to export (DllGetClassObject and DllRegisterServer )
|
|
|
|
|
Hello,
My task is to encrypt the body of the e-mail and send to receiver.
On receiver side, decrypt and display the content.
The input to my encryption algo is unsigned char.
So I did like below
Sender=>;
get_Body() => BSTR => UCHAR => ENCRYPT => ENCRYPT_UCHAR => BSTR => put_Body()
Receiver =>;
get_Body() => BSTR => ENCRYPT_ UCHAR => DECRYPT => BSTR => put_Body
The problem I am facing is, the ENCRYPT_ UCHAR of sender is different from receiver.
I tried to convert in the sender side, by converting the BSTR to ENCRYPT_UCHAR before put_Body..the data is fine.
I am using W2A and A2W for conversion.
Thanks in advance
SAI
|
|
|
|
|
It's probably not wise to treat an encrypted message as a character stream - I would suggest you treat it as a stream of bytes instead - which, to be honest, is what unsigned chars usually represent in C/C++.
In fact, I wouldn't bother to convert from BSTR to unsigned char using a charset->charset mapping. I would just treat the BSTR as a set of bytes (aka unsigned chars). You can do this as shown in this sample program:
#include <windows.h>
#include <oleauto.h>
#include <iostream>
#include <iterator>
#pragma comment(lib, "oleaut32")
int main(int argc, char** argv)
{
const wchar_t* s = L"Hello World";
BSTR bs = SysAllocStringLen(s, lstrlenW(s));
unsigned char *byteStream = (unsigned __int8 *)bs;
ULONG byteCount = SysStringByteLen(bs);
std::cout << "byteCount = " << byteCount << std::endl;
std::cout << "bs (in bytes) = ";
for(unsigned char * p=byteStream;p!=byteStream+byteCount;++p)
std::cout << std::hex << (int)(*p) << " ";
std::cout << std::endl;
}
This shows the bytes that make up the BSTR . You can then encrypt that set of bytes.
If you are returning a BSTR because it's an easy to use container, you can create a BSTR from a set of bytes as follows:
unsigned char *encryptedByteStream;
ULONG encryptedByteCount;
BSTR outputBS = SysAllocStringByteLen(encryptedByteStream, encryptedByteCount);
HTH!!
|
|
|
|
|
Hello,
Thanks for your reply..
I am getting the below error on adding the source code.
initializing' : cannot convert from 'unsigned __int8 *' to 'unsigned char *'
Could you please suggest me to solve this.
Thanks
|
|
|
|
|
Whoops - there was a typo - change
unsigned char *byteStream = (unsigned __int8 *)bs;
to
unsigned char *byteStream = (unsigned char *)bs;
Interestingly, I don't get that error with VC++ 2003, 2005 or 2008 - which compiler are you using - VC++ 6?
|
|
|
|
|
Hi, it seems that only I post questions around here, not a happy site
However, here I am having problems again. This time I get to play around with dialogs and controls guided by article series from Michael Dunn called "WTL for MFC programmers and something".
The problem is I can't add map entry
ATL_MSG_MAP(1)
MSG_WM_SETCURSOR(OnSetCursor_OK)
I'm getting errors:
"syntax error : missing ';' before identifier 'MSG_WM_SETCURSOR'"
"'ATL_MSG_MAP': identifier not found"
"'OnSetCursor_OK' : undeclared identifier"
I'm on WinXP using VS2008
Thanks in advance
|
|
|
|
|
I think that should be ALT_MSG_MAP - A<span style="font-weight: bold;">LT</span> , not A<span style="font-weight: bold;">TL</span> . You'll need to #include atlwin.h .
|
|
|
|
|
I already included atlwin.h in stdafx.h!
Don't quite understand your replay "I think that should be ALT_MSG_MAP - ALT, not ATL"?
Anyway big thanks to you!
|
|
|
|
|
You typed "ATL_MSG_MAP" in your original message. That symbol isn't in ATL, but ALT_MSG_MAP is, i.e. I think you made a typo at some point.
|
|
|
|
|
Need your help again, this time it's about adding notify handler for LVN_ITEMCHANGED message which is sent from listview ctrl.
NOTIFY_HANDLER_EX(IDC_LIST,LVN_ITEMCHANGED,OnListItemchanged)
I've included atlcrack.h but still get complaints?
I know that I'm trying to use code for WTL 7/7.1 while I have WTL 9 installed on VS2008 but I'm stern to go trough the series of articles here on CP by Dunn.
And sorry if I'm a pain to you
|
|
|
|
|
Solved the entry was in the wrong map!
|
|
|
|
|
josip cagalj wrote: I'm stern to go trough the series of articles here on CP by Dunn
They're good articles - Michael's (to my mind) one of the most knowledgeable WTL experts.
josip cagalj wrote: sorry if I'm a pain to you
If you were, I probably wouldn't be answering your questions
|
|
|
|
|
Thanks for previous post.
I tried to add a dialog to my app so after designing one mfc wizard showed up for adding a class for the new dialog so I followed it. When I compiled afterward i got an error saying "fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h>", I deleted the dialog and corresponding *.h and *.cpp from project but the error persist?
I think I need to skip the mfc wizard and manually add an class for the new dialog I've designed class:
class CMyNewDlg : public CDialogImpl<cmaindlg>,
public CWinDataExchange<cmynewdlg>
{
public:
enum { IDD = IDD_MYNEWDLG };
CMyNewDlg();
...
If so can I add this in existing .h file like CMainDlg.h or I need to manually add CMyNewDlg.h and CMyNewDlg.cpp files?
|
|
|
|
|
It probably added one or more MFC include files (afx.h?) to your stdafx.h. Remove those.
|
|
|
|
|
What this means:
error C2039: 'SubclassWindow' : is not a member of 'WTL::CTreeViewCtrlT<tbase>'</tbase>
I've placed an treeview ctrl on my new dlg and everything is ok when I use m_wndTree.Attach(GetDlgItem(IDC_TREE));
but when I want to use DDX_CONTROL like this
BEGIN_DDX_MAP(CMyTreeDlg)
DDX_CONTROL(IDC_TREE, m_wndTree)
END_DDX_MAP()
I get above error
|
|
|
|
|
I believe you need to declare m_wndTree with type CContainedWindowT< CTreeViewCtrl > for it to have a SubclassWindow member.
[edit]You also need to construct m_wndTree correctly:
- If
m_wndTree doesn't have a message map (using ALT_MSG_MAP )
CMyTreeDlg() : m_wndTree(this)
. . .
. . . - If
m_wndTree has a message map (using ALT_MSG_MAP(number )
CMyTreeDlg() : m_wndTree(this, number)
. . .
. . .
[/edit]
|
|
|
|
|
i,ve an int that should be increased each time the picturebox gets a new picture, what is the event i can use, i tried LoadCompleted but it didn't success.
|
|
|
|
|
Hi,
I'm working on some test app and i need help. I'm using vs2008 wtl. I add an handler for timer functionality and it looks like: MESSAGE_HANDLER(WM_TIMER, OnTimer) ,
and implementationLRESULT OnTimer(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
Unlike old MSG_WM_TIMER(OnTimer) and implementation void OnTimer ( UINT uTimerID, TIMERPROC pTimerProc )
My question how can I get timer id out from param's in 'new' MESSAGE_HANDLER ontimer f.?
Thanks in advance
|
|
|
|
|
Look at the documentation[^] - wParam == timer ID.
So, uncomment the relevant parameter's name in your implementation and use it. You should have something like this:
LRESULT OnTimer(UINT , WPARAM wParam, LPARAM , BOOL& );
or you could even alter the parameter's name to be more descriptive...
LRESULT OnTimer(UINT , WPARAM timerID, LPARAM , BOOL& );
|
|
|
|
|
Thanks once again Stuart, indeed I've done so.
UINT uTimerID = (UINT)wParam;
Similarly I've get HDC out from WM_ERASEBKGND implementer;
HDC hdc = (HDC)wParam;
One question do, I'm getting error on my CRect member: "error C2065: 'CRect' : undeclared identifier"
???
Do I need additional include?
|
|
|
|
|
By including 'atltypes.h'
|
|
|
|
|
CRect is defined in atltypes.h in ATL in Visual Studio 2003, 2005 and 2008, or alternatively in atlmisc.h in WTL - if you're using one of those Visual Studio versions, I'd #include atltypes.h rather than atlmisc.h .
|
|
|
|