|
|
|
It works ! )
Thank you very much
|
|
|
|
|
Dear all:
I'm writing a com which will be accessed in asp using vc++.I'm not familiar with atl,so mfc is my only choice.I'm a beginner,so I do it step by step.I used appwizard to create a standard mfc dll with automation enabled.I created a new class CMyobj which inherited from CCmdtarget.The automation option I selected for CMyobj is createable by type id.Now I add a method
BSTR GetNameById(LPCTSTR ID)
My first question is if I can call this method directly in ASP like this:
DIM OBJ
DIM ID
DIM Name
obj = server.createobject("Myobj")
Name= obj.GetNameById(ID)
If I can't,what else should I code.(I am a step by step)
I also waht to add a method to return one(or more) recordset(s).How to declare the parameter type for recordset.My declaration is
LPDISPATCH GetNameByDept(long dept)
In the implimentation of this method,I create a recordset,retrieve the data,cast the recordset to (IDISPATCH *).The code is like this:
_Recordsetptr pRs;
pRs->createinstance(__uuidof(recordset))
....
pRs->open(sql,connection_string,...)
return (IDISPATCH *)pRs->Detach()
I create a c++ client and call the method like this:
_Recordsetptr pRs;
long deptid;
pRs = IObjinterface->GetNameByDept(deptid)
It works in c++.But i think it may be a little lucky.It doesn't work in asp.Asp code may be like this:
dim rs
dim obj
dim dept
set rs=server.createobject('adodb.recordset')
set obj=server.createobject('myobj')
rs=obj.GetNameByDept(dept)
rs.open
....
set rs=nothing
set obj=nothing
Can somebody give me some help?example codes,articles,urls or books.
|
|
|
|
|
I recommend these books on COM and ATL.
Inside COM (Programming Series) by Dale Rogerson
Developer's Workshop to COM and ATL 3.0 by Andrew Troelsen
Kuphryn
|
|
|
|
|
Hi everyone!
Is there anyone that has implement a multicast program on c++, that join a multicast group.
When it had join a group it will logg traffic and saves it in a circular buffer.
But first I will have some help with joining a multicast group.
Please help me,
Stefan
|
|
|
|
|
|
Code to Join:
<br />
struct ip_mreq mreq;<br />
{<br />
struct in_addr imr_multiaddr;
struct in_addr imr_interface;
}<br />
<br />
#define RECV_IP_ADDR "225.6.7.8" // An arbitrary multicast address<br />
<br />
mreq.imr_multiaddr.s_addr = inet_addr(RECV_IP_ADDR);<br />
mreq.imr_interface.s_addr = INADDR_ANY;<br />
err = setsockopt(<br />
sock, <br />
IPPROTO_IP,<br />
IP_ADD_MEMBERSHIP,<br />
(char*)&mreq, <br />
sizeof(mreq));<br />
<br />
Igor Proskuriakov
|
|
|
|
|
I read the following text in the book:
Declaring member functions inside aclass definition
And defining those member functions outside that class definition
Seperates the interface of a class from its implementation.
Clients of a class cannot see the implementation of that class' member
Functions and need not recompile if that implementation changes.
I don't understand the concept of the text and I want to know
Why don't the clients of the class need to recompile if they don't
See the implementation of that class' member functions?
|
|
|
|
|
The declarations for a class are what is normally contained in the header file for the class, for example:
class Calculator
{
public:
Calculator();
~Calculator();
float Sqrt(float i);
}
The defintions of the functions are contained in the .cpp file for the class. A client of the class only needs to include the header file for the class with the declarations of the members. It doesn't need to know how the members are implemented, it just needs their declarations. In the .cpp you can implement the members however you like, and change the implementation as much as you like without needing to recompile the clinet code. The client code only requires recompilation if the declarations in the header file change.
|
|
|
|
|
Hi,
I read in a book on COM that COM is language independent viz. you can create and use COM components in any language. I was wondering how do I go about using a COM component (created in VC++) in a Java client program?
Thanks,
Melwyn
|
|
|
|
|
There is a Sun-approved way, which is to create a native interface that implements the COM interface, and create a DLL with JNI that implements the native interface using the COM object. This will work with any modern JVM. Microsoft's JVM (which I don't think is supported any longer) had another way, which I don't recall the details of, that let you use a COM object directly from Java.
|
|
|
|
|
Hi,
Thank you for your reply.
That solved my doubt as far as using a COM component is concerned.
How about creating a COM component in Java? Books on COM say that you can creat a COM component in any language....even COBOL!!!
I suspect as usual Microsoft people make statements they can't back up.
Thanks,
Melwyn
|
|
|
|
|
Again, there is a Microsoft JVM-specific way which is (supposed to be) simple--
and the JNI way, in which case you create a C/C++ COM wrapper for your Java object. The wrapper would incorporate the JVM and call it to process COM requests in your Java object.
|
|
|
|
|
Hi!
What's the best method to wait for an application, that has been launched using the ShellExecute function, to terminate?
My application outputs something to a HTML file and opens it using the ShellExecute function with 'print' as open operation. ShellExecute returns me an instance handle. Now I want to wait until the application has finished printing and delete the temporary file.
Thanks in advance
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
Hi Dominik,
Altough you can get a handle to the process launched with ShellExecuteEx , the aproach is not very robust as the MSDN documentation explains.
Maybe the following can do what you want: Create the temporary file using CreateFile with FILE_SHARE_READ and FILE_FLAG_DELETE_ON_CLOSE , and keep it open while you invoke ShellExecute ; after some safeguard time close the file: if printing already finished, the file will automatically get destroyed; if printing is underwy, the file will get destroyed when printing is done.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Theoretically a good idea but...
FILE_FLAG_DELETE_ON_CLOSE<br />
<br />
Indicates that the operating system is to delete the file immediately after all of its handles have been closed, not just the handle for which you specified FILE_FLAG_DELETE_ON_CLOSE.<br />
<br />
Subsequent open requests for the file will fail, unless FILE_SHARE_DELETE is used.
Is that true??
Thanks
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
Indicates that the operating system is to delete the file immediately after all of its handles have been closed, not just the handle for which you specified FILE_FLAG_DELETE_ON_CLOSE.
Correct, that is the whole point of the trick: you can close after the printing process has opened the file, and forget about it --deletion will happen when the printing is done.
Subsequent open requests for the file will fail, unless FILE_SHARE_DELETE is used.
Oh, I see... Ummm, I'm not sure of the implications. Maybe you can try to see what happens. What puzzles me if that FILE_SHARE_DELETE is not available at Win9x, while FILE_FLAG_DELETE_ON_CLOSE , so I don't know how the whole thing behaves in both families of OSes.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Pretty simple,
Use ShellExecuteEx set SEE_MASK_NOCLOSEPROCESS,
use WaitForSingleObject(hProcess ....
Brian
|
|
|
|
|
I want to know : what's the meaning and concept of implementation and interface in the c++ programming?
I have read it but I have not understandit.
Thank you for your help.
|
|
|
|
|
Maybe you should try another book. Have you checked Bruce Eckel's Thinking in C++[^], which is freely downloadable?
That said, I can try to roughly explain what interface and implementation mean. Consider some class, for instance std::string . The interface is the public contract made between you and the class, by which you know wich member functions are exposed and how to use them. Implementation comes to the actual code the author of the class has written to honor this interface: so, std::string::apend is precisely defined for you to use, but is can be implemented in a number of different ways.
This general concept of interface vs implementation is applied in many contexts. You'll probably find it when dealing with abstract base classes, a very similar concept to that of interface in Java, in case you know that language.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
C++ is a very powerful programming language in the fact that it supports the object-oriented paradigm including the interface/implementation.
Essentially, the client only seens the interface of an object class. The implementation is not visible and should not matter in regard to the client.
Kuphryn
|
|
|
|
|
Hi Guys,
In My application i have to create a List control with Each column having different Fonts.Well I have subclassed the control and im Able to ownerdraw the subItems...Its works fine..But now my problem is that I have to display Icon in reportstyle..
But when im Using LoadIcon to load from resource and then displaying using pDC->DrawIcon(, the icon size is very large....I want 16*16 size icon...
Anyidea how to do in Ownerdraw list ctrl
cheers,
Super
------------------------------------------
Too much of good is bad,mix some evil in it
|
|
|
|
|
Perhaps it's not the fastest solution, but the Windows API function DrawIconEx lets you specify the size of the icon.
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
Hi,
is there any way to create forms with c++ insert this forms to the programm Outlook, so that a user can call this form from a menu.
I know that in Outlook is a way to do this, but I have to do it from another programm.
For this themes I found concepts as automation and COM but no
background for this.
Chris
|
|
|
|