|
Simon Steele wrote:
If I split the interface and class definitions, then surely I can have a single .IDL file for the three which defines the interfaces? Then each can implement classes and libraries which contain implementations of those interfaces? As I said I'm new to this, but it does seem to be hinted at in the book I'm reading.
Yes, at least in theory, and it will even compile. But I am not sure it will run. I had this problem, and the .tlb was not including the idl stuff I was including in the main idl. So it was ok for compilation time. But only for compilation time.
Simon Steele wrote:
the shear amount of code to do this stuff without ATL seems incredible!
That's a fake. May be I publish COM skeletons sometimes in the future so you figure out it's damn light, easy, DEBUGGABLE (unlike ATL macros), neat and reusable. (as you can see, I am not a big fan of ATL ).
How low can you go ? (MS rant)
|
|
|
|
|
__Stephane Rodriguez__ wrote:
That's a fake. May be I publish COM skeletons sometimes in the future so you figure out it's damn light, easy, DEBUGGABLE (unlike ATL macros), neat and reusable. (as you can see, I am not a big fan of ATL ).
Agree entirely. Please do publish your code
Len Holgate
www.jetbyte.com
The right code, right now.
|
|
|
|
|
I have an application which needs to find any available COM objects in a given area/category. For example, my app could start up and look for what COM objects it has available. This would allow me to register new COM objects and know my app will pick them up next time it starts up.
If I want my app to find the COM objects I could just look them up in the registry but that would only work if my app already knew the names of their interfaces or their GUIDs. I need my app to determine the name/GUID of the COM objects it handles at run-time.
In other words, it would be nice to be able to group my COM objects hierarchically so that I can find all the COM objects I'm interested in easily. My app just specifies the parent "directory" in the registry and then looks in that directory for all the COM objects it's interested in.
Can anyone suggest a way of doing this?
Thanks.
"The folly of man is that he dreams of what he can never achieve rather than dream of what he can."
|
|
|
|
|
|
Thanks for the link, I had already come across the idea of categories but I'd heard there were some problems with older Windows OS versions such as 95 and 98. Nevertheless, I've read through that link and written some code, and it certainly works OK so far. I can't find the article describing the problems with older OSes now either but it's not really that important while my code is working just fine
"The folly of man is that he dreams of what he can never achieve rather than dream of what he can."
|
|
|
|
|
Hi ,
I am trying to access a property of an activex control and in
code statement
InvokeHelper() it pops up a message box telling its a runtime property.
how to avoid this??
waiting for ur replies eagerly.
pradeep
|
|
|
|
|
I am making com using ATL recently.Now I encounter a insidious question.That is I want pass a struct to com.
How can I solve this question?
|
|
|
|
|
define your struct in idl file
I am seeking...
For what?
Why did you ask me for what? I don't know!
|
|
|
|
|
hi all,
My problem is that I created a ATL COM named "Controller". The com has one method, "CheckOnline" as below:
//IDL
interface IController : IDispatch
{
[id(1), helpstring("method CheckOnline")] HRESULT CheckOnline([out] BSTR* mdln, [out] BSTR* softrev);
};
//C++ implementation
STDMETHODIMP CController::CheckOnline(BSTR* mdln, BSTR* softrev)
{
// TODO: Add your implementation code here
*mdln = ::SysAllocString(L"testing");
*softrev = ::SysAllocString(L"1.2");
return S_OK;
}
and then I compliled and deploy the com sucessfully. Now I create a VB client as below:
Dim eq As New EQCONTROLLERLib.Controller
'Set EQController = CreateObject("EQPController")
Dim param1, param2 As String
Call eq.CheckOnline(param1, param2)
txtParam1.Text = param1
txtParam2.Text = param2
when compling VB Client, I get the error: "Byref Argument Type Mismactch"
oh, Why's that ! Is my way is correct??? Is there another way to get out parameter as BSTR string in VB client???
thanks for your help !
Huu Pham
|
|
|
|
|
[OK everyone, duck! This message contains VB references (aka mild bad language)]
Try
Dim param1 As String, param2 As String
Unlike C/C++, VB needs the type to be associated with each variable in a declaration list.
Steve S
VB? Me? Are you crazy?
|
|
|
|
|
I am building an Ad Hoc tool for work. Using a DLL to access the SQL Server database via ADO Smart Pointers (_RecordsetPtr, _ConnectionPtr).
Anyway after I generate the SQL string the end user will create it gets truncated when converted to the BSTR datatype (which is necessary to pass out of the DLL via IDL).
It appears to truncate at 511 chars (so I assume BSTR maxes at 512 with a NULL terminating character).
What I need to know is if there is a way around this limitation. Is there a wrapper or function that expands the length of the BSTR to be passed?
Or is there away to send it in pieces and have SQL Server concatenate it together when it receives it?
I know that Query Analyzer, Cold Fusion and other tools pass incredibly long strings to SQL Server so it's got to be possible!
Does anyone know the trick? Please let me know!
Adam Murray
Contract Programmer
Microsoft Certified Professional
|
|
|
|
|
nativespirits wrote:
I am building an Ad Hoc tool for work. Using a DLL to access the SQL Server database via ADO Smart Pointers (_RecordsetPtr, _ConnectionPtr).
Anyway after I generate the SQL string the end user will create it gets truncated when converted to the BSTR datatype (which is necessary to pass out of the DLL via IDL).
It appears to truncate at 511 chars (so I assume BSTR maxes at 512 with a NULL terminating character).
I don't know how long they can be, but I guess they can be as long as available system memory. This should be enough for your query
Are you using wsprintf for building the query? wsprintf has a limit of 1024 bytes, wich should be 512 chars on a UNICODE build. If so, use _snwprintf...
Q261186 - Computer Randomly Plays Classical Music
|
|
|
|
|
It's probably a limitation of ADO. There's one way to get around that problem but I don't think you want to hear it
Todd Smith
|
|
|
|
|
BSTR s have no limitation other than physical memory and address space size (2GB). Something else is truncating your strings.
--Mike--
"I'd rather you just give me a fish today, because even if you teach me how to fish, I won't do it. I'm lazy." -- Nish
Just released - 1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
If you need to get a long string out of an ADO recordset, use the GetChunk method, you can call it over and over until all your text is retrieved.
Conversely, to place a long string into an ADO recordset you'd use AppendChunk .
Append/GetChunk can be used for more than strings, they can be used on binary data columns as well.
AppendChunk()[^] / GetChunk()[^]
-- ian
http://www.ian-space.com/
|
|
|
|
|
Where can I found a good tutorial for "Creating a ActiveX component" with Visual C++ ?
Daniel
---------------------------
Never change a running system!
|
|
|
|
|
What is you email?I'll send you one.
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
Hi,
I'm trying to find a way for an out-of-process (C++) COM server (built w/o MFC support) to control the client application's cursor (shape).
Up to this point, I've tried several different variations of LoadCursor/SetCursor; e.g.:
HCURSOR NewCursor = LoadCursor(0, IDC_WAIT);
HCURSOR OldCursor = SetCursor(NewCursor);
I've also tried to retrieve a handle to the client's window and modify the app window class' properties (for the cursor) ; e.g.:
HCURSOR NewCursor = LoadCursor(0, IDC_WAIT);
HWND hwnd = GetActiveWindow(); // returned a NULL value
DWORD OldCursor = SetClassLong(hwnd, GCL_HCURSOR, (LONG)NewCursor);
In all cases, the application builds but does not modify the cursor. I think the primary problem I'm dealing w/ here is the fact that the COM server is out-of-process.
Any suggestions?
Thanks,
Steve
|
|
|
|
|
I have a DCOM executable which is a server program written in C++. The client is a VB program which calls the methods from DCOM. When the first client makes the call to DCOM, the DCOM executable is started on the server side and its initial memory size is 20,000K. The memory keeps growing when ever any client calls a DCOM method. In C++ code, I call QueryInterface(...), AddRef() and I release pointer to Interface by calling Release(..), but the memory still keeps growing for every call to DCOM method.
Why is this?
When each client disconnect from DCOM server, the memory on server side is not release, but only when the last client disconnects, the DCOM executable is stopped which is fine.
How can I keep the memory on server side not grow when clients are making calls to DCOM interface?
|
|
|
|
|
Im having a problem with my COM object. The IDL file below describes my interface.
In VB when I do a CreateObject, i get a type mismatch. When I try and declare a type "vbtopicstruct", i get an automation error 440? ANy help?
<br />
import "oaidl.idl";<br />
import "ocidl.idl";<br />
import "unknwn.idl";<br />
<br />
typedef<br />
[<br />
uuid(C21871A0-33EB-11D4-A13A-BE2573A1120F),<br />
helpstring("Topic Structure Definition")<br />
]<br />
struct vbTopicStruct<br />
{<br />
long a;<br />
long b;<br />
long c;<br />
} vbTopicStruct;<br />
<br />
[<br />
object,<br />
uuid(3C6C8D49-E7B3-4799-9EF6-37825D43064A),<br />
helpstring("IConvertTopic Interface Definition")<br />
]<br />
interface IConvertTopic : IUnknown<br />
{<br />
HRESULT ReadTopicsFromFile([in] BSTR filename, [in, out]vbTopicStruct *topics);<br />
HRESULT WriteTopicsToFile ([in] BSTR filename, [in, out]vbTopicStruct *topics);<br />
};<br />
<br />
[<br />
uuid(3C6C8D4B-E7B3-4799-9EF6-37825D43064A),<br />
helpstring("Topic Conversion Interface Definition Library")<br />
]<br />
library ConvertTopicDefinitionLibrary<br />
{<br />
importlib ("stdole32.tlb");<br />
importlib ("stdole2.tlb");<br />
<br />
struct vbTopicStruct;<br />
interface IConvertTopic;<br />
}<br />
Ryan Baillargeon
Software Specialist
|
|
|
|
|
The IDL doesn't include a CoClass, is this because either your IDL or resultant TLB is included/imported into another IDL file?
Steve S
[This signature space available for rent]
|
|
|
|
|
Hi.
Two weeks ago I posted a similar message about recommended advanced C++ books. An overwhelming number of responses mentioned Scott Meyers' Effective series including STL, Modern C++ Design: Generic Programming and Design Patterns Applied
by Andrei Alexandrescu, and Design Patterns.
I decided on Scott Meyer's Effective STL and Modern C++ Design: Generic Programming and Design Patterns Applied
by Andrei Alexandrescu. I definitely agree those books are exceptional in terns of advanced techniques and design patterns. I learned more from those books have from all previous C++ books I owned.
Now I am ready to move ahead and learn more specific software design, COM. I believe COM should be the next concept to look into because as windows applications become more integrated, COM will be even more popular and useful in the future.
I have heard about ATL and know that ATL is to COM and MFC is to Win32 API. Nonetheless, I do not know how ATL relates to C++.
What do you recommend as the best book on COM concept and implementation using C++?
Thanks,
Kuphryn
|
|
|
|
|
Essential COM by DON BOX is a good Book
Mad Coding.
|
|
|
|
|
"Inside COM". MS Press, Dale rodgerson.
How low can you go ? (MS retrofuck)
|
|
|
|
|
Okay. Thanks.
Davros posted an interesting reponse about COM and its future at cprogramming.
http://cboard.cprogramming.com/show...&threadid=26804
Kuphryn
|
|
|
|