|
Your question is in your COM forum,Do you use MFC or ATL?
shingai wrote:
if one option is clicked i want to know how to call another dialog box which has the operations i want to carry out
You can create two different dialog box,and in each event handler of buttons create on of them.
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
So if you use MFC,with dialog editor create two different dialog and in each button handler create one like this:
CYourDialg1 adlg;
adlg.DoModal();
IN another one:
CYourDialog2 adlg;
adlg.DoModal();
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
My equipment:
Workstation:
Win2k Prof. OS
Visual C++ 6.0
Platform SDK November 2001
Server:
Win2k Server OS
Name: iras
Domain: htlpinkafeld.at
TestUser: testuser@htlpinkafeld.at
Password: none
My Problem:
Let's imagine a user at the workstation wants to set up a connection with the server. The user double clicks the server icon and he will be asked for an username and password. He enters testuser@htlpinkafeld.at and no password. He will get connected and everything is fine. Ok.
I do this whole stuff in my program with the following function:
WNetAddConnection2(...); Well it works!
The disadvantage is that only one user can be connected to the server at the
same time. I found out that every process which trys to work with the server after the connection is established has to use this connection and not a other connection else because there can only one connection at a time. But i have heard that this could be handled with COM Interfaces. I am not a beginner with programming COM Interfaces but i can't find out how this can be done!!
What i want is to get access to the server with more than user at the same time!!!! It is possible but how ?????
Please help me!
|
|
|
|
|
Can I use the OLECMDID_SAVEAS without prompting the user?
How can i submit the path to store the webpage on the disk to this function?
|
|
|
|
|
I'm just learning ATL COM and I'm trying to wrap my head around the world of strings. I'd appreciate any form of help anybody can spare.
For example, I have a class and I want to give it a private data member that will hold string data. Like a "FirstName" or "LastName". When using COM, what data type should be used for this purpose? Should I use a BSTR or some other string type?
class CMyType {
//lots of other ATL stuff
private:
BSTR firstName;
};
Is this ok to do or should I be keeping string data in some other format? Do I need to do anything to make sure the BSTR data gets cleaned up correctly?
To extend this question a bit, is there such a thing as "Best Practices for Win32 strings"? As in, when should one use (or better yet, NOT use) one string type in favor of another? Since my C++ experience is nearly all in "vanilla" C++, I've always used STL strings, but I'm seeing that STL strings just don't cut it in Win32...
Thanks for the help!
|
|
|
|
|
BSTR strings are a special type of string. Even though they look like UNICODE strings, they have to be managed using the ::SysFreeString, ::SysAllocString, etc routines.
So, in your destructor, don't forget to call ::SysFreeString.
You can also use CComBSTR (spelling??) to manage the BSTR.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
I tried using CComBSTRs in my class but I had some strange things happening when I did that made me switch back to straight BSTRs. When I accessed the property the CComBSTRs were storing the first time from a skeleton VB project, they worked great. Any subsequent attempts to get the property only returned an empty string (""). Not sure what was going on there. Any thoughts?
Also, is there a way to test if a BSTR has been allocated before calling ::SysFreeString() on a BSTR? Or, can you safely call ::SysFreeString() on a BSTR that hasn't been ::SysAllocString()'d yet?
|
|
|
|
|
First, when you were returning your CComBSTR to the VB app, were you making a copy of the string? If not, then the VB very well could have been deallocating the string.
You should set your pointer to NULL when it isn't pointing to an allocated string. Thus in your destructor you can check for NULL to see if you need to free it. Otherwise, you might try to free someone else's memory or invalid memory and crash the program.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Also You can use bstr_t ,it is very easier to use
it.It doesn't need to use SysAllocString() and SysFreeeString() for it.
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
Hello gurus,
I want to connect to the events of a custom browser that basically hosts IE webbrowser control, from my application. After the user launches the custom browser,I want to be able to detect events like OnNavigate,DocumentComplete etc. How can this be done? Would appreciate any help, ideas and code.
TIA.
#define MOSTLY_LEAN_AND_MEAN
|
|
|
|
|
Connect to the WebBrowser control events. Here is a sample : http://msdn.microsoft.com/library/en-us/dnwebgen/html/bho.asp?frame=true#bho_getevents
|
|
|
|
|
Will third party browsers load a BHO too?
#define MOSTLY_LEAN_AND_MEAN
|
|
|
|
|
Help me. !I have an exercise:
Build an Active X that allow communicate with COM Ports:
-Allow user choosing port (COM1, COM2, COM3, COM4)
-Allow setting parameters: speed, parity, data bit, stop bit…
-Have methods: Open, Close, Flush ports
-Have method: Send & Receive data (char or string) through ports
-Allow setting time for end of transfer data (time-out transfer)
-Allow setting time for testing port (loop-back tested time)
-Auto enabled when there's an event from ports.
Can you help me ! (I use VC++)
Hung Son
Hung Son
|
|
|
|
|
Hi ,
Can someone tell me how to use MFC classes, like
CPropertySheet in ATL EXE.
Thanks,
Sansky
God is Good, all the Time.
All the Time, God is Good.
|
|
|
|
|
There's such a function in VBScript as TypeName which returns the coclass name of the passed object.
How to do the same using:
- JScript
- Compiler COM Support Classes (C++)
- API (C++)
?
tx
(H) Serge
|
|
|
|
|
TypeName return the type of the variant which was passed as argument. To do the same in C++ check the vt member of the VARIANT data ( it can be VT_BSTR, VT_I4, VT_BOOL, etc)
|
|
|
|
|
Hi,
When i try to access IADsWInNTSystemInfo interface, i am getting "undeclared
identifer" error. I have included the Iads.h file, but the file doesn't contain
the interface. Where will i get the latest header file. Anbody help??
Thanx,
Sangeetha.
|
|
|
|
|
I would look in the different versions of Platform SDK.
Andres Manggini.
Buenos Aires - Argentina.
|
|
|
|
|
The version which i downloaded from Microsoft site is ADSI SDK version 2.5. I am not able to find any updates or fixes. Please do keep me posted on this.
Thanx,
Sangeetha.
|
|
|
|
|
Hello I had created an Activex component
I try to create it dynamically with :
Set MyTotoObject = CreateObject("TotoViewOCX.TotoView")
In this cas I can only acces the function of my object I can not access
the extender functions.
So I can not displaying it.
I try another method:
Set MyTotoObject = MMI.Controls.Add("TotoViewOCX.TotoView", "MyToto")
With this mode I can only acces the extender methods, And I can displaying it.
but I need to use the function I have created.
Is it possible to create the object and displaying it with the possibility
to Use the functionnality i add inside
Thanks a lot Michael
|
|
|
|
|
Try to use the typelib while creating the control and then use the New keyword to instantiate it. First set a reference to the control. then create it
Dim obj as new MyProject.MyActiveXControlClass
Set obj = new MyProject.MyActiveXControlClass
obj.CallMethod
#define MOSTLY_LEAN_AND_MEAN
|
|
|
|
|
Hi all,
In my server implementation, I have the following code:
// Create a new CComEnum<> of IUser* interfaces
typedef CComObject< CComEnum<ienumuser, &iid_ienumuser,=""
="" iuser*,="" _copyinterface<iuser=""> > > EnumUser;
EnumUser* pNewEnum = NULL;
EnumUser::CreateInstance(&pNewEnum); // This is the line with error
However, when I tried to compile my server, I receive the following:
error C2259: 'CComObject<class atl::ccomenum<struct="" ienumuser,&struct="" _guid="" const="" iid_ienumuser,struct="" iuser="" *,class="" atl::_copyinterface<struct="">,class ATL::CComSingleT
hreadModel> >' : cannot instantiate abstract class due to following members:
c:\program files\microsoft visual studio\vc98\atl\include\atlcom.h(4403) : while compiling class-template member function 'long __stdcall ATL::CComObject<class atl::ccomenum<struct="" ienumuser,&struct="" _guid="" const="" iid_ienumuser,struct="" iuser="" *,
class="" atl::_copyinterface<struct="">,class ATL::CComSingleThreadModel> >::CreateInstance(class ATL::CComObject<class atl::ccomenum<struct="" ienumuser,&struct="" _guid="" const="" iid_ienumuser,struct="" iuser="" *,class="" atl::_copyinterface<struct="">,class AT
L::CComSingleThreadModel> > ** )'
I have IEnumUser declared in the server idl file, and IUser declared in a separate dll.
Does anyone know what I have done wrong? Your help is much apprepriated.
Sunny
|
|
|
|
|
Sorry, the error message got cutoff. It should be:
error C2259: 'CComObject<class atl::ccomenum<struct="" ienumuser,&struct="" _guid="" const="" iid_ienumuser,struct="" iuser="" *,class=""
atl::_copyinterface<struct="">,class ATL::CComSingleT
hreadModel> >' : cannot instantiate abstract class due to following
members:
c:\program files\microsoft visual studio\vc98\atl\include\atlcom.h
(4403) : while compiling class-template member function 'long __stdcall
ATL::CComObject<class atl::ccomenum<struct="" ienumuser,&struct="" _guid=""
const="" iid_ienumuser,struct="" iuser="" *,
class="" atl::_copyinterface<struct="">,class
ATL::CComSingleThreadModel> >::CreateInstance(class
ATL::CComObject<class atl::ccomenum<struct="" ienumuser,&struct="" _guid=""
const="" iid_ienumuser,struct="" iuser="" *,class="" atl::_copyinterface<struct=""
iuser="">,class ATL::CComSingleThreadModel> > ** )'
|
|
|
|
|
I call CoInitialize(NULL) in a DLL, and after some processing, I call CoUnitialize in the same DLL. This causes the app using the DLL to crash (rather spectacularly) in another un-related part of the code.
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
When that ocurss I prefer to use the CoInitialize and the CoUnitialize out of the DLL, before and after to call the function into the dll
Best Regards
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|