|
CString szFilename="C:\\test\\bmptest.bmp";
HBITMAP hBmp = (HBITMAP)::LoadImage(NULL,szFilename, IMAGE_BITMAP, 0, 0,
LR_LOADFROMFILE|LR_CREATEDIBSECTION);
CBitmap pic;
pic.Attach(hBmp);
BITMAP pic_header;
pic.GetBitmap(&pic_header);
CWnd* wp = GetDlgItem(IDC_STATIC_BITMAP_GLASROHR);
CDC *pDC = wp->GetDC();
CDC imageDC;
imageDC.CreateCompatibleDC(pDC);
imageDC.SelectObject( &pic);
pDC->BitBlt(3, 3, pic_header.bmWidth, pic_header.bmHeight, &imageDC, 0,
0, SRCCOPY);
imageDC.DeleteDC();
wp->ReleaseDC(pDC);
|
|
|
|
|
Consider the following scenario:
The London underground administration would like to store the following information for each line that it serves: name of line, name of stations for each line and their sequence, the interchange stations.
1.Write a program that reads a list of underground stations and lines into a double circular linked list that is created using dynamic memory allocation.
The underground stations to be used in the assignment are given below. The information about the stations should be written in the Underground.txt file.
Line Stations
District South Kensington
Picadilly South Kensington
Picadilly Knightsbridge
Picadilly Hyde Park Corner
Picadilly Green Park
Picadilly Picadilly Circus
Bakerloo Picadilly Circus
Bakerloo Charing Cross
Bakerloo Embankment
District Embankment
District Victoria
District Sloane Square
Victoria Green Park
Victoria Victoria
The format of the text file can be considered similar to one shown in the above table.
2.Support the program with the additional feature to add a node. This can be used if the station is opened. The user should specify which station should be added.
3.Support the program with the additional feature to delete a node. This can be used if the station is closed. The user should specify which station should be deleted.
4.Allow the user to enter two underground stations: the station of your departure and the station of your arrival. Find the shortest path to get to from one station to another one in terms of the number of underground stations passed. Print the list of stations and name of the lines that you have to pass to get to the station of your destination. Give summary how many lines you have to use, where you have to change and how many stations you have to pass in each line.
------------------------------------------------------------------------------------
Can anybody give me any suggestions on how I could start this assignment. Will I need 2 classes, one for Lines and one for Stations??? Or do I store them both in one class and call it Underground e.g.
struct Underground
{
char nameofstation[MAX CHARS];
char nameofline[MAXCHARS];
Underground *nextstn;
}
Is this correct?????
What do i need to do next????? Can somebody please help.....
|
|
|
|
|
Seems like a bit of school homework to me. You really should figure this out on your own.
|
|
|
|
|
hi all,
I have a round dialog, i use the OnColorCTL to color the background of the dialog to yellow. i use OnPaint and dc.TextOut to display text on the round dialog. also i want to draw an ellipse as a mark for the round dialog border
here is the code i use in the OnPaint():
void CRoundDlg::OnPaint()
{
CPaintDC dc(this);
CRect rect,rectTmp;
GetWindowRect(rect);
ScreenToClient(rect);
rectTmp = CRect(rect.left + 17 * SPACE_MARGINGS,
rect.top + 23 * SPACE_MARGINGS,
rect.Width(),
rect.Height());
CBrush* pOldBrush = dc.SelectObject(&m_brush);
dc.SetBkColor(MESSAGE_BOX_DIALOG_BK_COLOR);
dc.SetTextColor(MESSAGE_BOX_TEXT_COLOR);
dc.TextOut(rectTmp.left,rectTmp.top,m_szText);
dc.PatBlt(0, 0,rect.Width(),rect.Height(), PATCOPY);
CPen* pOldPen= dc.SelectObject(&m_Pen);
rect.DeflateRect(4,4,4,4);
dc.Ellipse(rect);
dc.SelectObject(pOldBrush);
dc.SelectObject(pOldPen);
}
trouble is that i see the rectangle but i don't see the text.....
can any1 help here?
thanks in advanced
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Looks like you are painting over the text, dude!
Swap the order of the TextOut and the PatBlt and you should see it.
|
|
|
|
|
thanks that helped me...but only when i moved it after the ellipse drawing...
thanks again
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Try moving the dc.TextOut() after the PatBlt(), or even later still. FYI I use a rounded dialog in ED without any problems.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
thanks that helped me...but only when i moved it after the ellipse drawing...
thanks again
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Anyone here knows how to calculate pi in visual c++ 6 to the 100ths maybe less maybe more. I just want to know how maybe an example but I would appreciate a method.
<marquee>Universal Project... Soon to be a .net
|
|
|
|
|
|
Ted Ferenc wrote:
as the saying goes http://www.anvari.org/fun/Computer/Bart_Uses_Google.html
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
Pick your favorite algorithm and do it yourself!
There are enough ready algorithms written in C/C++, just do a google search.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
PI/4=1-1/3+1/5-1/7+1/9-1/11.....
|
|
|
|
|
hi all,
I know the STL class deque is a sort of a sorted vector.
i have a data class as follows:
class CMyData
{
public:
CString m_szStr1;
CString m_szStr2;
}
then i insert this data class to the deque as follows:
m_deque.push_back(pMyData);
what do i need to write to determine the sorting rule??? according to what the deque sorts its elemets???
thanks in advanced
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Actually, a std::deque is not like a sorted vector -- it's a vector that has constant time insertion/removal from both ends (instead of just the end). The name "deque" means "double-ended queue".
http://www.sgi.com/tech/stl/Deque.html[^]
If you want a sorted collection, use a std::set .
- Mike
|
|
|
|
|
hi,
thanks for the reply, i know understand what you mean....
i can't use set because i can allow duplicated items....what else can u suggest?
thanks again
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
|
thanks a lot man
that helped me!
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Is it possible to easily wrap a popup menu into multiple columns. I would like something like the Start menu on Windows XP, but haven't been able to determine if this is a non-standard menu that Microsoft has implemented. I don't see anything in the SDK documentation to select between scrolling or wrapping popup menus.
Thanks.
Neal Stublen
http://www.awesoftware.com
|
|
|
|
|
You may be able to get somewhere using Owner Draw menus, other than that I think you are on your own.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Now, maybe its because its Monday, or maybe I truely am a dumbass; But I've got a bit of a problem code involving string pointers.
Let me explain: I've got a function that constructs a string and returns:
LPCTSTR CSomeClass::GetSerialString()
{
std::ostringstream strstream;
strstream<< std::setfill((TCHAR)'0')<<\
std::setw(5)<<m_nSerial;
strstream<<std::flush;
ASSERT( (strstream.str()).length() == 5 );
return (strstream.str()).c_str(); }
}
Whenever this function is called using the following code:
string strSerial;
strSerial = GetSerialCodeString();
The strSerial variable points to an invalid string array, even though at the point of tracing, the GetSerialString function contains the correct string.
Can someone explain why the LPCTSTR return value gets destroyed?
I Dream of Absolute Zero
|
|
|
|
|
Can someone explain why the LPCTSTR return value gets destroyed?
Because the LPCSTR returned is a pointer to the internal string of strstream , and strstream (and its asocciated string ) is destroyed as soon as GetSerialCodeString exits. Use a smarter data type like string itself:
std::string CSomeClass::GetSerialString()
{
return strstream.str();
}
...
string strSerial;
strSerial=GetSerialCodeString(); This ought to work because string has an overloaded copy constructor that takes care of safely moving the internal resources between objects.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
cheers dude!
I Dream of Absolute Zero
|
|
|
|
|
In the windows right corner there is a set of icons which represents some application running on PC. How can I add a new icon to this set, how can I interact with this one?
Thanks
Telecommunication Engineer.
He works from more than 3 years as a software consultant over distributed systems developed in C++ or Java and based on a CORBA or DCOM tecnology. Knowledge of relationship and object DB
|
|
|
|
|