|
Maybe you have to "detach" your object (text, icon, bmp) from the button first?
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimmy Hendrix
|
|
|
|
|
How about creating two buttons, one with text and the other with a bitmap? Disable/enable them accordingly.
marcomars wrote:
I can instead change the button caption with SetWindowText: why is this?
Because that's the way it is supposed to work. Per MSDN:
The SetWindowText function changes the text of the specified window's title bar (if it has one). If the specified window is a control (e.g., button), the text of the control is changed.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I have an app which is set up as a property sheet with three pages. In OnInitDialog for the property sheet I am adding some buttons to the main property sheet in the area below the pages.
My problem is that I want to be able to control the tab order for these buttons. Right now they are inserted in the tab order between the tabs for the pages and the controls on the page. I'd prefer to have them inserted after the controls on the page.
I am adding the pages to the sheet prior to when it is displayed. Then when it is first displayed OnInitDialog is called and the buttons are added. My guess is that I need to add the buttons after the controls on the pages are created, but I'm not sure how to get control at that point.
Any hints?
Thanks,
Tom
|
|
|
|
|
The tab order is the Z-order of the controls. Use SetWindowPos to control the Z-order, and hence the tab order.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Ah, thank you. I didn't realize that could be done.
Now, why don't they document this? (No answer required!)
Tom
|
|
|
|
|
hello guys,
i'm new here;
i've problem in making serial communication between two pc
with rs232 with visual c++
the problem is how to send character/text (like chat program)to another pc
i've some source code from this site.
when i try it, the text/character didn't appear in other pc.
is there anyone that can help me?
please,
thankz for the help
|
|
|
|
|
Check
this[^] class its quite worthy
As for the rest you just have to read the file, send it on serial and then read it on the other PC then write it to disk.
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Hi,
I have an MDI application whose main frame will receive a message which should be sent to the correct view..With this message i will be having an Object ID(i.e. One of my child window has some object on which i have clicked..the ID of that object is sent to a second application which Sends a message back to the first application with ID).So is there any way i can identify the correct view with the help of this Object ID???????
Plz reply
Thanx in advance
Poorni
|
|
|
|
|
From the main frame, get the document to iterarate round all the current views (CDocument::GetFirstViewPosition & CDocument::GetNextView. Add a OwnsObject function to each view, and call it for each view. In that function, have the view check to see if it owns the supplied object ID.
|
|
|
|
|
Hi,
In the MainFrame when i try getting the document pointer its giving me error ..Can u explain me in detail how to do it???
Pls help me
Poorni
|
|
|
|
|
CMyDocument* = (CMyDocument*)GetActiveDocument ();
|
|
|
|
|
Hi
I am creating an ATL Composite Control which contains WebBrowser control.I have created this using CAxWindow::CreateControl and CAxWindow::QueryControl and got the IWebBrowser2 Interface.
How can i handle events for this Browser Control? I have to get all the PopUps coming from this window and have to route this to my own windows, not in the internet explorer.
Thanks
|
|
|
|
|
Hiya,
Check out the Knowledge Base Article (Q194179) over at MSDN
Also, check out Q246247 for more background information.
Hope this helps,
Andy
|
|
|
|
|
Andy,
Thanks for your help.Still i haven't completed it.But it is going fine..
|
|
|
|
|
Hi
Could someone tell me how I can debug STL types easily in VC++ 6? Everytime I use e.g. vector I can never see its content in the debug window.
Thanks!
|
|
|
|
|
Add this:
std::basic_string<*>=<c_str(), st>
std::vector<*>=size=<size(), i>, capacity=<capacity(), i>
std::map<*>=size=<_Mysize, i>
std::set<*>=size=<_Mysize, i>
std::list<*>=size=<size(), i>
std::deque<*>=size=<size(), i>
std::pair<*>=first=<first>, second=<second>
std::list<*>::iterator=val=<_Ptr->_Myval>
std::list<*>::const_iterator=val=<_Ptr->_Myval>
std::_Tree<*>::iterator=val=<_Ptr->_Myval>
std::_Tree<*>::const_iterator=val=<_Ptr->_Myval>
To VSDir\Common\MSDev98\Bin\Autoexp.dat
That will give you some more info on the stl types. To actually see the contents of a vector, say called m_vec, you can actually take the address of the first element to be equal to the address of an standard C array stored in the vector - say &m_vec[0]; This is because STL gaurentees that the vector occupies contigous memory.
If m_vec was a vector of ints (and your using STL port), you can do this:
((int*)&m_vec[0]), 100 to expand 100 elements in the vector in the watch window.
Unfortunatly, standard stl wont let u call [] operator in the watch window. You can do
((int*)&(*m_vec.begin())), 100
If you can remeber all that lol
|
|
|
|
|
There are methods of injecting code to a running application. But is there any method to remove such injected code without crashing the host application?
For example, the SmileyCentral program MWSOEMON.EXE injects a toolbar into MSN messenger. If we kill this process, MSN messenger crashes. Is there a way to remove the toolbar and terminate MWSOEMON.EXE?
|
|
|
|
|
Depends on what technique you used to inject the code; whether you know at what points during the host's execution the injected code will be called. Difficult to predict such behaviour though!
As far as I recollect, MWSOEMON is spyware.
For removing the toolbar from MSN Msgr, I'm sure there must be a better way. Havent yet tried it, but I'm sure there must be!
Bikram Singh
|
|
|
|
|
Hi.
I retrieve a value from the registry and it is a dword. I want to display it in a text box and I also want to store it in a interger? How can I do that?
Thank you very much in advance!
Well... I am a beginner ...
|
|
|
|
|
Maybe you can cast it?
int an_int = static_cast<int>(a_dword);
In VC++, you can display the value of an int like this:
CString str;
str.format("%d", an_int);
MessageBox(str);
This may not be the optimal solution though... my Microsoft-specific programming knowledge is seriously lacking.
|
|
|
|
|
CString str;
str.Format("%i", YOURDWORD);
yourtextbox.SetWindowText(str);
I thing you can just cast it:
int yourint;
yourint = (int)YOURDWORD;
or
yourint = static_cast<int>(YOURDWORD);
should be something like this.
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimmy Hendrix
|
|
|
|
|
Hi,
Could you help me?
How to find lenght of any string in MFC.
rajesh
|
|
|
|
|
Depends of the type of the container
CString str = "Hello";
str.GetLenght();
char *pcHello = "Hello";
strlen(pcHello);
Check also:
wcslen
_mbslen
_mbstrlen
....
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
CString str = "Any string ";
int len = str.GetLength();
len will return u zero based length
Also chk CString class in MSDN..
|
|
|
|
|
Another method would be.
CString a;
i=0;
do
{
if(a.GetAt(i)=='\0') return i;
i++;
}
The easiest way is CString.GetLength()
|
|
|
|