|
this works well but if I need to run program in fullscreen mode
it doesn't. Is there any trick to handle fullscreen?
(without taking it into windows and back)
viliam
|
|
|
|
|
I don't know how to make it work in fullscreen mode apart from by switching to windowed mode with ATL-ENTER, performing the operation then switching back.
Steve
|
|
|
|
|
I don't understand what you are trying to do. If you want to display text in a console application, why don't you use
cout<<"Text to be displayed";
Now, I don't understand what you mean by 'how to copy text from Windows aplication to MS-DOS'...
Could you be more specific ?
|
|
|
|
|
I have Win32 program with text data and I need to export
this text into dos applicatin
(I am not developer of this DOS program, I just want to save time
necessary to retype it from my program into DOS program)
Something like RE: above (with mouse)
but better programmely and in fullscreen mode as well.
viliam
|
|
|
|
|
Hi all,
I have an basic MDI application with a view class derived from CView. The view class has a string member(CString m_strTime) to get the system time in its constructor. I am displaying the sting in OnDraw. Now consider that I have opened three child windows.
I have a menu "Update" -> "Reset Time". I want to update all the child windows with the latest time. I am updating the latest time in Application class's member "strAppTime".
Pls look at the code:
CMyView::CMyView()<br />
{<br />
CTime t = CTime::GetCurrentTime();<br />
m_strTime = t.Format("%A, %B %d, %Y - %H:%M:%S") ;<br />
}<br />
<br />
<br />
CMyView::OnDraw(..)<br />
{<br />
CString strTime ;<br />
<br />
strTime = ((CMyApp*)AfxGetApp()) ->m_strAppTime ;<br />
<br />
if(strTime != "")<br />
pDC->TextOut(0, 0, strTime) ;<br />
else<br />
pDC->TextOut(0, 0, m_strTime) ;<br />
}<br />
<br />
<br />
void CMainFrame::ResetTime() <br />
{<br />
CMDIChildWnd *pChildWnd = MDIGetActive() ;<br />
if(!pChildWnd)<br />
return ;<br />
<br />
CTime t = CTime::GetCurrentTime();<br />
((CMyApp*)AfxGetApp()) ->m_strAppTime = <br />
t.Format("%A, %B %d, %Y - %H:%M:%S") ;<br />
<br />
pChildWnd->GetActiveDocument()->UpdateAllViews(NULL) ;<br />
<br />
}
It updates only the active child window. How to make possible for all the children. If I use MDIGetActive() and MDINext(), it changes the window order, as you know. It reflects clearly in Cascade arrangement.
Kindly suggest me a solution.
Thanks in advance,
Sarvan AL
|
|
|
|
|
You can create a Registered Message and send this message to all child windows using SendMessageToDescendants .
Make sure you send it to all immediate child windows only.
Have a message map entry in each child window for this message. Do updation there.
Nibu thomas
Software Developer
|
|
|
|
|
Hi Nibu,
Great. I never thought of this function.
Thanks a lot for your fruitful suggestion.
Sarvan AL
|
|
|
|
|
Hello,
I'm trying to add some text to a picture, drawing with the CxImage DLL.
The picture will be draw, but the text doesn't.
This is the code:
CPaintDC dc(this);
CRect rcDraw;
GetClientRect(&rcDraw);
CString text = "Test";
COLORREF color = 0x00FFAFFF;
// Draw Image
m_pImage->Draw(dc.GetSafeHdc(), rcDraw);
m_pImage->DrawString(textdc.GetSafeHdc(),0,0,text,m_pImage->RGBtoRGBQUAD(color),"Arial",1,400,0,0,true);
What's my fault???
Thank you for answers!!
Greatings
RiHaus
|
|
|
|
|
i m new to activeX controls.i had used datagrid in VC++. data grid contains more rows than visible ones. i send message to grid for updating a particular row.if this row is not visible in the grid then error : invalid row number is displayed.
so now can anybody tell me the way so that i can make that particular row visible.
i need immediate help on this. plzzzzzzzz help me
--------------------------------
jiteen tilekar
|
|
|
|
|
Your question is not very clear. Why are you sending a message to the grid control ? I think it offers some functions that allows you to show or hide rows (I'm not sure).
helpcode wrote: if this row is not visible in the grid then error : invalid row number is displayed.
What is the exact error ? I suppose this is a runtime error (something that happens when you execute your prog, not during compilation). Do you get a message box showing an error message ? Can you post the EXACT error message ?
I guess you try to access a row that is not in the control: the rows are zero-indexed, which means that the first rows is 0 and the last one is RowCount-1 (you probably try to access the row at RowCount)
|
|
|
|
|
the error messagebox is :
Invalid Row Number
this error is not at runtime or design time.but rather i think is it a limitation of DBGrid control?? here from combo if i select row number 20 and grid is displaying only 10 rows at present then this error displayed
But after scrolling manually rows if now grid is displaying rows from suppose 15 to 25 or a range in which row num 20 is there ,then it works fine.
now u can guess i have access to only those rows which r displayed in grid at that time....
jiteen
|
|
|
|
|
helpcode wrote: this error is not at runtime or design time
Yes, this is a runtime error: you get an error message when something happens during the execution of your program.
helpcode wrote: here from combo if i select row number 20 and grid is displaying only 10 rows at present then this error display
That is logical ! If there are only 10 rows in the grid and you try to access an inexistant row, you will get an error. That seems perfeclty logical to me. You cannot access something that doesn't exists. Or what ? How many rows do you have in your grid ?
Post the code of: 1) the creation of your grid and when you add rows to it and 2) the code which is giving you the error.
|
|
|
|
|
this event i have written on combo selection.
m_msdGrid : obj. of DBGrid control's CMsDGridCtrl class
i got error on this line: m_msdGrid.SetRow(i);
all the rows r present in the grid.
eg if u wanna to see this docu. u will scroll it. but at first only some aprt is visible.u need to scroll to see rest of it. same case is there.all the rows r there in the grid.but for seeing 20 th row u need to scroll down.
i need auto scrolling so that even if i selected any row from the combo control the grid should be scrolled to that row until that row becomes visible in the grid view.
void CProppage::OnIdSelected()
{
CString strGridID;
m_cmbReaderID.GetLBText(m_cmbReaderID.GetCurSel(), m_strReaderID);
if(m_strReaderID.IsEmpty())
return;
long lReader = atol(m_strReaderID);
m_msdGrid.SetCol(0);
for(int i = 0; i
|
|
|
|
|
hi,
I have derived a class ListCtrlEx from CListCtrl and exported that class in a dll. The ListCtrlEx containes some member variables of CRect and CString.
Now in a standard MFC dialog based application, I have created a class which is derived from ListCtrlEx. Then when compiling I am getting some warning saying..
"warning C4251: 'm_MinBtnRect' : class 'CRect' needs to have dll-interface to be used by clients of class ListCtrlEx"
What is problem.. How can fix this warning( i don't want to use #pragma disable )
Thanks in advance
nave
|
|
|
|
|
|
Hi,
I have one menu as PanelMenu in Doc/View and it contains some popup menus...I have to delete the main menu as well as pop up menu..
I used DeleteMenu command but it deletes only the PopUp menu.
I have to delete the main menu itself.
Wat can i do?
-- modified at 1:27 Thursday 27th April, 2006
|
|
|
|
|
Anu_Bala wrote: I have to delete the main menu as well as pop up menu..
Anu_Bala wrote: I have to delete the main menu itself.
What about SetMenu(NULL) ;
Nibu thomas
Software Developer
|
|
|
|
|
Hi all!!
Does there anyone know what's the difference between CDialog and CView?
I would appreciate your reply!!
|
|
|
|
|
See MSDN CView and CDialog
it's perfect.
|
|
|
|
|
Questions for you genius coders out there:
1) Are the iterators for maps produced random? I need to be able to call random_shuffle, and I want to make sure I can with this type of container.
2) Is there a way to insert to the front of a map, even if the key I want to insert isn't lexiographically the first key listed? (i.e. if I call begin, then I want to see it first)
3) Can I store dynamically created objects in a map?
Thanks very much in advance!
-- modified at 0:03 Thursday 27th April, 2006
|
|
|
|
|
1) They are bidirectional iterators, not random access.
2) No.
3) Yes - store a pointer to the object.
Calling random_shuffle makes no sense for a map .
Steve
|
|
|
|
|
1 - No, maps are hash tables. So, I believe that they generate a hash and use that to decide what bucket to put stuff into
2 - I don't believe so
3 - sure. If you do, it's the memory address that will be hashed, I would think, and I would think that would be as close as you'd get to a random insert order, although I still don't think you can shuffle it.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Ok then what's the best data structure for:
1) Being able do a random_shuffle () on,
2) Being able to search by key to get to a value.
I'm using vector right now, but I have a key-value pair combination that I need to update fairly often, so it seems like a map would be ideal for this..., but if this is the case, I need a way of randomly shuffling the map somehow, so when I do an interator and go from the beginning to the end, its random every time.
|
|
|
|
|
Can't you turn the keys into a list and then shuffle that ? How often do you need to shuffle them ? I'd think a list of the keys which you shuffle would be the way to go here.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
You can get the best of both worlds by combining the two: use a std::map for fast access to data but a std::vector of std::map::iterators into the std::map which you can shuffle. Here's an example using sets.
------------
// Console.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <string>
#include <set>
#include <vector>
#include <algorithm>
#include <iterator>
using namespace std;
typedef std::set<string> StringSet;
typedef StringSet::const_iterator StringSet_CI;
typedef std::vector<StringSet_CI> StringSetIterators;
typedef StringSetIterators::const_iterator StringSetIterators_CI;
int main(int argc, char* argv[])
{
const char* Names[] = {"Bob", "Sue", "James", "Ralph", "Steve", "Paul", "Kim", "Mary"};
const char** pEndNames = &Names[sizeof(Names)/sizeof(Names[0])];
// A map of strings.
StringSet strings;
// Fill the set with the names.
copy(Names, pEndNames, inserter(strings, strings.end()));
// Output the set to the console.
cout << "Names in set:" << endl;
copy(strings.begin(), strings.end(), ostream_iterator<string>(cout, "\n"));
cout << endl << endl;
// Vector of set iterators.
StringSetIterators ssi;
StringSet_CI e = strings.end();
for ( StringSet_CI i=strings.begin(); i!=e; ++i )
{
ssi.push_back(i);
}
for ( int times=1; times<=3; ++times )
{
// Shuffle the iterators.
random_shuffle(ssi.begin(), ssi.end());
// Output through the shuffled iterators.
cout << "Shuffled names:" << endl;
StringSetIterators_CI ee = ssi.end();
for ( StringSetIterators_CI ii=ssi.begin(); ii!=ee; ++ii )
{
cout << *(*ii) << endl;
}
cout << endl << endl;
}
return 0;
}
Steve
|
|
|
|