|
|
The DC you are drawing text on isn't created. You have a CDC object but no HDC windows object.
You could pass the paint DC to DrawBackground() or in the function get a DC for the window:
CWindowDC* Background_dcPtr = new CWindowDC(this);
...
|
|
|
|
|
Thanks.
|
|
|
|
|
You're welcome
In your OnPaint() function you may want to be careful with the DCs.
You have a CPaintDC whos HDC is already created for the window and then you call
CreateCompatibleDC() on it...not good
Maybe something like this?
void CGameWin::DrawBackground(CDC &dc)
{
CRect ItWorksDimensions;
ItWorksDimensions.left = 0;
ItWorksDimensions.top = 0;
ItWorksDimensions.right = 50;
ItWorksDimensions.bottom = 20;
dc.DrawText("It Works!", ItWorksDimensions, DT_CENTER);
}
afx_msg void CGameWin::OnPaint()
{
CPaintDC Screen(this);
CRect WindowArea;
GetClientRect(&WindowArea);
OffSetX = WindowArea.right / 4;
OffSetY = WindowArea.bottom / 4;
DrawBackground(Screen);
Screen.BitBlt(OffSetX, OffSetY, OffSetX + 50, OffSetY + 20, Background, 0, 0, SRCCOPY);
}
|
|
|
|
|
Can someone tell me how can I make an application in Turbo C to have a title bar and also how can an application run like a service(start with Windows,and to don't have to open it every time you start windows) please?
I am using Turbo C++ 1.01
-- modified at 8:00 Sunday 14th January, 2007
|
|
|
|
|
Microsoft hides all that information and much much more in the
Windows® Platform SDK[^]
More than you ever wanted to know about services can be found here: Services[^]
Turbo C questions may be better answered on a Borland forum
If you have something a little more specific - what you've tried, what didn't work when you tried
it, etc. then you may get some better help here.
Mark
|
|
|
|
|
I have a vague recollection that you can't write Windows apps of any kind in Turbo C, assuming you didn't mean Turbo C++. If you meant the later, the question is if you have the early 90s version or the most recent version. If its the most recent version, use the wizards for a windows app and do some reading on writing services in MSDN for the latter--you can even get sample code from there.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Hi there
May i know how to allow horizontal scroll for picture and custom control?
Thanks
|
|
|
|
|
Do you want to scrolls for your image ?
|
|
|
|
|
I want to scroll for the graph(longer that what it can display in one window) that i draw.
May i know how to do this in picture or custom control so that the graph that i drew will be able to scroll properly. What other functions i need to look for? I'm using VC6, dialog app with MFC.
Thanks
|
|
|
|
|
I am creating several PDF reports in my application. Now according to one requirement i want to merge all PDFs in a single PDF. Eg. if there are x.pdf,y.pdf,z.pdf reports i will have to merge them in a file package.pdf so that all the three PDFs will be seen in a single PDF. Any idea?
Any free API available?
Help me please. Thanks in advance.
Jiteen
|
|
|
|
|
i want to read and play it.i want a sample to decode or play wma and wmv files.
sorry because i dont know where to ask it.
thank you.
|
|
|
|
|
wma and wmv files are Advanced Systems Format (ASF) files.
ASF files are covered in the Windows Media Format 11 SDK[^]
There's sample apps in the SDK as well.
If you choose to use DirectShow to play these files there's the DirectShow[^]
SDK (which is now part of the Platform SDK).
If you want to use Windows Media Player there's the Windows Media Player 11 SDK[^]
|
|
|
|
|
I hope a message is sent to parent window when user right clicks a button on CToolBar - so I can display a pop up menu associated with the button.
can a button on CToolBar send message with mouse right-clicking?
if not, any idea to modify CToolBar?
thx
-- modified at 12:48 Saturday 9th December, 2006
|
|
|
|
|
A toolbar sends a NM_RCLICK notification through a WM_NOTIFY message when the user right-clicks
on the toolbar. To get the message in your parent window, add a OnNotify() override to the
parent's class, something like:
BOOL CMyWnd::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
if (wParam == ID_MYTOOLBAR)
{
NMMOUSE *pNMMouse = (NMMOUSE *)lParam;
if (pNMMouse->hdr.code == NM_RCLICK)
{
return TRUE;
}
}
return CWnd::OnNotify(wParam, lParam, pResult);
}
|
|
|
|
|
Now that I've had some caffeine, I thought maybe an easier way would be to let MFC do some of the
work
ON_NOTIFY(NM_RCLICK, ID_MYTOOLBAR, OnToolbarRClick)
...
void CMyWnd::OnToolbarRClick(NMHDR *pNMHdr, LRESULT *pResult)
{
NMMOUSE *pNMMouse = (NMMOUSE *)pNMHdr;
*pResult = (LRESULT)TRUE;
}
|
|
|
|
|
the structure is of type
typedef struct _TBBUTTON {
int iBitmap;
int idCommand;
BYTE fsState;
BYTE fsStyle;
DWORD dwData;
int iString;
} TBBUTTON, NEAR* PTBBUTTON, FAR* LPTBBUTTON;
where int iString is type
Zero-based index of the button string.
how to read the value of iString, any idea or any help,
thanks
swarup
|
|
|
|
|
does this one work?
CToolBarCtrl::GetButton(int nIndex,LPTBBUTTON lpButton).
|
|
|
|
|
nah it wont help
my prob is
TBBUTTON tb;
i want to read the value of tb's iString value
can u help me to know how to read the value of TBBUTTON's int iString
|
|
|
|
|
How to change a specific color of an image ? either BMP or JPG
|
|
|
|
|
Is CImage::SetPixelRGB helpfuls?
|
|
|
|
|
Hi friends,
I am new bie need to know that How to use a unicode charset dll in any vc++ application.
Thanks in advance
|
|
|
|
|
change CharacterSet property in your C++ projekt settings (VS2005) to "use unicode charset".
If you are not using VS 2005. Add "_UNICODE" and "UNICODE" define to your preprocessor defines.
|
|
|
|
|
how can i draw border for a rounded rectangular dialog that doen'st have title bar. The border in the dialog properties is set to "None" as i m making the dialog to rounded rectangle.
Even the border has to be rounded rectangle.
|
|
|
|
|
please stop asking the same question again and again. Each time you have asked you were given various methods to do what you want by different people. Go read your last posts, you can find them and other similar questions/answers by using the search feature of the forums.
|
|
|
|