Hi to all:
I would like to pass some values from vb.net to an .dll in C++, using WM_COPYDATA or even using pipes...
Can anyone point me to a existing example code for start?
Thanks
Printable View
Hi to all:
I would like to pass some values from vb.net to an .dll in C++, using WM_COPYDATA or even using pipes...
Can anyone point me to a existing example code for start?
Thanks
WM_COPYDATA implies a message that means a message loop is necessary. I've yet to see a Dll that implements a message loop. I think you need to provide a whole lot of details here because this doesn't sound right.
Hi:
Thanks for your reply...do You Know where i can find a code as example?
Code sample to do what ?
That show wm_copydata
Here is an example that shows how to use it. Note though that it is written in C++.
Ok...nothing in vb.net no?
Here is another article about it with some code in c#. It provides a better explanation and you may pass the code through an online converter to get its VB.Net equivalent.
What is it that you really want to do? As Niya already pointed out the WM_COPYDATA is a Windows message that you normally send to a window not to a particular file. The message will then be handled by the owner process of that window (the handler or message pump could technically be located in a DLL but the DLL must then be virtually mapped to that process).
If the DLL expose a function that accepts data why not just make a call into that?
I'm sorry but the question as it stands just doesn't make any sense so it would be better if you explain what you're really trying to do instead of what you think you should do, otherwise it's impossible for anyone to give you any decent answer. :)
Hi:
Like i had said in my first post:
The .dll is write in C++, and I not know C++ language, that's because i need to make an externall application to pass some values for this .dll...This .Dll are ready to receive this process!Quote:
I would like to pass some values from vb.net to an .dll in C++, using WM_COPYDATA or even using pipes
Thanks
How can the Dll receive these values ?
Good question Niya...this is a problem that i need to understand and resolve!
Well I can't tell you how the Dll would receive the values. I don't have the Dll. You're the one that has the Dll and presumably any documentation that goes with it.
The .dll it's not mine...The owner of the .dll said the only way i can do that is via WM_COPYDATA or even using pipes, but i'm with you Niya, i think it's not possible but.....
Joacim i had already tell what i want to do...What you don't understand in my question? I think it's clear that I want to do no?
No it's absolutely not clear what you want to do. What was the question you asked the creator of the DLL that got him to reply that you needed to use WM_COPYDATA? What do you expect to happen when you send that message? What are the desired results? You have told us nothing of what you really want to do, all you've said is that "I was told to use WM_COPYDATA how do I send that to a DLL" and the answer to that question is: You don't! You send messages to a window or a control but not to a file.
Ok...let's see if i could explain a little more better:
I need to communicate with an application XX, via an specific protocol, that this application XX have!
A company YY had construct a .DLL that comunicate (input and outputs) with this application XX, and this .DLL is an example the way we can communicate with AP XX...
Well...in my side I have an electronic board that i have to collect data and send this collect data (via strings, and integer numbers) to this .DLL and this .DLL for APXX...in other words this .DLL function like an interface....In contact with Company YY they are told me the way to do this is use WM_COPYDATA or using pipes..
That i expect when i send the message is the .DLL could collect him in a variable
that i would like to do is just throught this WM_COPYDATA send my strings and integer numbers to the variables that this .DLL have in an specific function...
If he told you to use WM_COPYDATA then he must have told you how to retrieve a window handle from the Dll so we can use SendMessage to post a WM_COPYDATA message to it.
Yes...is that i go ask him!
If the DLL is an example of how you can communicate with the application then it's not really via the DLL you should communicate but rather build something like this DLL. What you really want is obviously then to communicate with the app XX. Do you have the source code for the DLL, and would it be possible for you to post that here? Maybe that would be an easier way of figuring out exactly what you're trying to do.
Yes...I would like to send all project but the file is too large for attach...wich way i can send?
The source files of the DLL can't be that large, just zip them up and attach it as one file.
Files Attached
WM_COPYDATA is not what you are looking for here (if you want to deal with the DLL because as said this is a file (Windows Messages--evidently are usually for window's)). How can you pass values to a DLL? Are you trying to invoke a function embedded within the DLL called with parameters? I don't understand. It seems like you actually want to deal with the application window, and not the DLL itself.
Also, if this is Vista or later, you may have issues with this Windows message if the target windows process is invoked with higher privileges because of UIFI. I ran into this and worked out a fix for a few of the affected WM's a while back.
edit; Hehe... *chuckles*
cpp Code:
// dllmain.cpp : Definiert den Einstiegspunkt für die DLL-Anwendung. #include "stdafx.h" BOOL APIENTRY DllMain( HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: case DLL_THREAD_ATTACH: case DLL_THREAD_DETACH: case DLL_PROCESS_DETACH: break; } return TRUE; }
Okay, this doesn't say a whole lot though lol. I took a look at the other file too, and there's not much in there that means anything to me without knowing what it's for.
Can you explain why you are trying to interact with this DLL? What is your main goal (in specific)? You should be able to provide more details here unless this is confidential information for some reason...
I've look at the code and I don't see thing in there that can be used as an interface to put data. There are no windows so that means WM_COPYDATA can't be used and there nothing that setup pipes to listen. I'm sorry, but if that was the Dll, then I'm afraid that sending info to it from VB.Net is impossible.
However, all hope is not lost. If you have the source code for the Dll then I can assume that you are allowed to make your own versions of the Dll. If this is true then that means you are free to implement whatever scheme for passing data that your heart desires. The simplest would be to add a function which you call from VB.Net passing whatever value you want.
The DLL is not really used for anything else but as some kind of add-in to what I believe is a flight simulator program. It creates a new gauge on the panel (which I assume is like the dashboard in the cockpit of the plane). It's actually all explained in the readme file (which I read because it told me to :)).
Hi guys...
In fact Joacim are right, and he had told everything....the .dll comunicate with FS, and that i would Like to do is create an External application that send values to this .dll, but Like i had see in your comments i think i need to find annother solution!
But this DLL does not accept data from anything but the flight simulator itself. Why do you think you even want to send the data to the DLL? Isn't it to the flight simulator that you want to send the data to?
Yes Joacim, but once this is an .dll for an specific software that work inside FS, i need to Know if is possible comunicate directly with FS!
The program itself would probably deal with the data, so that's where you would need to target, not this dll.
Thanks to all for your Help