|
Not much details (or am I blind??). The penalty hit comment smells of trapping exceptions, do code analysis, and then either allow or disallow execution.
Thanks for the information!
|
|
|
|
|
Hi all!
I want to write an ATL exe that uses the mscomm32.ocx activex for serial communication.
How to do this? specially how to call the methods of this ocx as we can do it with
mfc exe by declaring a member variable of the class CMSComm.
Thanks in advance.
Viral Joshi.
|
|
|
|
|
Hi All,
I am having a ASPX page on whose submission I open a PopUp Window for
sending mails.In the main page I have four hidden variables for
setting the MailTo Mailcc,MailSubject and MailBody fields which I am
getting in my PopUp Window by using
if((document.getElementById("hdnForPOst").value)=="1")
{
document.getElementById("txtTo").value=window.opener.document.getElementById("hdnMailTo").value;
document.getElementById("txtCC").value=window.opener.document.getElementById("hdnMailCC").value;
document.getElementById("txtMailSubject").value=window.opener.document.getElementById("hdnMailSubject").value;
document.getElementById("txtMailBody").value=window.opener.document.getElementById("hdnMailBody").value;
}
hdnForPOst is the variable set for sending mail.
This script I have pasted in a after my controls code.
The problem is that sometimes this code does't execute and I get a
blank popup Window.
I have checked by putting alerts inside script block also.These alerts
also dont execute.It happens only at times and no specific scenario.
Anybody can help please?
Dipti Arora
|
|
|
|
|
I'm using attribute ATL, and i need to forward declare an interface but i'm not sure what the correct syntax is? this is what i currently have but i'm getting a compile error. VS2005
error MIDL2025 : syntax error : expecting a type specification near "IDLArchiveFile"
[export]
__interface IDLArchiveFile;
[
object,
uuid("3E661C7F-C4C4-4EF8-94A3-4AA9FC0F9419"),
dual, helpstring("IDLArchiveDirectory Interface"),
pointer_default(unique)
]
__interface IDLArchiveDirectory : IDispatch
{
[id(6), helpstring("method GetFileAt")] HRESULT GetFileAt([in] SHORT index,[out,retval] IDLArchiveFile** pFile);
};
[
object,
uuid("08B48958-99C0-4AE1-91C9-1DD68B419A07"),
dual, helpstring("IDLArchiveFile Interface"),
pointer_default(unique)
]
__interface IDLArchiveFile : IDispatch
{
[propget, id(3), helpstring("property Parent")] HRESULT Parent([out, retval] IDLArchiveDirectory** pVal);
};
Jared Allen.
|
|
|
|
|
This is going to sound snarky, but in all honesty you shouldn't use attributed ATL. It has never worked right. If at all possible, you should rewrite it in regular ATL.
|
|
|
|
|
I have to agree with Michael. Attributed COM/ATL is one of the most stupid idea ever conceived by the VC++ team... It's inefficient at compile time (Zzzzzz), and it causes general headaches in cases such as these.
MIDL for the win!
--
Raaaaaaaaaaaaaaaaaaaaa!
|
|
|
|
|
hmmm, yeah i'm not enjoying using Attributed ATL. I only used it because I started a new project in VS 2003 and it must have been the default setting back then and so i thought "It must be better and the thing todo" so it has stuck with this particular project since then...
I'm not looking forward to rewriting it though, i figured that forward declaration was such a common thing that there would be a well known solution.
Jared Allen.
www.chironexsoftware.com
|
|
|
|
|
The idea is to create some add-on in a program using COM functions interface exist in his own API.
The particular type which I try to implement is a generic one , let say MyClass, and is declared like below:
//MyClassPtr declaration;
_COM_SMARTPTR_TYPEDEF(MyClass, __uuidof(IDispatch));
//The class itself
struct __declspec(uuid("5e772660-389b-11ce-ba48-080036250302"))
MyClass : IDispatch
{
...
// other functions...
...
IDispatchPtr Function1;
__declspec(property(get=GetArea,put=PutArea))
IDispatchPtr Function2;
__declspec(property(get=GetSize))
...
}
I create an instance of MyClass using:
MyClassPtr pMyInstance;
This pMyInsatance have to be provided to another API function but in form of a SAFEARRAY!This function can look like below:
FinalFunction(SAFEARRAY * * pMyClassInstances, .. , ..)
So I have to convert my variable MyClass (can be more than one in my code of course, but I want to limit only to one instance for now) to this SAFEARRAY .. How can I do this?
I try:
SAFEARRAYBOUND rgsabound[1];
rgsabound[0].lLbound = 0;
rgsabound[0].cElements = 1;
long a=0;
SAFEARRAY * vMyClassArray;
vMyClassArray.vt = VT_VARIANT|VT_ARRAY;
vMyClassArray= SafeArrayCreate(VT_VARIANT, 1, rgsabound);
SafeArrayPutElement(vMyClassArray .parray, &a, &(pMyInstance));
Finally I put my class instance as an argument for:
FinalFunction(pMyInstance, .. , ..)
It doesn't seem to work, probably because argument pMyInstance can not be express as a VARIANT declarated type.
The class I want to work with - MyClass- which exist in a .tlh file, is part of the API interface, so it is not exactly a user define type, but more an interface define type. I mention this becose I try to work with VT_RECORD type in SafeArrayCreate(...) instead of VT_VARIANT type, but this imply an idl function declaration for my type, and other additional stuff
Any ideea ??
|
|
|
|
|
I use a third part COM API lib. I need to pass an array of double to a method which accept VARIANT*, Is there any simple way to cast from double* to VARIANT*, I don't want to create a VARIANT array and copy each double value into it.
|
|
|
|
|
songll wrote: I don't want to create a VARIANT array and copy each double value into it.
Hmmmm - no can do. You'll need to pass a VARIANT that contains a SAFEARRAY of doubles. Something like:
SAFEARRAY* sa = SafeArrayCreateVector(VT_R8, 0, count);
double* pSAData;
if (SUCCEEDED(SafeArrayAccessData(sa, (void HUGEP**)&pSAData)))
{
std::copy(start, start+count, pSAData);
SafeArrayUnaccessData(sa);
VARIANT v;
V_VT(&v) = VT_ARRAY|VT_R8;
V_ARRAY(&v) = sa;
} should set the VARIANT , then you can pass a pointer to it.
|
|
|
|
|
Stuart Dootson wrote: HUGEP
Dude.. it's 2007!
--
Raaaaaaaaaaaaaaaaaaaaa!
|
|
|
|
|
Joergen Sigvardsson wrote: Dude.. it's 2007!
Tell that to Microsoft - it's copy'n'pasted from their documentation...
|
|
|
|
|
Just pullin' your leg..
--
Raaaaaaaaaaaaaaaaaaaaa!
|
|
|
|
|
Hi,
I am trying to fire an event from the worker thread and it worked fine as long as I worked with a VB client inside VB development environment. As I created an exe and ran, it was crashing and found that there is a KB article in Microsoft on that talking about marshalling the sink interface (http://support.microsoft.com/kb/q280512/ ). But, when I use that, I am getting a 0x80004002 error in the pDispatch->Invoke. Appreciate your help in sorting out this issue,
Thanks & Regards,
Satish
|
|
|
|
|
What have you done so far?
Have you initialized the new apartment with a call to ::CoInitialize() ?
You cannot fire events from a secondary thread without marshalling since the call crosses apartment boundaries.
You could also post a message to the main thread and fire the event from there.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Hello Satishkumar,
Not sure why you are getting your error. I've tried to use ATLCPImplMT.h entirely as advised by the MSDN article in http://support.microsoft.com/kb/q280512/[^]
and faced no problem.
If you would like to have a look at my sample codes, pls email me :
bio_lim_2004@yahoo.com
Regards,
Bio.
|
|
|
|
|
//Belows are from MSDN2003, an example about hash_set::find
// hash_map_find.cpp
// compile with: /EHsc
#define _DEFINE_DEPRECATED_HASH_CLASSES 0
#include <hash_map>
#include <iostream>
int main( )
{
using namespace std;
using namespace stdext;
hash_map <int, int=""> hm1;
hash_map <int, int=""> :: const_iterator hm1_AcIter, hm1_RcIter;
typedef pair <int, int=""> Int_Pair;
hm1.insert ( Int_Pair ( 1, 10 ) );
hm1.insert ( Int_Pair ( 2, 20 ) );
hm1.insert ( Int_Pair ( 3, 30 ) );
hm1_RcIter = hm1.find( 2 );
cout << "The element of hash_map hm1 with a key of 2 is: "
<< hm1_RcIter -> second << "." << endl;
// If no match is found for the key, end( ) is returned
hm1_RcIter = hm1.find( 4 );
if ( hm1_RcIter == hm1.end( ) )
cout << "The hash_map hm1 doesn't have an element "
<< "with a key of 4." << endl;
else
cout << "The element of hash_map hm1 with a key of 4 is: "
<< hm1_RcIter -> second << "." << endl;
// The element at a specific location in the hash_map can be found
// using a dereferenced iterator addressing the location
hm1_AcIter = hm1.end( );
hm1_AcIter--;
hm1_RcIter = hm1.find( hm1_AcIter -> first );
cout << "The element of hm1 with a key matching "
<< "that of the last element is: "
<< hm1_RcIter -> second << "." << endl;
}
Output
The element of hash_map hm1 with a key of 2 is: 20.
The hash_map hm1 doesn't have an element with a key of 4.
The element of hm1 with a key matching that of the last element is: 30
My question is: hm1_RcIter is definded as a iterator, how can it use the member function of Pair: "hm1_RcIter -> second "? what is wrong?
|
|
|
|
|
An iterator just has 2 pointers. First pointer points to the key value. Second pointer points to the value itself for that key. The member variable/function second is not a member of the pair class. It is a specific part of the iterator itself.
From what I can see, nothing is wrong with your code. What's the problem? Nothing.
|
|
|
|
|
I build my project with "Win32 Unicode Release MinSize" setting. It defines "_UNICODE", "_ATL_DLL", "_ATL_MIN_CRT". And I don't want my dll to use MFC and CRT.
now I need to format strings. I think I should prevent calling functions like "_stprintf" from using CRT. But I don't know other way to fromat strings. Can you tell me some helpful Win32 functions. Or, maybe my idea is wrong!
|
|
|
|
|
|
I have a dll written in C++ running in a Linux machine. Now i want to move that dll to a Windows system and use it with a Windows application.
How can i do that?
Can you please tell what all are the performance issues i face?
What all are the dependencies?
Thanks in advance
|
|
|
|
|
Do you want to use this dll on the C++?
|
|
|
|
|
Hi All,
I am working on an ActiveX based project.
I am using AtlAxCreateDialog method to create a dialog whose resources have been specified in a RC file. The dialogue gets created perfectly fine but i have not been able to handle its events like OnSize, OnClose etc
It has taken me a while to solve this problem but didn't succeed. Kindly, help me.
AZ
Aamir Zia
|
|
|
|
|
Calling AtlAxCreateDialog directly is unusual: normally it’s called for you in the implementation of the CAxDialogImpl::Create method.
Steve
|
|
|
|
|
I have created a toolbar for IE and added a an edit control to it, but I couldn't add a menu control beside to the edit control. Can anybody help me, please. Thanks a lot.
love U much...
|
|
|
|