|
IDW_EA_BAR is user defined. and for AFX_IDW_TOOLBAR please Click here->[^] For MSDN answer.
AFX_IDW_TOOLBAR : The toolbar's child-window ID.If you do not want to use the default id than you may use user defined.
Yes U Can ...If U Can ,Dream it , U can do it ...ICAN
|
|
|
|
|
Priya_Sundar wrote: #define IDW_EA_BAR 0xE800
Priya_Sundar wrote: I could not determine what is this 0xE800
Actually IDW_EA_BAR == 0xE800 == AFX_IDW_TOOLBAR, same value.
Priya_Sundar wrote: However, I could not find any resource defined with that IDW_EA_BAR
It is the not resource Identifier, it is the child window Identifier, for example Dialog Child window such as a Button can have an ID. since the tool bar is created dynamically using CreateEx and as a child window of the Frame window, you need to specify the child window ID. If the window has unique ID you can get the handle of the window specifying the ID using [GetDlgItem^] or pass to any GetDlgItemxxx funtions. If you have Handle to the window the control ID can be retrieved using [GetDlgCtrlID^].
And Since it is a ToolBar and if it is the child of Frame window you can gain access to the control bar specifying the ID using [CFrameWnd::GetControlBar^].
Priya_Sundar wrote: Basically, I need to know what is the use of that parameter
It is the unique Identifier of the child window so that you can gain access to the window from its parent window.
Priya_Sundar wrote: I could not find any explaination regarding the AFX_IDW_TOOLBAR
It is the standard ID of the main toolbar of a frame specified by MFC, so that it handles default standard command handling, such as toggling the visibility of toolbar when user clicks the menu command with ID, ID_VIEW_TOOLBAR. If you are adding new toolbar or specify different ID other than AFX_IDW_TOOLBAR, then you need to handle the command handling. see [TN022: Standard Commands Implementation ^], [TN021: Command and Message Routing ^]
|
|
|
|
|
Hey thanks a lot.
Priya Sundar
|
|
|
|
|
Hi,
I tried to return an interface but it gave me this error:
Unable to cast COM object of type 'MyTestLib.MainTestClass' to interface type 'MyTestLib.IMainTest '. This operation failed because the QueryInterface call on the COM component for the interface with IID '{519A413A-2792-4021-847F-B7C205FFE057}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
Any idea why?
Here is my IDL:
import "oaidl.idl";
import "ocidl.idl";
[ object, uuid(EC23249E-2891-4f06-9D6E-77895E74448F) ] interface IAdd : IUnknown
{
HRESULT SetFirstNumber(long nX1);
HRESULT SetSecondNumber(long nX2);
HRESULT DoTheAddition([out,retval] long *pBuffer);
};
[ object, uuid(519A413A-2792-4021-847F-B7C205FFE057) ] interface IMainTest : IUnknown
{
HRESULT GetAddObject([out,retval] IAdd **ppObj);
};
[ uuid(AA484B10-6099-4e37-AEE3-8B4ADFBE2815) ] library MyTestLib
{
importlib("stdole32.tlb");
[ uuid(82B76786-E89B-4e42-8C50-B7916FEC1ADC) ]
coclass AddClass
{
[default] interface IAdd;
}
[ uuid(E76E5E58-F9D9-4570-AEC5-79A72E8E8743) ]
coclass MainTestClass
{
[default] interface IMainTest;
}
};
Thanks for any help
|
|
|
|
|
I found the problem. Apparently I am trying to be really smart about this by creating only 1 Factory and put a check in CreateInstance() to determine whether it is AddClass or MainTestClass.
I was wrong because the IID check should be in DllGetClassObject().
I have created 2 different factories for these classes and it works fine. I can now return the AddClass by using GetAddObject() function.
However, when I tried to use the function in AddClass (eg. SetFirstNumber()), it gave me this error:
The runtime has encountered a fatal error. The address of the error was at 0x7f628678, on thread 0x105c. The error code is 0xc0000005. This error may be a bug in the CLR or in the unsafe or non-verifiable portions of user code. Common sources of this bug include user marshaling errors for COM-interop or PInvoke, which may corrupt the stack.
Here is my code:
HRESULT __stdcall CMainTestClass::GetSamTest(IAdd **ppRetVal)
{
CAddClass *pAddClass = new CAddClass();
*ppRetVal = pAddClass;
return S_OK;
}
Thanks again for any help
|
|
|
|
|
how to get an integer value given by user in the editbox???
Raja
|
|
|
|
|
Like previous you can use of GetWindowText or GetDlgItemInt.
|
|
|
|
|
its given that,GetDlgItemInt(),function translates the text of a specified control in a dialog box into an integer value,but i need to get the integer value entered by user in the editcontrolbox and print the value,what should be done.
Raja
|
|
|
|
|
Why you cant use of this code:(do you like to hard work? atof, atoi, GetWindowText...)
int a;
a=GetDlgItemInt(IDC_EDIT1);
|
|
|
|
|
|
Hi,
CString strVal;<br />
EditBoxVar.GetWindowText(strVal);
Then use the following routines for conversion from string to int, float or long,
atof, atoi, atol .
Regards,
Paresh.
|
|
|
|
|
i get the following error,if atoi is used
error C2664: 'atoi' : cannot convert parameter 1 from 'CString' to 'const char *'
and the code is:
CString str;
editbox.GetWindowTextW(str);
atoi(str);
Raja
|
|
|
|
|
Use like this,
atoi((const char*)(str.GetBuffer()));
Regards,
Paresh.
|
|
|
|
|
But why we must be use of this code while we have a simple way to use with a line?
|
|
|
|
|
And I forogot a thing when you use of this function you must be use ReleaseBuffer(),so your code will be like this:
CString strVal;
EditBoxVar.GetWindowText(strVal);
atoi((const char*)(str.GetBuffer()));
strVal.ReleaseBuffer();
While you can use of
a=GetDlgItemInt(IDC_EDIT1);
But anyway I give you 4 vote for your time that you spend for read this reply and answered to Mohanraj D.
|
|
|
|
|
Hamid. wrote: atoi((const char*)(str.GetBuffer()));
for const TCHAR, you dont need CString::GetBuffer it supports LPCTSTR typecast.
and i don't prefer c-style cast of (const char*) because if it UNICODE build, (const char*) will still typecast wide char to char.
|
|
|
|
|
Paresh Chitte wrote: str.GetBuffer()
Never use GetBuffer without knowing exactly what it does. Please check the documentation of this function and you'll see that it is wrong.
Furthermore, the CString class has an LPTSTR operator so, calling GetBuffer is totally useless.
|
|
|
|
|
Sorry Mark and CPallini, No GetBuffer() here.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
OP provided code [^] is actually a old gold days' sample of exotic GetBuffer usage, a real gem for me and Mark. Thank you for highlighting.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Paresh Chitte wrote: atoi((const char*)(str.GetBuffer()));
Are you kidding?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Mohanraj D wrote: editbox.GetWindowTextW(str);
editbox.GetWindowText(str);
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
guys,
i get some porblem. i degine a graph region and i have drawn some grids with the following codes.
BOOL CUserInterfaceDlg::PlotGrid(void)
{
int i;
GraphRegion->SelectObject(Brush);
GraphRegion->SelectObject(PenGrid);
GraphRegion->FillRect(&GraphRect,&Brush);
for (i=1;i<(GraphRect.Width()/2);i++)
{
GraphRegion->MoveTo(i*((double)GraphRect.Width()/30),0);
GraphRegion->LineTo(i*((double)GraphRect.Width()/30),GraphRect.Height());
}
for (i = 1;i<(GraphRect.Height()/2);i++)
{
GraphRegion->MoveTo(0,GraphRect.Height()-i*((double)GraphRect.Height()/30));
GraphRegion->LineTo(GraphRect.Width(),GraphRect.Height()-i*((double)GraphRect.Height()/30));
}
return 0;
}
then i tried to draw another line on the grid by the following codes:
BOOL CUserInterfaceDlg::PlotRunWay(void)
{
UpdateData(TRUE);
GraphRegion->SelectObject(PenRunWay);
RXArray[0]=m_AirXPisition;
RYArray[0]=m_AirYPosition;
RPoints[0].x=RXArray[0];
RPoints[0].y=RYArray[0];
RPoints[1].x=RPoints[0].x+30000;
RPoints[1].y=RPoints[0].y+200;
GraphRegion->MoveTo(RPoints[0]);
GraphRegion->LineTo(RPoints[1]);
return 0;
}
but this is not working. it just drawing the grid lines. can anyone tell me why it happening.
thanking you all,
shohel
|
|
|
|
|
shohel899 wrote:
BOOL CUserInterfaceDlg::PlotRunWay(void)
{
UpdateData(TRUE);
GraphRegion->SelectObject(PenRunWay);
RXArray[0]=m_AirXPisition ;
RYArray[0]=m_AirYPosition;
....
....
Is that typo only here? Or in your programm too? (It looks like you copy-pasted the code snippet so check it in your app)
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
how i can compare between tow programs (symantc)?
if there is any code(reuseable) help me ..
please
|
|
|
|
|
Please give your messages an appropriate title. This is the second time you have used "please help me." Read the forum guidelines for further information.
|
|
|
|