|
Static call
1 Use BCB's command line tool implib to carry out the DLL generated by VC, and grow a lib file.
2 Add the exported file to the BCB project
3 Declaring functions in BCB
extern "C" __declspec (dllexport) DWORD __stdcall AR_WNetAddConnection2
(
LPNETRESOURCE lpNetResource, // connection details
LPCTSTR lpPassword, // password
LPCTSTR lpUsername, // user name
DWORD dwFlags // connection options
);
// ------------------------------------------------ ---------------------------
extern "C" __declspec (dllexport) DWORD __stdcall AR_WNetCancelConnection2
(
LPCTSTR lpName, // resource name
DWORD dwFlags, // connection type
BOOL fForce // unconditional disconnect option
);
// ------------------------------------------------ ---------------------------
4 BCB can start calling
Edit3-> Text = AR_WNetAddConnection2 (&nr, "u1", "u1", CONNECT_PROMPT);
Edit2-> Text = AR_WNetCancelConnection2 ("X:", CONNECT_UPDATE_PROFILE, false); |
|