|
hi all,
i am having two interface. the first interface is name FirstInterface and i have one method in that named one(). Suppose i make another interface named SecondInterface then how can i use the FirstInterface Methods in this Interface. (ie) i have to use one() mehtod of the FirstInterface in SecondInteface.
please let me know if any solution other than Containment/Aggrigation.
thanks
uday.
uday kiran
|
|
|
|
|
It depends on how you've implemented your COM object. If you implement the interfaces using multiple inheritance such as ATL does it's just a matter of calling the method as you would any other member function. If you use the nested class approach, as MFC does, it's a little more complicated (but not much). Another approach would be to do a QueryInterface , call the method, then do a Release - but this is a bit heavy handed. More detail is needed to properly answer this question.
Steve
|
|
|
|
|
Alright, i've been looking for a while now.
I need a simple activeX control, witch i client get to download when he comes to a specific page at my site. That control can launch a application on the clients computer, on command of the webserver. and can send messages to the webserver. well... how to create this control. I've looked to some articles and searched for some information, but i must say... its very unclear, not that i dont understand it. i've got my experiance with com stuff. but most of those articles goes about those atl stuff that is running on the webserver. and not about ATL stuff running on the client. does anyone can push me in the right direction, anyone knows a good article about it? or can just anyone tell me what the right term is for what i'm looking for?
thanks already!
|
|
|
|
|
Hello friends,
I am vishal. I am developing messenger like GUI. I am not able to set the background color of WTL tab control. I don't know how can I do that!
Can u please help me.
To build this GUI I am refering WTLButtonST project on this same site.
cheers'
vishal jagtap
|
|
|
|
|
Hi all,
i want to access remote folders in a network. I am using NetUseAdd(...) Api, i am able to establish a connection to the Remote Machine what shall i do to access the Remote Folders.
thanks,
uday.
uday kiran
|
|
|
|
|
1) Share the folder on the nework machine
2) Then use the UNC path to the share as any other local path for read/write
If the share has only limited access, then Impersonate a user who has read/write access.
To impersonate:
1) use the username and password with read/write permission to call LogonUser()
2) Call ImpersonateLoggedOnUser() with the tocken u received from LogonUser() .
cheers...mil10
|
|
|
|
|
hi all,
how to access global functions and global variables in an Method of an Interface. i mean i have an interface, in an interface i have a method where i have to access a global member function. how can we achieve this.
thanks
uday.
uday kiran
|
|
|
|
|
Include the header file for the global function in the interface implimenatation class and call the global function. also for the global variable use the extern declaration and use it. there is no diffrence in com for calling a global function/variable. One thing is, be aware that the value of global variable will be shared across instances.
rgds...mil10
|
|
|
|
|
if i have used a globla function every thing is fine but it is getting linker error like:
LNK2001: unresolved external symbol "void __cdecl fun(void) when linking my atl component when using.
thanks
uday.
uday kiran
|
|
|
|
|
hi mil,
thanks for your good suggestion, i have got the solution.
thanks,
uday.
uday kiran
|
|
|
|
|
I am a beginner in ActiveX..I have created a very small application using MFC ActiveX ControlWizard..my control has a button and a text box..when I try to include this control into my client always my control gets displayed as an ellipse..i dont find my control(button and textbox)..
sorry if this is a basic question..pls dont mind as I am totally new to ActiveX controls etc..
|
|
|
|
|
MFC wizard appends elips drawing code in the OnDraw method of the control. Remove it and chk.
cheers....mil10.
|
|
|
|
|
hello,I wrote a property named get_Popvalue(long *nValue),
STDMETHODIMP CATC:get_Popvalue(long *nValue)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState())
// TODO: Add your implementation code here
*pVal = m_dSendBytes;
TRACE1("m_dSendBytes:%d\n",m_dSendBytes);
//m_dSendBytes is not changed here??
return S_OK;
}
and m_dSendBytes is a public variable the defined in the class CATC.
m_dSendBytes will be changed in another function CATC:NotifyData()
void CATC:NotifyData(long nSize)
{
m_dSendBytes += nSize;
//m_dSendBytes can be changed here
}
but m_dSendBytes can not get correctly by com invoked.
Can you tell me why? Thanks
|
|
|
|
|
*pVal = m_dSendBytes;
Here pVal is not declared in the code. The function parameter declaration is nValue and not pVal . The posted code shud not complie. if it is a typing mistake, then chk the IDL declaration for the property. Other than the variable name change issue, the code code you posted doesnt have any error.
cheers...mil10.
|
|
|
|
|
I am using the STL list container to hold objects of class a. Class a has various member variables of standard type(int, char, etc.). All variables are public. How would I go about accessing those variables in order to compare one object to another?
This is some of my actual code.
void ProcessFile(string filename, std::queue<cjob> &jobQueue)
{
char jobID = 'Z';
int numJobs;
int priority;
int arrivaltime;
int cpuburst[2];
int ioburst[2];
int i;
// ofstream constructor opens file
ifstream injobFile( filename.c_str(), ios::in );
ifstream injobFile1( filename.c_str(), ios::in );
// exit program if unable to create file
if ( !injobFile )
{ // overloaded ! operator
cerr << "File could not be opened" << endl;
exit( 1 );
} // end if
cout << "Reading file..." << endl;
/* //Count number of jobs by counting occurrences of \n
numJobs = static_cast<int>( std::count( std::istreambuf_iterator<char>(injobFile1),
std::istreambuf_iterator<char>(), '\n' ) );
*/
char crap = '(';
//input from file;
i = 0;
//Job * ptrarr_Jobs[10];
while ( i < numJobs)
{
injobFile >> crap >> jobID >> priority >> arrivaltime >> cpuburst[0] >> ioburst[0] >> cpuburst[1] >> ioburst[1] >> crap;
CJob tempJob(jobID, priority, arrivaltime, cpuburst[0], ioburst[0], cpuburst[1], ioburst[1] );
//tempJob = new CJob(jobID, priority, arrivaltime, cpuburst[0], ioburst[0], cpuburst[1], ioburst[1] );
jobQueue.push(tempJob);
cout << "(" << jobID << ' ' << priority << ' ' << arrivaltime
<< ' ' << cpuburst[0] << ' ' << ioburst[0]
<< ' ' << cpuburst[1] << ' ' << ioburst[1]
<< ")" << endl;
i++;
} // end while
return ; // ofstream destructor closes file
} // end ProcessFile()
Notice I referenced the queue; I am having trouble accessing the CJob objects' member variables when I am in the calling function...(main() in this case).
Thanks for any help.
|
|
|
|
|
Hi,
I'm trying to use the CAxWindow class to create a runtime control in a CDialog box. I have no problem creating the control but how can I call the methods of the control.
Thanks
|
|
|
|
|
|
Hi Michael,
The problem I'm having is my Active(ocx) control does not have any interface pointers. All I have is dispinterface for the ocx. Do you know how I call the methods of this control.
Thanks
|
|
|
|
|
You'll be calling it through IDispatch. Use IDispatch::GetIDsOfNames to map method names to IDs, then use those in IDispatch::Invoke. To discover what methods are avaialable, use IDispatch::GetTypeInfo.
Have a look at the source for CComDispatchDriver::Invoken in the ATL that comes with VC++ 6 for some guidance.
|
|
|
|
|
I am a beginner.My first program is show a picture on one static control which based on dialog!And I use WTL to do it,is there some example code ?
Or which book shoud I read!
Pre_thank you for give me a direct!My english is very poor,sorry!Just can read some comment!
I will online wait for you today!
heboy, the name is same as my real name!its meaning is "river "
|
|
|
|
|
I have a series on WTL starting here[^], however it probably won't be too helpful if you have no Windows or GUI programming experience already.
I always advise newbies to start at the API level, and not to move on to libraries until you have a very good understanding of how the APIs work.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
thank you !I think I know some about API !your help is very useful! And your
advice is good for me!
heboy
|
|
|
|
|
Hi all,
I am using ATL COM application, in which i am having a list control, i want that by clicking the particular column the elements of that column sorted out how can i do it ...Plz help me out
I write one callback function for sorting and i called that function in the OnColumnClickListname handler i share my code
LRESULT OnColumnclickList1(int idCtrl, LPNMHDR pnmh, BOOL& bHandled)
{
// My code started here
m_ctrllist.Attach(GetDlgItem(IDC_LIST1));
HD_NOTIFY *phdn = (HD_NOTIFY *) pnmh;
m_ctrllist.SortItems(SortFunc, phdn->iItem);
m_ctrllist.Detach();
//My code ends here
return 0;
}
static int CALLBACK SortFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
{
int nRetVal;
PITEMDATA pData1 = (PITEMDATA)lParam1;
PITEMDATA pData2 = (PITEMDATA)lParam2;
switch(lParamSort)
{
case 0:
nRetVal = strcmp(pData1->empcode,
pData2->empcode);
break;
case 1:
nRetVal = strcmp(pData1->empname,
pData2->empname);
break;
case 2:
nRetVal = strcmp(pData1->designation, pData2->designation);
break;
default:
break;
}
return nRetVal;
}
|
|
|
|
|
Use CSortListViewCtrlImpl, it does sorting for you.
|
|
|
|
|
Hi
I'm using ATL just for one function.
Base64Encode.
I don't make server or network i want juste Encode a string.
I try to make it with an example
from CodeProject:
CString sSource = "ToEncode";<br />
<br />
int nDestLen = Base64EncodeGetRequiredLength(sSource.GetLength());<br />
CString str64;<br />
Base64Encode((const BYTE*)(LPCSTR)sSource, sSource.GetLength(), <br />
str64.GetBuffer(nDestLen), &nDestLen);<br />
str64.ReleaseBuffer(nDestLen);<br />
cout<<(LPCSTR)str64;
It said me Cannot convert CString to LPCSTR one first argument of Base64Encode.
I'm working under VS2005.
It's the right way to do what i want?
Is there a better way, maybe something else than ATL?
How to correct this error?
Thanks for your answer.
Sorry for my poor english i'm not an english-speaking
|
|
|
|