Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to add another method ...

Status
Not open for further replies.

vivizimo

ISP
Mar 8, 2004
1
NL
I made a "Connect" button in Borland C++ and I added the following code to the button.

void __fastcall TForm1::Button1Click(TObject *Sender)
{
WideString server_name = Edit1->Text;
MULTI_QI qi[1];
memset(qi,0,sizeof(qi));
COSERVERINFO server_info;
memset(&server_info,0,sizeof(server_info));
server_info.pwszName = server_name;
CoInitialize(NULL);
qi[0].pIID = &IID_IsingleObject;
HRESULT hr = CoCreateInstanceEx(CLSID_singleObject,
NULL,
CLSCTX_SERVER,
&server_info,
1,
qi);
this->server = NULL;
this->server = (IsingleObject*)qi[0].pItf;
ShowMessage(hr);
}

My QUESTION is how to ADD a method to my client, which takes care of connecting to the server

The prototype of this method is as follows:
// mind the return value.
HRESULT connect(WideString server_name);

After implementing this method, I’ll use this for the “connect”-button instead of the source code I got now.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top