|
wrote: hi,
i want to know how to read and write from text from an Edit-box in an dialog box.
dude you will in trouble for posting same message in different forum..
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and you
|
|
|
|
|
See SetWindowText/GetWindowText
|
|
|
|
|
Ok,
I'm trying to figure this whole WTL thing out and it's going rough. So far I've done ok on my own scavenging code and figuring it out, but I've hit a little snag.
On my main form I have a set of 3 radio buttons. Although I'm at a loss as to how the program reads these buttons.
In my YarrView.h header I have
-------------YarrView.h--------------------
class CYarrView : public CDialogImpl<CYarrView>,
public CWinDataExchange<CYarrView>
{
public:
enum { IDD = IDD_YARR_FORM };
BOOL PreTranslateMessage(MSG* pMsg);
BEGIN_MSG_MAP(CYarrView)
END_MSG_MAP()
BEGIN_DDX_MAP(CYarrView)
DDX_RADIO(IDC_BILGE, puzzle)
END_DDX_MAP()
BOOL OnInitDialog ( HWND hwndFocus, LPARAM lParam );
int OnApply();
// For radio selection
int puzzle;
};
--------------------------------------
Now my three buttons are IDC_OPT1 IDC_OPT2 and IDC_OPT3
Looking at other peoples code, this is what they have done. And my int puzzle will hold which radio button was chosen? Now how exactly does int hold it? 0 for the first button, 1 for the second, etc? Thats what I assume and it does by what order they're listed in my resource script but a confirmation would be nice.
From my understanding I have this part right so far. The dialog IDC_YARR_FORM contains the buttons so the DDX code goes in that header file correct?
Now in my YarrView.cpp code
---------------YarrView.cpp---------------
#include "stdafx.h"
#include "resource.h"
#include "YarrView.h"
BOOL CYarrView::OnInitDialog ( HWND hwndFocus, LPARAM lParam )
{
DoDataExchange();
return TRUE;
}
int CYarrView::OnApply()
{
return DoDataExchange(true) ? PSNRET_NOERROR : PSNRET_INVALID;
}
BOOL CYarrView::PreTranslateMessage(MSG* pMsg)
{
return CWindow::IsDialogMessage(pMsg);
}
-----------------------------------
This is all the stuff needed to make sure the buttons get read correct?
From my understanding in my MainFrm.h the line
CYarrView m_view;
declared an instance of CYarrView as m_view;
so m_view.puzzle = the button I chose... Unfortunatly, I'm not getting any result from this whatsoever.
Is my code wrong and I just don't know how to read the m_view.puzzle variable properly? (Doubtful)
Could it be something in my resources?
My eyes are hurting from trying to figure this out for so long, no pounding away at others code is giving me anything
Please anyone, some advice here.
Also once this is figured out, I plan on having a running process going but with the ability to just hit cancel and stop it... I thought I could just create child dialog and put the code in the OnIdle(){ //code here}; section but it turns out that it just doesnt get executed no matter how much I Idle .
So any direction on doing something like that would also be much appreciated.
Hopefully theres enough information here for someone to help me. If not just tell me what you need.
Now my eyes need some
|
|
|
|
|
A group of radio buttons is defined by three things:
1. The first button of the group has the WS_GROUP style
2. The first control after the last button of the group has the WS_GROUP style
3. The buttons in the group are placed consecutively in the tab order. The tab order is how you know one button is first, then the next one is second, and so on.
You can see the logic in DDX_Radio() in atlddx.h. If the first button in the group is checked, it returns 0 in the nValue parameter. If the second button is checked, it returns 1, and so on. Or if no button is checked, it returns -1.
|
|
|
|
|
I am writing a program that will create multiple shapes. Currently I am building each shape as an ALT project. Like, rectangle, circle, even image. Then the application will just call each activeX when it need the shape. My question is. Will is slow down the application? Since each ATL had to be register and get the CLSID and create an instance for each object. Will I be better off doing from with the application? The ATL object is windowless by the way.
Thanks.
|
|
|
|
|
One ActiveX project for each shape will definitelly create a mess.
I'd do it this way: create a single component - ShapeFactory - that will create a shape you need. Create all your shapes as noncreatable interfaces within that single ActiveX project. Much easier and managable.
Best regards,
Dmitry.
-------------------------
Don't worry, be happy )
|
|
|
|
|
I'm a beginner in COM, but i have a problem, When i writed a Aggregation component by ATL, and i want to know how can i use the :component in vb?
thanks for any help! ^--^
|
|
|
|
|
sir,
i am facing one problem in create ATL server application .my client application are using IIstrument interface . i want to make one ATL server application which export IInstrument inteface . i have instrumentIfc.tlb,instrumentIfc.h,instrumentIfc.idl files which have definition for IIstrument interface. can i use these files in my ATL server application . but i dont know how. so i can able to export IInstrument interface for client purpose. plz give me suggestion.
|
|
|
|
|
I'm currently implementing an event sink with IDispEventSimpleImpl. I have the same problems than the ones described in KB288724 (http://support.microsoft.com/kb/288724/en-us), I'm receiving arguments in reverse order. What is confusing me is that this rather "old" knowledge base article applied only to Visual C++ 6.0.
By looking into atlcom.h from VC++ 2005, it seems that IDispEventSimpleImpl::InvokeFromFuncInfo is the one described in the workaround section of KB288724, but I'm not sure with IDispEventImpl::GetFuncInfoFromID as its design has changed.
Is it possible that this issue has not been solved with Visual C++ 2005 (2002 ? 2003 ?) ?
Is it possible that the problem comes from the server (which has not been built with VC++ 2005 ATL) ?
Has anyone observed such behavior ?
Thanks in advance.
|
|
|
|
|
i have a query that i have made a plugin(toolbar) that actually works in Outlook but the problem is that the Toolbar(plugin)also appear in the Microsoft Word and also in MS Excel i want that this toolbar plugin should only be seen and accessable in the Outlook so if anyone know the solution kindly help me in this matter
thanks in advance
|
|
|
|
|
you must write your registry information of plugin only in HK_LOCAKMACHINE\software\microsft\office\outlook\addin,
|
|
|
|
|
thanks for the information. i have done that as you told me but that doesnot work as at the beginning it doesnot show the plugin in MSOffice but when i open the outlook and then after that when i open the MS Office the plugin appeard in that application so can you told me how to handle this.
thanks in advance
|
|
|
|
|
Hi all
I'm a newbe with STL and templates.
I did my template class and I would like to create a function for writing it to output stream. I supposed that this last should be also a template function like the code below, but it doesn't work.
template<class T>
class CNeuron{
public:
CNeuron( const T obj ) {list_of_obj.push_back( obj );}
~CNeuron(){list_of_obj.pop_back();}
friend ostream& operator<<(ostream& os, CNeuron<T>& obj);
private:
vector<T> list_of_obj;
};
template <class T>
ostream& operator<<(ostream& os, CNeuron<T>& obj)
{ os << obj.list_of_obj[0] << endl;
return os; }
If I write a function specialized like the one below with string it works ,but NOT using other types(also simple like int):I've got linking error.
Why this happens?
Should I write a specialized function for each type?
ostream& operator<<(ostream& os, CNeuron<string>& obj)
{ os << obj.list_of_obj[0] << endl;
return os; }
void Main()
{
CNeuron<string> n("ciccio");
cout << n << endl;
CNeuron<int> n2(20);
cout << n2 << endl; //Linking Error
}
Regards
ManuStone
|
|
|
|
|
manustone wrote: friend ostream& operator<<(ostream& os, CNeuron<t>& obj);
You are missing its definition. Thats why getting linking error.
manustone wrote: last should be also a template function like the code below, but it doesn't work.
Do you get any compiler error, you should, with code given here.
|
|
|
|
|
Hi Passad
thanks for your response but if I try with
friend ostream& operator<<(ostream& os,CNeuron& obj);
as you suggested it doesn't work! But trying with
friend ostream& operator<<(ostream& os,class CNeuron& obj);
it tells me that CNeuron<T>::list_of_obj is not accessible because it is private.
If I make it publich everything is ok.
Do you know why it tells me that it is private even if it is friend? It seems that I'm using 2 different functions.
This is the code I used for the function. Since it is a class template I'm forced to use the T notation.
template <class T>
ostream& operator<<(ostream& os,CNeuron<T>& obj)
{
os << obj.list_of_obj[0] << endl;
os << obj.list_of_obj[1] << endl;
os << obj.list_of_obj[2] << endl;
os << obj.list_of_obj[3] << endl;
return os;
}
|
|
|
|
|
manustone wrote: template <class T>
ostream& operator<>(ostream& os,CNeuron<T>& obj)
{
os <> obj.list_of_obj[0] <> endl;
os <> obj.list_of_obj[1] <> endl;
os <> obj.list_of_obj[2] <> endl;
os <> obj.list_of_obj[3] <> endl;
return os;
}
This will not compile if T is string .
I can run your original code with these changes, But that will not solve your purpose.
template<class T>
class CNeuron{
public:
CNeuron( const T obj ) {list_of_obj.push_back( obj );}
~CNeuron()
{
list_of_obj.pop_back();
}
friend ostream& operator <<(ostream& os, CNeuron<T>& obj)
{
see for over loaded operator << for class T,
in your case T is string, not having operator <<.
return os;
};
private:
vector<T> list_of_obj;
};
void main()
{
Neuron<string> n("ciccio");
cout << n << endl;
CNeuron<int> n2(20);
cout << n2 << endl;
}
|
|
|
|
|
You are right!!!
Get rid of my first comment becasue it's true: I was using 2 different function.
If I put inside the class the same signature everything turns ok.
For my class I need to use this:
template <class T>
friend ostream& operator<<(ostream& os,CNeuron<T>& obj);
and the result is a wonderful super templatized function for streaming out!!!
Many thanks for your help!!!
regards
ManuStone
|
|
|
|
|
|
hi all
I'm newbe to STL and function templates.
I wrote this simple function and I expected to print a result to screen, but instead I've got an error. Why does this happen?
template<class T>
T Minimum(T a, T b)
{
cout << "Minimum by T" << endl;
return (a < b);
}
void main()
{
string a("StrA");
string b("StrB");
cout << Minimum( a,b ) << endl;
};
Regards
manuStone
|
|
|
|
|
The return type of Minimum() should be bool , no?
|
|
|
|
|
You should look at the error. Min/Max functions tend to return the min/max value evaluated while less/more return a boolean comparison of the two values.
template<class T><br />
bool Minimum(T a, T b)<br />
{<br />
cout << "Minimum by T" << endl;<br />
return (a < b);<br />
}
or
template<class T><br />
T Minimum(T a, T b)<br />
{<br />
cout << "Minimum by T" << endl;<br />
return (a < b) ? a : b ;<br />
}
m.bergman
-- For Bruce Schneier, quanta only have one state : afraid.
|
|
|
|
|
Many Thanks for your resposne
ManuStone
|
|
|
|
|
I have a custom tool bar which is inherited form WTL toolbar. In my tool bar I have a custom OnPrePaint paint function where I give custom texture for the background of the toolbar.
class CCustemToolBar : public CWindowImpl<ccustemtoolbar,ctoolbarctrl>,
public CCustomDraw<ccustemtoolbar>
It works fine. No problem.
Now I added Slider to bar. It shows perfect. Now if I resize me window the toolbar also updates and the Slider disappears. To sea the Slider I have to bring my mouse on the indicator (Just by guess) and it redraws it, but it does not draw the indicator sliding line. In other words after redrawing the toolbar the Slider does not update. I just run out the ideas what to do, even I tried not to paint that Slider window, which produces a black rang tangle. Any idea? You help will be very much appreciated.
Best regards,
Agha Khan
Agha Khan
|
|
|
|
|
I have a COM/ATL out-of-proc server whose main object is a singleton. I will call this Object A. Object A is called by other out-of-proc servers, but they are on the same machine so I am not worried about DCOM, etc. Object A uses a third party library (another set of COM objects) which generally works well but has a couple of known problems which can crash the Object A server (the problem can be reproduced). I have isolated this library into its own out-of-proc server to protect the Object A server. The library of the new server contains an object (I will call it Object B) which gets a reference to Object A. Object A releases its reference to Object B, but Object B maintains its own reference until its work is done. When the work by Object B is done, it notifies Object A, releases Object A and then releases itself. When all other servers are done and release Object A, then Object A is released and goes away normally.
If in the middle of its work, Object B crashes, it takes down its own server but the server which owns Object A is unharmed... except, that it still thinks there is another server out there which has a reference to it, so it won't shut down when all other out-of-proc servers have released their references.
Object A also maintains a watch on the Object B process so it knows if the Object B process has crashed.
Efforts to decrement the interface count on Object A when Object B crashes were not helpful and could have caused other problems (the reference count in Object A does not appear to be affected by Object B... I am assuming an internal reference count and an external referece count... but if so, where is the external reference count stored and can it be decremented???).
Ultimately, I need to get Object A back to the state it had before it created Object B.
I am also posting this in the COM forum.
Thanks.
m.bergman
-- For Bruce Schneier, quanta only have one state : afraid.
|
|
|
|
|
Hi
I am getting Access violation whenever I Query for IWMSBufferAllocator in my custom plugin.
Here is code
<br />
IWMSBufferAllocator *pBufAllocator = NULL;<br />
<br />
if(m_spClassFactory)<br />
{<br />
hr = m_spClassFactory->QueryInterface(IID_IWMSBufferAllocator,(void**)&pBufAllocator);<br />
if(FAILED(hr))<br />
return hr;<br />
}<br />
Debug output gives these lines
Access violation reading location 0xfffffffffffffff.
The thread 'Win64 Thread' (0x338) has exited with code 0 (0x0).
First-chance exception at 0x78d67d0d in WMServer.exe: 0x80010105: The server threw an exception.
m_spClassFactory seems good. Its not a null or invlaid pointer. I have also tried with code like MSDN where
hr = m_spClassFactory->QueryInterface(IID_IWMSBufferAllocator,(void**)&pBufAllocator);
is used as
hr = m_spClassFactory->QueryInterface(&pBufAllocator);
Can someone help? There is no other doc available.
-----------------------------
In my dream, I was dorwning my §orrow§
But my §orrow§, they learned to §wim
|
|
|
|