|
Did u use AFX_MANAGE_STATE() ?
And also u should not try to use the
classes from the MFC dll in the ATL program,
u can only use the functions.
If this does not help, further information
can help me anlayse it.
|
|
|
|
|
I must provide dll that will match to every language !!!
I did exctention dll that works well in vc but NOT in another.
I understood that the best way for me (as beginner at this subject) is to use the Wizard of ATL COM with suppot MFC and importe my mfc dll to it.
When I run it by client program (exe) the atl it works !
but the imported function (ShowDialog) dont performed. WHY ????????
------------------------------------------------------------
My steps:
1. I opened project: ATL COM Wizard. [DLL] [MFC Support]
2. I inserted to the library that created the file : MyMfcDll.dll
and attached to the ATL project the files : MyMfcDll.h , MyMfcDll.lib
3. I Added by wizard ATL class [MyClass] [single] [dual]
4. I added by wizard method [ShowMfcDialog] to IMyClass and fill it so :
___________________________________________
extern "C" __declspec(dllimport) void ShowDialog();
STDMETHODIMP CAtlObj::ShowMfcDialog()
{
AFX_MANAGE_STATE(AfxGetStaticModuleState())
AfxMessageBox(".....");
ShowDialog();
return S_OK;
}
|
|
|
|
|
I trys now to build ATL without import the MFC DLL that I crated.
So
1. I going to resources and inserting Dialog.
2. I created class dialog::CDialog (possibility ?)
3. I added ATL class - simple.
4. I added to this ATL class object from the class dialog .
5. I added to this ATL class method that doind : dlg.DoModal();
I run it from client program and it is works so :
It shows the dialog of the method of ATL class (in number 5)
But when press OK or Cancel it is crush.
____________________________________________________-
Have I use only in ATL dialog or there are a way to works as I tried (Maybe have I added AFX_MANAGE_STATE somewhere)?
What I need to add in the: () of that ?
|
|
|
|
|
We're making an ATL object to be used in ASP or Visual Basic.
I want to be able to return a BSTR to make it nice and pretty for my VB partner.
Ok ok, we all know that you can say...
///////////////
STDMETHODIMP Foo([out,retval] BSTR outstring)
///////////////
..and have it returned in a variable in the Implementation. (duh)
But can we get this a function in an object to look like:
///////////////
BSTR Foo(BSTR instring);
///////////////
or just something with the emphasis on returning a BSTR in the "real" return parameter place.
"The Master Wang" doesnt have money to buy a COM or ATL book...
and plus I know I'm asking questions from the best!
SHABBA!!
*Please Contact Me if you have a Donation to give to a poor college student who needs money for a engagement ring for the greatest girl in the world.
-~= The (still learning) Master Wang =~-
|
|
|
|
|
If I understand what your asking
STDMETHODIMP Foo([out,retval] BSTR return_string, [out]BSTR out_string)
would get you
BSTR Foo(BSTR instring)
BTW, nice sucking up;)
|
|
|
|
|
Hi,
Actually you can use any data type "Automation Data Types are recomended" to be a return type of any interface's method. But, it's just a recommendation that you use the HRESULT (STDMETHOD macro) as a return type, this return type will give the COM Runtime Environment the ability to return error codes when your component cannot be accessed for any reason. If you don't provide HRESULT as a return type, the COM Runtime Environment cannot return error codes for you.
"If You Know That Your Component Will Live With Its Client On The Same Machine, You Can Ignore HRESULT"
Regards,
ShadiK.
|
|
|
|
|
>..and have it returned in a variable in the Implementation. (duh)
>But can we get this a function in an object to look like:
>///////////////
>BSTR Foo(BSTR instring);
>///////////////
No, COM interfaces can't return a value like you suggest.
The correct (and only way) is as you described,
STDMETHODIMP Foo([out,retval] BSTR* outstring)
Your VB code would then look like,
Dim sTemp
sTemp = Object.Foo
Hope this helps,
Michael
|
|
|
|
|
The solution is simple. In your source file (.cpp) change your function header to this:
STDMETHODIMP_(BSTR) YourClass::Foo(BSTR instring)
and do the same for your (.h) file.
You need to change the entry in the IDL file as well,like the following:
BSTR Foo(BSTR instring);
Rookie Programmer
|
|
|
|
|
STDMETHODIMP Foo([in]BSTR in_string, [out,retval] BSTR *return_string )
would get you
String Foo(String instring) in VB or ASP,
In C++ it is HRESULT = YADA.Invoke(dispID, params, vResult,...)
Your out_string ends up in the Variant vResult as type vt = VT_BSTR. Use of the retval modifier causes the result to be placed in vResult. Notice the * in BSTR *return_string.
Hope this helps,
Bill
|
|
|
|
|
Howdy.
I have a large, multiserver project that has been developed in VC++ on WinNT 4.0 SP6a. It makes use of ATL for most of the COM-related things.
My trouble is that it works fine on the machine on which it was developed. I have tried it on other machines and sometimes it works fine - sometimes it doesn't.
The current issue is that when I regsvr32 my servers, I get the standard message that says that registration was successful. Trouble is, nothing shows up in the registry!
Do ATL-based servers require some fancy libraries for registration? Do they require any libraries that get loaded with MSDEV or a certain service pack? I'm trying to make do without loading the development environment on the machine (it will be a production machine eventually).
Any help would be GREATLY appreciated.
J
|
|
|
|
|
Follow-up...
The problem persists. I searched the MSDN library and found a reference to some run-time issues. They suggest you do a release min dependency build and remove the _ATL_MIN_CRT define.
I did it, registered the server, it said that it worked, but didn't touch the registry.
I'll add that I'm working as an administrator, so registry security should not be an issue. Also, my .exe servers added their CLSIDs and APPIDs, but little else. So something's working - just not enough to actually be useful.
Puh-leeeeeze hep me! Hep me!
J
|
|
|
|
|
Sometimes, a proxy/stub Dll needs to be registered. Does your application make use of an external proxy/stub dll?
I vote pro drink
|
|
|
|
|
It does, and the same problem occurs. I believe the PS dll loads stuff under the AppID key under HKCR? Either way, when I regsvr32 either one of them, they both "succeed" but neither actually touches the registry.
J
|
|
|
|
|
Oops. The PS does NOT put entries in AppID. My mistake.
The problem remains.
J
|
|
|
|
|
Try to move the ATL.DLL with you.
Shadi Al-Kahwaji
|
|
|
|
|
Hello...I already posted this in the "Visual C++" area, but I've gotten no response, so I'm trying it here, since it's technically a COM issue.
I'm working on a namespace extension for Windows NT that represents documents in a repository. It allows the user to copy or cut the documents and paste them to the file system. I'm basically doing the cut/copy by retrieving the files, copying them to /temp, and creating an IDataObject instance on the clipboard which returns a reference to the temporary files in CF_HDROP format.
BUT...in the case of a cut and paste, I need to get feedback that the paste was successful so I know whether or not to delete the document object from the repository. I get a "Paste Successful" via IDataObject::SetData(), but if the file already exists where I'm pasting it, I get a "File already exists - overwrite?" dialog box *AFTER* the "Paste Successful" has already been returned!
Is there a way to verify that the paste has actually occured?
Alternatively, is there a way I can add a handler of some sort to the shell that will allow me to paste documents to the file system that are in a custom clipboard format?
Any help would be greatly appreciated.
Thanks,
Tim
Reverend Shoebox
|
|
|
|
|
Hello,
I want to write a program that show some Powerpoint slides through LAN.
Could Office Developer help me anything?
please help me!
Thanks,
Nam
|
|
|
|
|
I am not a Office developer, but you have several options, for example, Powerpoint have a little quik view for it, in that case you only need to destribuit that application. If you are a Vsual c++ developer you can use Ole Automation....
Best Regards
Carlos Antollini.
|
|
|
|
|
Hi all,
I want to display my own HTML pages instead of IE res: error pages(dnserror.html etc). I know that the AboutURLs reg entries handle some of these but not the DNSerror. Now in my mind there are 2 ways to do this: either write a BHO IEplugin and trap IE events esp. BeforeNavigate2 and if res:// protocol pages comeup I just call Navigate() to go to my pages. the other idea is to replace shdocvw.dll and shdoclc.dll resources(I'm not sure of the merits/demerits of this). But then XXXUpdateResource() API's work only for WinNT and I want Win9x compatibility too. What should I do?
TIA.
I'm an alien, I'm an alien
it's a beautiful life....
Bush
|
|
|
|
|
I want to be able to generate a CLSID, but I always want the first 4 sections (best case) to be the same like so:
51eb18c0-98a7-11d1-83d1-f46705c10000
51eb18c0-98a7-11d1-83d1-f46705c10001
51eb18c0-98a7-11d1-83d1-f46705c10002
51eb18c0-98a7-11d1-83d1-f46705c10003
I need this to happen regardless of the machine's on a network or not. The first four sections should be different for each machine the program is run on as well.
Is this possible?
To hell with those thin-skinned pillow-biters. - Me, 10/03/2001
|
|
|
|
|
John you are a moron. That would defeat the purpose of a GUID. You want it to be a "GLOBLE UNIQUE IDENTIFYER" if MS allowed what you want then there would be a bunch of COM components with the same GUID.
|
|
|
|
|
Anonymous? Despite your obvious "know-it-all" status (I should have seen the great big DICK in the middle of your forehead before asking the question), you haven't got a freakin clue as to why I'm even ASKING this kind of question.
Do you even know the answer? Hmmm, I thought not.
Besides all of that, if you're too chickenshit to use your real name, I don't have any more time to spend on your worthless fecal-brained ass.
To hell with those thin-skinned pillow-biters. - Me, 10/03/2001
|
|
|
|
|
Bite me.
To hell with those thin-skinned pillow-biters. - Me, 10/03/2001
|
|
|
|
|
So, you delete your posts so that any late-comers won't know you're an a**hole. Funny thing is, you can't delete a post that was done anonymously. Well, for every's informationm, the drivel that this post is in response to was posted by one Roger Smith.
To hell with those thin-skinned pillow-biters. - Me, 10/03/2001
|
|
|
|
|
You could try creating them yourself
<br />
GUID BaseGuid;<br />
CoCreateGuid(&BaseGuid);<br />
<br />
GUID MySecondGuid;<br />
MySecondGuid.Data1 = BaseGuid.Data1;<br />
MySecondGuid.Data2 = BaseGuid.Data2;<br />
MySecondGuid.Data3 = BaseGuid.Data3;<br />
<br />
MySecondGuid.Data4 = Whatever you want<br />
|
|
|
|