|
My normal technique for invoking MySql is producing LNK2001 errors from a com project, using paths that work for an exe based application. Anyone succeed in making this a MySQL connection from a COM dll?
Thanks
Ger
|
|
|
|
|
Hello !
Try by importing the msado32.dll and use the smart pointers generated !
-Malli...!
|
|
|
|
|
I have a standard DLL in visual c++ 6.0 that I can call from other exes for things like conveting CString to Integer or Float. I want to call it from a com object but I am geting declspec link errors. I didnt need to do any declspec(export) or declspec(import) when the exe was calling it. Is this my prob lem?
Ger
|
|
|
|
|
What's the exact error?
Basically, when you cbuild the conventional DLL, all exported symbols must be declared with __delcspec(export). When you use it (i.e. #include the respective headers), these ver symbols need __declspec(import). There are a few cases wehre it works without nonetheless (and there are other ways to export symbols), but that's pressing your luck.
Some of us walk the memory lane, others plummet into a rabbit hole
Tree<t> in C# || Fold With Us! || sighist
|
|
|
|
|
I have a c++ unmanaged code (ATL/WTL) from which I need to consume a c# assembly with a CCW (Com Callable Wrapper) Exporting the c# side for COM is straight forward, and when I import it at design time it imports fine and my .tlh file is generated correctly... However when I try to CoCreateInstance at runtime I get 1 of 2 errors.. Either "Class not registered" or "File Not Found" I have run RegAsm on the assembly, with /codebase switch. I have also tried nocodebase switch. The C# assembly is in the same path as my c++ DLL. I have tried it in the path of the parent exe and system32. I have also tried strong naming the file and using GACUTIL to put it in the GAC. Each time, RegAsm goes fine, I check the registry and it all looks ok, but I continually get the "File Not Found" Hresult from CoCreateInstance...
In addition to this info... This was working great with VS 2003, but I have recently upgraded to VS2005 and this has started to happen when I did that upgrade.
Any ideas?
Jake-
-- modified at 7:32 Saturday 8th July, 2006
|
|
|
|
|
We created an ATL server in VC++. Diffrent vc++ clients from diffrent process use this Server. It was working fine. Now all clients introduce one more thread in their process. In order to share the Com pointer to the new thread, they use the global interface table.
We start all application at startup. Here all application will initialize Com Server pointer and place them into the global interface table. Some COM interface calls occur during start up from main thread. These calls are working fine.
In our system we allow only one application to process its messages. This message processing occurs in a different thread other than the main thread. The message handler function retrieves the COM pointer from global interface table and call required interface. This works fine for first application. But when we transfer execution right to next application, even though we can acquire the interface pointer from interface table successfully, the COM interface call fails and the reason I got is “Not enough storage is available to complete this operation”.
Any hint.
-- modified at 23:40 Sunday 9th July, 2006
|
|
|
|
|
Can two threads in the same process create separate instances of the same COM Component? I mean Thread1 will have its own COM instance and Thread2 will have its own. Do I have to create the COM Component in a special way to have the above feature?
I have an application which has several threads. Now each thread must have its own instance of the COM Component. Can anyone help?
---
Hakuna-Matada
It means no worries for the rest of your days...
It's our problem free, Philosophy
<marquee behavior="alternate" scrollamount="5" scrolldelay="50">
|
|
|
|
|
Hello Hakuna,
>> Can two threads in the same process create separate instances of the same COM Component?
Answer : Yes, certainly.
>> Do I have to create the COM Component in a special way to have the above feature?
Answer : Just make sure that the COM Component is not a SINGLETON.
Contact me again if you need any further clarification.
Best Regards,
Bio.
|
|
|
|
|
Is there any way to implement the same functionality in case of SINGLETON class?
|
|
|
|
|
Hello George,
>> Is there any way to implement the same functionality in case of SINGLETON class?
I'm not sure what you mean specifically by "the same functionality". Perhaps you can elaborate on this point. However, two or more threads -can- create and use a SINGLETON COM object, even without knowing that the COM object is a singleton. Each thread will think its object is its very own when in actual fact it is shared across threads.
However, there will be a subtle internal difference which involves the apartment of the COM object and the apartment(s) of the client threads. If the COM object is an STA object, and the first thread that created it is an STA thread, then only this thread will have direct access to the object. The other threads will receive a PROXY to this COM object.
Contact me again if you need any further clarifications
Best Regards,
Bio.
|
|
|
|
|
Hi all,
I have a COM program written in VC++ (unmanaged). I got the managed code written in C#. My issue is I need to call the COM dll functions from my C# program.
Does any one have an idea how to do it? If so, please reply me with me some sample code.
Thanks
Sony
|
|
|
|
|
Hi. I am a newbie.
In C, I managed to read a file which consists of a single string.
How do I pass this string to VB via an OCX?
I was thinking of creating a safearray to do it but I am not to sure how to safearray a string. I have only managed to do it for numbers.
Thanks in advance!
|
|
|
|
|
No need to use a SafeArray.
If the string is using ANSI, convert it to UNICODE using MultibyteToWideChar API.
For the Unicode string, call SysAllocString to make it a "good" BSTR, which is the "VB-native" string type.
Depending on the parameter declaration, you need to SysFreeString the BSTR when you are done.
Some of us walk the memory lane, others plummet into a rabbit hole
Tree<t> in C# || Fold With Us! || sighist
|
|
|
|
|
Hi all,
Im new to ATL COM programming(2 weeks!). im using an api in my component.
unfortunately i havnt been able to load it appropriately(atleast this is what
the client says!). this is how i've done it... pls tell where im wrong.
i created an ATL class in the dll and added the following to the class' cpp
file in the global area
<br />
HINSTANCE hDll=LoadLibrary("API.dll");<br />
typedef short (*Init_type)();<br />
typedef short (*Close_type)();<br />
typedef short (*SetAnalog_type)(int,double);<br />
typedef short (*SetOutput_type)(int);<br />
typedef short (*ResetOutput_type)(int);<br />
typedef short (*IsInput_type)(int);<br />
<br />
Init_type Init;<br />
Close_type Close;<br />
SetAnalog_type SetAnalog;<br />
SetOutput_type SetOutput;<br />
ResetOutput_type ResetOutput;<br />
IsInput_type IsInput;<br />
<br />
Class::Class()
{<br />
Init = (Init_type)GetProcAddress(hDll,"Init");<br />
Close =(Close_type)GetProcAddress(hDll,"Close");<br />
SetAnalog = (SetAnalog_type)GetProcAddress(hDll,"SetAnalog");<br />
SetOutput = (SetOutput_type)GetProcAddress(hDll,"SetOutput");<br />
ResetOutput = (ResetOutput_type)GetProcAddress(hDll,"ResetOutput");<br />
IsInput = (IsInput_type)GetProcAddress(hDll,"IsInput");<br />
}<br />
after this i've created other methods in the class where i use these api
functions.
the dll compiles without problems, but when i use these methods in a vb
client i get this error...
The instruction at "0x00000000" referenced memeory at "0x00000000". The
memmory could not be "read".
Click on OK to terminate the program...
pls help... maybe i dont know how to load an api...im new to this. can
somebody give a link to a sample code where the coder has loaded the api and
used the functions.
Thanks in advance
Nikhil
|
|
|
|
|
I am writing windowless activex control with ATL. i want this control to blink with certain rate.
I am using all the techniks ( bitmap drawing, flickerfree activation ... ) but I still see some flicking. When I use windowed activation everighing is fine. For blinkking I am using timer funcion
Can somebody dive me some idea how to fix the problem
|
|
|
|
|
Hi,
I am a newbie and was not sure about the category under which my question comes. Therefore please move it to appropriate category if you guys feel so.
I have an address book application which I want to integrate with outlook/outlook express.
Can someone please tell me how can I do it ? Some tutorial or link.
My application is in some way similar to plaxo.
Thanks a lot
|
|
|
|
|
Hi all,
I have trouble with a vc dll com which im using in a vb client...
i've imported a third party ocx and a dll which consists of API functions
(basically its architecture is similar to kernel32.dll) in my vc com dll and
ive used them in other classes.
i wrote a class called myerrorhandling in which has a public method
error_logger
this is the method
<br />
STDMETHODIMP errorhandling::error_logger()<br />
{<br />
FILE *fptr;<br />
char error[10]={"ERROR***"};<br />
fptr=fopen("C:\\Debug.txt","a+");<br />
fprintf(fptr,error);<br />
fclose(fptr);<br />
return S_OK;<br />
}<br />
i get this error when i create an object of the errorhandling class in vb
<br />
Run-time error '-2147024770 (8007007e)':<br />
<br />
Automation error<br />
The specified module could not be found.<br />
infact i get this error while creating an object of any class in the dll
i havnt used any api functions or thirdparty dll objects anywhere in this
class(error handling)...
i created another com dll in vc and added this errorhandling class and it
worked fine.
what could the problem be?
thanks in advance
Nikhil
|
|
|
|
|
got it.. i havent been able to import the api properly.
how do i import kernel32.dll in my com dll if i wanna use gettickcount??
pls help
thnks
nikhil
|
|
|
|
|
I think you can use the LoadLibrary and make a call to GetTickCount function using the GetProcAddress
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
|
Hello,
I am using MFC - ActiveX control in C# based windows application.
I am not able to debug the control with the C# application while it is possible with the MFC applcation.
Is it possible to do so if yes then HOW.
Thanks.
Byee..
Gajesh
Pune(India
|
|
|
|
|
Is that DCOM is implemented through Microsoft Transaction Server. If not so then how it is implemented.
|
|
|
|
|
DCOM stands for Distributed COM, and refers to the ability to call COM objects running on another machine. DCOM is implemented over DCE-compatible Remote Procedure Calls [RPCs]. CoCreateInstance calls from the client are translated into a message that's sent over the network, which is received by the server computer's RPC subsystem, the RpcSs service. In modern versions of Windows, this service runs in a SvcHost.exe process. The RPC subsystem locates a process to serve that class, starting one if necessary, and calls the process on the client's behalf. I'm not sure if the system then hands the network connection over to the server process so that future calls don't have to go through the RPC subsystem. The exact network protocol used, below the RPC protocol, is dependent on the configuration and on which network protocols the system has installed. On Windows XP and Server 2003 machines, only connection-oriented protocols such as TCP are enabled by default; earlier versions could use UDP if the call security didn't require a connection.
MS Transaction Server was a way of setting up different contexts for objects, to allow them to interact without knowing about one another. It offered transaction support, object pooling and just-in-time activation. You had to program a little differently for MTS than for COM. In Windows 2000, MTS was incorporated into the regular COM APIs and was renamed COM+. With MTS and COM+, it's possible to have a COM component implemented as a DLL but still run outside the creating process, using a surrogate process (dllhost.exe). To communicate between processes running on the same system, COM uses a special form of RPC called Local RPC.
DCOM predates MTS by a couple of years.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Hello world!!!
I created a UPnP device which works as a control point. It succeeded but now I'm facing a great problem. I'm trying to register the device with the host in order to be published on the network. But the IUPnPRegistrar::RegisterRunningDevice method doesn't work. The return value of this is an E_FAIL which is a non-specified error value. Thus I think the DLL in which I wrote the device control object is bad. So I need a help from anyone who have already registered a UPnP device or anyone who know very well how to process.
Thanks for the help.
|
|
|
|
|
My ActiveX project has some problem, It's Can't Add Method and Property. It's hint Error adding a(n) method to the associated class.I'm use vc6+sp6.
tell me why ,thank you.
msn:Flashcutreg@hotmail.com
|
|
|
|