|
Hi Peter
I dont know what style the API is in, the DLL has been supplied to me
from an external company, at a guess i would say it was probably written in VB or delphi
it doesnt come with any .h files or .lib files, all i have been
supplied with is a single dll file
any ideas ???
thnaks
simon
|
|
|
|
|
Uhhhh....
You got this DLL from an external source. They provided you with nothing except the DLL file?
What does this DLL do? Do you know anything about what you're supposed to do with it? Or what function you are supposed to call? Or....
What exactly do you know about this DLL?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
Santa Cruz Networks
|
|
|
|
|
Hi Peter
what it is, is im writing an application which access's an external
company's database, however they wont, for security reasons allow me
to access the database directly, instead they have provided me
with this DLL, which contains exported functions from another program
which i then call to obtain the data which i require
|
|
|
|
|
So, there's 2 parts to this problem.
1) How to get access to the DLL and it's functions
2) How to integrate this into your program.
(1) access -- Get familiar with LoadLibrary and GetProcAddress. LoadLibrary will load the DLL into memory. GetProcAddress will probe the loaded DLL for it's entrypoints (functions). You should also understand "pointers to functions" and how to represent those in C++ code.
(A) Create a prototype for the function you want to call. This prototype declares a function pointer:
typedef int (FAR PASCAL *FunctionPrototypeName)();
note that the FAR PASCAL identifiers are defined by whoever wrote the DLL. This defines the "calling convention" used in the function. Get this info from whoever wrote the DLL.
(B) Declare storage for this pointer. Global variable is fine. [Consider wrapping all this stuff in a C++ class, i.e. represent the DLL as a class, compartmentalizing access to the DLL through the class. Abstract each entrypoint of the DLL into a C++ member function.]
FunctionPrototypeName fp_function;
(C) In code, load the library:
HMODULE hDLL = LoadLibrary( _T("MyDLL.DLL" );
(D) Load the pointer to the function:
fp_function= (FunctionPrototypeName)GetProcAddress( hDLL, "ExportedFunctionName" );
(E) The function is now ready to be called:
int x = (*fp_function)()
(2) integration
As I mentioned in a note above. Represent the DLL as a C++ class. Each entry point in the DLL, should be represented by an member function in the C++ class.
-p
P.S. I can't guarantee my syntax is perfect. Compile errors may occur. Mileage may vary. Do not bend, spindle, or mutilate.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
Santa Cruz Networks
|
|
|
|
|
Hey lads,
Is it possible to handle a ON_REGISTERED_MESSAGE message in a CWinApp derived class... Keeps giving me static_cast errors... I don't have the code with me now... It was 1am this morning that I was doing it and I didn't even get a chance to look at the messge properly before I fell alseep.
Think it was somethign to do with a cast from CWnd to CWinApp. ON_REGISTERED_MESSAGE a macro that only works with CWnd?
Regards,
Brian Dela
|
|
|
|
|
when i open mmc.exe (microsoft managment console)there is a default menu items
'Action' 'View' & 'Favourites'
i opened sql server enterprise manager which is uses the mmc and i notice that the last menu item was 'Tools'....
(i have a snap-in object project)
i need to produce such an item...but don't know how?
can any1 help please?
thanks in advanced,
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Does anybody know how to scan avalible wireless (802.11b) network in a MFC program?
Any tips will be appreicated!
mao
|
|
|
|
|
What do you mean by "scan wireless network?"
|
|
|
|
|
What "scan wireless network" means enum all avalible 802.11b wireless network on air.
Sometime, there are more than one AP (access point) or Adhoc network avalible on air. I want to enum all the avalible network and then let user choose to connect one of them.
DavidCrow wrote:
What do you mean by "scan wireless network?"
|
|
|
|
|
Take a look at the DDK documentation for 802_11 OIDs. For example, an application can send OID_802_11_SCAN_LIST to ask the miniport driver to do active or passive scan. This list is then returned to the application. User Mode applications cannot send OIDs directly to the miniport therefore you have to have a protocol driver in between to do this correctly. On Xp the zero config service uses a variation of "User Mode I/O" protocol driver (in the DDK Samples) to send these OIDs. Some vendors implement private IOCTL codes in the miniport, in that case application can just send IOCTLs directly to the miniport.
|
|
|
|
|
thank you very much, it sounds ok, i will try this way.
|
|
|
|
|
Thank you very much for your help.
After I studied some DDK documents, I relized you r a real expert in this area!
Since WinXP introduced a WZC service, does this mean in an XP box, I needn't write a NDISUIO driver myself, instead I can use WZC to do everything I want?
However I searched MS site and found very few information on WZC, almost get no information on how to use WZC service at all. Could you give me more tips?
Thanks so!
|
|
|
|
|
Does anyone know how to change network and adapter setting in a MFC program?
It can be easily done by hand, just right click on a network connection and select "Properties" to make changes. However how to do that in a program?
I found a very useful program by IBM, named "Access Connection" (http://www.pc.ibm.com/qtechinfo/MIGR-4ZLNJB.html?doctype=Downloadable+files) can do this. I am trying to write a simular program.
Any help is appreciated!
|
|
|
|
|
I hope this is what you are searching ...
eg. to alter the ip - adress
You need to open a key like (for WinNT):
sKey = _T("SOFTWARE\\Microsoft\\
Windows NT\\CurrentVersion\\NetworkCards");
res = RegOpenKeyEx(HKEY_LOCAL_MACHINE, sKey, 0, KEY_READ,
&hKey);
if (res != ERROR_SUCCESS) goto LAB_X;
- Imake it a little bit shorter -
then enumerate the adapter of your choice by
RegEnumKeyEx
the 'ServiceName' - key ist the important - it is something like '{EE0A056F-1C40-4995-B7EB-E47E2C1E0A27}'
combine the path to the service-interface
'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\'
with the '{EE0A056F-1C40-4995-B7EB-E47E2C1E0A27}'
and you will find the key 'IPAddress'.
it is a MULTI_SZ, so editing is a little bit harder - but change the value and it is applied
good luck ...
|
|
|
|
|
Thanks but I am not only intend to change the IP address.
I am focused on changing network adapter's advanced settings.
|
|
|
|
|
Metric is in the same folder,
subnetmask, Gateway, ...
just alter the values in the registry. If it works you can programm it ...
Activation and Disabling of the adapter is a little bit tricky.
Maybe I totally misunderstood
by
|
|
|
|
|
Is there any API provide such things? If we have any API it will be more helpful.
or Does it have any other way to do this?
Pls help me.
Thanx in advance.
regards
Halid
|
|
|
|
|
Hi all,
I am wondering that the following is working. When will the temporary string, created in the constructor, destroyed? After constructor call or after object destroyed? Am I right that c_str() returns only the pointer and not copy char string? Is it a safe program or not?Thanx for your time,
#include <string>
#include <iostream.h>
#include <stdlib.h>
#include <stdio.h>
class a
{
public:
const char * name;
a(const char * name_ ):name(name_){};
void print() {cout<
|
|
|
|
|
Ilia Oussorov wrote:
When will the temporary string, created in the constructor, destroyed? After constructor call or after object destroyed?
The 'name' variable belongs to the constructor, not the class itself. Therefore, it will lose validity when the constructor goes out of scope.
|
|
|
|
|
Why the program is working? Can you demonstrate this?
|
|
|
|
|
I see nothing that indicates that it won't work (this from just a cursory glance), although I'm not sure what it is trying to do.
|
|
|
|
|
Sorry, I have to explain it more exact.
a oa( ((string)"aaa"+(string)"bbb").c_str());
above line passes the pointer on temporary object ( of type const char*) to the constructor. After the end of constructor this object (character seq"aaabbb") should lose validity as you wrote.
But next line oa.print() prints correct object. Is it only a luck, that the memory was not overwritten or temporary object still exists?
If you mean this is a luck, I would very appreciate the suggestion how to demonstrate this
|
|
|
|
|
Ilia Oussorov wrote:
Is it only a luck, that the memory was not overwritten
Correct.
Ok, upon examining your code more closely, my last responses were less than accurate. Sorry about that. Some of your code was lost because of HTML formatting so I wasn't sure if the missing code was intentional or not.
The only way to guarantee that the print() method works is to allocate memory to the name member variable and copy the contents of the name_ parameter to it.
|
|
|
|
|
I use RTX(real time extension)to Pragram. after connected the shared memery, I save a value in the parameter of the shared memery. but when the program runs, the informationg"RTX NT Starvation Timeout(5000 MS). All RTSS processes stopped Debug and/or use "RTSSkill"command to unload all process images.(Poc=809799C8,Thread=807A8930)" comes allways. what's the reason?
|
|
|
|
|
Hi friends,
I want to place the cursor in a Text Box when the dialog box displayed asking for user name and password, default there is no cursor, How to do this??
Thanks in advance
Regards,
Satya
|
|
|
|