|
what about at the top?
#include <iostream.h>
Teach Yourself C++ in 21 Days - Second Edition
is a good way to learn c++. It's free. look it up in google
|
|
|
|
|
|
Hi all!
I've been tring to put a bitmap background image on the main Dialog but nearest i can get is this:
CDC* pDC=GetDC();
CDC old; //New device context used as the source DC
//Creates a deice context compatible to pDC
old.CreateCompatibleDC(pDC);
CBitmap dlg_bmp;
CRect rect;
GetClientRect(&rect);
dlg_bmp.LoadBitmap(IDB_BITMAP3);
CBitmap* oldbmp= old.SelectObject(&dlg_bmp);
pDC->BitBlt(rect.left, rect.top, rect.Height(), rect.Width (),&old,0,0,SRCCOPY);
old.SelectObject(oldbmp);
dlg_bmp.DeleteObject(); //Deletes the bitmap
Invalidate();
when this runs the bitmap is loaded and it overrun the other controls hiding them
If some one help me i'd be very gratefull
AI_Warrior
|
|
|
|
|
You need to handle WM_ERASEBKGND and paint the bitmap in response to that message.
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
There is a saying in statistics that a million monkeys pounding on typewriters would eventually create a work of Shakespeare. Thanks to the Internet, we now know that this is not true.
|
|
|
|
|
try setting the background brush of the dialog box by usning the setclasslong method use GCL_HBRBACKGROUND as the index in the api.
|
|
|
|
|
Hi!
I have a problem with setting the character set in my ListBox (List). When I create a CFont object with a specific character set and I set that font in the Device Context recieved from the ListBox, then it is OK. I can write through that DC in the chosen charset. See Code :
CFont * font = new CFont;
CFont *oldFont;
CPaintDC dc( List );
font->CreateFont (28,0,0,0,700,0,0,0,
RUSSIAN_CHARSET, OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
DEFAULT_PITCH|FF_DONTCARE, "Arial");
oldFont = dc.SelectObject( font);
dc.ExtTextOut(10,170,0,NULL,"some text",
strlen("some text"),NULL);
!!!!!!!!! BUT !!!!!!!!!
If I set that font right in my ListBox and want to have the text added with code :
<br />
List->SetFont( font, TRUE); <br />
List->AddString( "some other text" ); <br />
in the chosen charset, then it DOES NOT work !
However the added text has the other parameters of the chosen font ( Height and so on) but the charset is the original (standard) one
Does anyone know how to force the ListBox to accept the charset from the font also ? Or it might be a bug in my Visual Studio ?
PLEASE HELP!
|
|
|
|
|
I have been trying to have an Edit Box take the Tab key as a simple move off the control - just tab around all the controls with Tabstop set.
Currently the Tab acts as an end to data input (i.e. like a Return or Enter key pressed). I did start to Derive the Edit Box control, but got stuck, see code below!
<br />
#include "stdafx.h"<br />
#include "MyEdit.h"<br />
<br />
<br />
<br />
IMPLEMENT_DYNAMIC(CMyEdit, CEdit)<br />
CMyEdit::CMyEdit()<br />
{<br />
}<br />
<br />
CMyEdit::~CMyEdit()<br />
{<br />
}<br />
<br />
BEGIN_MESSAGE_MAP(CMyEdit, CEdit)<br />
ON_WM_GETDLGCODE() <br />
END_MESSAGE_MAP()<br />
<br />
<br />
<br />
UINT CMyEdit::OnGetDlgCode()<br />
{<br />
return DLGC_WANTTAB;<br />
}
Currently the Edit Box (MyEdit) only processes the TAB key, I want it to process all keys but with the Tab key just move on to the next tabstop.
Help!
grahamfff
|
|
|
|
|
Lookin' for a l'il help here.
How do you launch a file from within a compiled C++ project?
I'd like my file to have a Switch where Case 1 is print this picture on the screen, Case 2 is leave program and launch a:\screensaver.exe
Is such a thing possible?
Thx
". . .gonna keep on tryin' - til I reach my highest ground"
|
|
|
|
|
This will activate the currently selected screensaver:
BOOL bScreenSaverEnabled = FALSE;
BOOL bStatus = ::SystemParametersInfo
(SPI_GETSCREENSAVEACTIVE, 0, &bScreenSaverEnabled, 0);
if (bStatus && bScreenSaverEnabled)
AfxGetMainWnd()->SendMessage (WM_SYSCOMMAND, SC_SCREENSAVE);
[edit]
Ooops, I just re-read your post. Use CreateProcess() to execute an app from within your app.
[/edit]
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
|
Thanks Mike - I think I'll punt and go with WinExec().
If these are the last lines of my code:
////////////////////////
return; // return from next to last function
}
if (QuizAvg>0.79)
{
WinExec (“a:\ballfusion.exe”, SW_SHOWNORMAL );
}
Cout<< “Sorry – your score was less than 80%.”;
Clearscreen();
}
Return 0; // end of Main()
}
Do my B+ students get the executable screen saver no matter what (in a desktop setting) and my C students get the "sorry message"?
Where would the program finalize and is there good form for ending such a program that "tosses off" to another application (destructors, clearing mrmory and the like)? Thanks!
|
|
|
|
|
You need an else block there, as it is now the "sorry" message will be printed all the time.
THe original program does not end after WinExec() , you need to do cleanup in the same way as when you don't call WinExec() .
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
I even hear the Windows "OMG I booted up fine" sound.
-- Paul Watson diagnosing hardware problems.
|
|
|
|
|
thanks Mike - I re-read your tutorial. Some would have you avoid WinExec, but I'm a beginner and need "EZ".
So--- I follow the need for Else, I'll reverse the order so "C" students are handled first, and close out open classes & pointers prior to the IF-ELSE. But if the screensaver returns to C++ code and finds itself at a "return 0;" at the end of Main(), why won't my program end itself?
Appreciate it!
". . .gonna keep on tryin' - til I reach my highest ground"
|
|
|
|
|
hi,
is there any way so i can print a report created in MSACCESS database through a VC++ code suppose that the report name is "report1" and it is in a database called "db1.mdb",waiting for help, thanks
|
|
|
|
|
i am working with a directsound program. i need IDirectNotify to place some notification when playing sound. but i found that i can't get it through the function-QueryInterface. it always fails. please help me. thanks
laia.
|
|
|
|
|
HRESULT SetStopNotification(HANDLE hMyEvent,
LPDIRECTSOUNDBUFFER8 lpDsbSecondary)
{
LPDIRECTSOUNDNOTIFY8 lpDsNotify;
DSBPOSITIONNOTIFY PositionNotify;
HRESULT hr;
if (SUCCEEDED(
hr = lpDsbSecondary->QueryInterface(IID_IDirectSoundNotify8,
(LPVOID*)&lpDsNotify)))
{
PositionNotify.dwOffset = DSBPN_OFFSETSTOP;
PositionNotify.hEventNotify = hMyEvent;
hr = lpDsNotify->SetNotificationPositions(1, &PositionNotify);
lpDsNotify->Release();
}
return hr;
}
Don't try it, just do it!
|
|
|
|
|
I just use these codes to get it, but the QueryInterface always failed. Then I try to get the interface to the CaptureBuffer, it is ok. Why these happened?
laia
|
|
|
|
|
I am programming with unicode.And I don't know how to send a character with the code > 0xFF.Anyone know it.
Thank you very much...
|
|
|
|
|
Hi,
I don't know what do you mean with "...how to send a character..." but if what you want is assign a UNICODE character to a variable, this is how
TCHAR c = 0x0100;
Now if you are talking about UNICODE strings, use BSTR or one of the classes that encapsulate it, CComBSTR or _bstr_t.
Fabian
|
|
|
|
|
Sorry for my ambiguous question.I want to send a message WM_CHAR with a code > 0xFF but when I use the following code :
wParam = 0x01ff
It send a character with code = 0xff.
|
|
|
|
|
Hi,
Could you be more specific?
If I do this
TCHAR t = 0x01FF;
SendMessage(WM_CHAR, (WPARAM)t, NULL);
when I process the message I get wParam == 0x000001FF
Fabian
|
|
|
|
|
Silly question, but do you have _UNICODE and UNICODE defined? If you don't, TCHAR will equate to char..... and:
TCHAR t = 0x01FF;
SendMessage(WM_CHAR, (WPARAM)t, NULL);
Will truncate t to 0xFF when stored in a char varible.
Try being explicte about what character set you are sending -
wchar_t t = 0x01FF;
SendMessage(WM_CHAR, (WPARAM)t, NULL);
|
|
|
|
|
Hi All,
I'm trying print a bitmap but the print preview works well, the bitmap appears nolmaly but when I print, the bitmap don't appears. I'm using a MFC MDI project and the OnBeginPrinting and OnPrint.
All other elements in the printed sheet appears normaly.
Thanks in advance
Sergio Batarce
|
|
|
|
|
|
Soon after I had put this question, I find your article. It is helping me too mutch. Thank you very much
|
|
|
|