|
Hi
anybody can help me figuring out how to learn the scroll bars "arrow buttons" size? I need to use these and user paint ALL the stuff in between as well as handle all the mouse input. How can I get the exact size of these arrow?
Thanks
|
|
|
|
|
SystemParametersInfo() should give you that information. Probably the SPI_GETNONCLIENTMETRICS action.
CPUA 0x5041
Sonork 100.11743 Chicken Little
"So it can now be written in stone as a testament to humanities achievments "PJ did Pi at CP"." Colin Davies
Within you lies the power for good - Use it!
|
|
|
|
|
GetSystemMetrics()
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
I'm trying to show an Open File dialog but it won't show and i can't figure out what i'm doing wrong, here's the code:
{
OPENFILENAME ofn;
char szFileNames[(MAX_PATH+1)*1000+2];
const char szFilter[] = "MP3 Files (*.mp3)\0" "*.mp3\0";
szFileNames[0] = 0;
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.hwndOwner = ghWnd;
ofn.lpstrFilter = szFilter;
ofn.lpstrCustomFilter = (LPSTR)NULL;
ofn.nFilterIndex = 1;
ofn.lpstrFile = szFileNames;
ofn.nMaxFile = sizeof(szFileNames);
ofn.lpstrFileTitle = NULL;
ofn.lpstrTitle = (LPSTR)NULL;
ofn.Flags = OFN_ENABLESIZING | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_PATHMUSTEXIST | OFN_ALLOWMULTISELECT | OFN_EXPLORER;
ofn.nFileOffset = 0;
ofn.nFileExtension = 0;
ofn.lpstrDefExt = "mp3";
GetOpenFileName(&ofn);
Thanks in advance
-Rune Svendsen
|
|
|
|
|
The dialog shows O.K. for me. The only diference was I tested it with hwndOwner set to NULL. Is the owner window (ghWnd) valid and displayed window?
Sonork 100.15206;PavelK
|
|
|
|
|
I'm making a little program using VC++.net these days. But when I run my program(.EXE) on a computer without VC++.net installed, it asks for msvcr70.dll, so that I have to put this DLL together with that program. This troubles me a lot. The Property Sheet of my project has been checked carefully, what else could I do?
Thanks a lot for any hint.
Tiny Flying Elephant loves flying...
|
|
|
|
|
Well, they have to have .NET framework installed. It can be downloaded from Microsoft[^]
Philip Patrick
Web-site: www.stpworks.com
"Two beer or not two beer?" Shakesbeer
|
|
|
|
|
You can deploy your program using the Deployment Wizard in Visual Studio, then merge the VC++ Redistributable Merge Module with you setup files.
|
|
|
|
|
The Visual C++ merge module can be found in \Program Files\Common Files\Merge Modules
There you choose the vc_crt.msm file (200KB)...
|
|
|
|
|
:|I am still having trouble trying to print in landscape. Below is my latest code which does not print or change the page to landscape. Any suggestion would be appreciated. I think I feel like a mouse going around in circles.
The code seems to give me a new device context but it does not seem to print.
void CLogbookView::OnPrint(CDC* pDC, CPrintInfo* pInfo)
{
pDC = SetLandscape(pDC);
pDC->TextOut(100,100,"test");
}
CDC* CLogbookView::SetLandscape(CDC* pDC)
{
BOOL bStdSetUpDlg = TRUE;
CWnd *pWnd = this;
CPrintDialog pPrintDialog(bStdSetUpDlg,PD_USEDEVMODECOPIES ,pWnd);
pPrintDialog.GetDefaults();
LPDEVMODE pDEVMODE = pPrintDialog.GetDevMode();
pDEVMODE->dmOrientation = DMORIENT_LANDSCAPE;
pDC->m_hDC = pPrintDialog.CreatePrinterDC();
return pDC;
}
Desmond Mardle
|
|
|
|
|
Take a look at my article www.codeproject.com/printing/printerselect.asp
It covers switch landscape/portatit mode and a host of other features
If your still stuck, e-mail me direct.
Roger Allen
Sonork 100.10016
If I had a quote, it would be a very good one.
|
|
|
|
|
I have
_variant_t tempkeyValue = new _variant_t[20];
but when I go to do
delete[] tempkeyValue;
I get the error:
C:\Trainer\DB2\DbClass.cpp(204) : error C2440: 'delete' : cannot convert from 'class _variant_t' to ''.Ambiguous user-defined-conversion.
How can I get rid of the pointer fter I'm through with it?
Thanks,
ns
|
|
|
|
|
You need a pointer variable :
_variant_t *tempkeyValue = new _variant_t[20];
Sonork 100.15206;PavelK
|
|
|
|
|
Oops!So I did. The weird thing is. my code actually worked without declaring it a pointer, except for the delete.
Now I have:
_variant_t *tempkeyValue = new _variant_t[20];
*tempkeyValue = m_pRecordset->Fields->GetItem (key)->Value;
strcpy(keyValue,(char *) (_bstr_t)*tempkeyValue);
AfxMessageBox((char *) (_bstr_t)*tempkeyValue);
AfxMessageBox((char *) (_bstr_t)m_pRecordset->Fields->GetItem (key)->Value);
delete[] tempkeyValue;
which is fine, but I had:
_variant_t tempkeyValue = new _variant_t[20];
tempkeyValue = m_pRecordset->Fields->GetItem (key)->Value;
strcpy(keyValue,(char *) (_bstr_t)tempkeyValue);
AfxMessageBox((char *) (_bstr_t)tempkeyValue);
AfxMessageBox((char *) (_bstr_t)m_pRecordset->Fields->GetItem (key)->Value);
and it gave the right values in both messageboxes.
Is that to be expected or some weird coincidence?
Apprecite your reply tremendously. I was starting to thing _variant_t varaiables were a different beast as far as delete goes...
ns
|
|
|
|
|
This is a side-effect of conversions (1 argument) constructors and conversions operators...
A _variant_t can be converted to a VARIANT * implicitly by the defined conversion operator and this allows some misuse to go undetected...
Conversion operators are cool in general but very dangerous particulary when the returns pointers to internal data.
Philippe Mori
|
|
|
|
|
a how can I respond Enter Event in a editbox?
I have a editbox,and I want to make it do sth. like this: when the Enter key was press,other controls in the dialog can get the value in it,then the editbox clean up the value,nd wait the next input.
how can I make this ? Anyone can give me a clear answer?Thanks.
YES, I am here.
|
|
|
|
|
Here is one solution.
-create editbox
-add a button
-set button as default button
-when the user presses Enter, the button is press
-now you can do whatever you want including clear editbox
Kuphryn
|
|
|
|
|
I know this solution,but that's it,I don't want to add a button.I just want to respond the Enter Key.so...
YES, I am here.
|
|
|
|
|
You can derive your own edit control from CEdit and overide handling of keyboard messages. Then You can send a custom notification message to the parent window (dialog, form). See the edit control section here at CP for inspiration.
Sonork 100.15206;PavelK
|
|
|
|
|
Hello, the codegurus around the world.;)
This is one of the famous questions in MFC.
If you push Enter key, the dialog will be closed.
One solution is that you can trap Enter key message by PreTranslateMessage
before Enter Key message sends to the dialog.
And you can check if EditBox actually get the input focus in PreTranslateMessage.
Also, Paul Deliacia(?) posts his article in this question in MSDN magazine.
Please, don't send me your email about your questions directly.
Have a nice day!
Sonork - 100.10571:vcdeveloper
-Masaaki Onishi-
|
|
|
|
|
I always do stuff like that in my OnOK() function.
void CMyDialog::OnOK
{
if (GetFocus() == c_MyEditControl)
{
}
else
CDialog::OnOK();
}
CPUA 0x5041
Sonork 100.11743 Chicken Little
"So it can now be written in stone as a testament to humanities achievments "PJ did Pi at CP"." Colin Davies
Within you lies the power for good - Use it!
|
|
|
|
|
That's a neat tip!
|
|
|
|
|
Hi,
I have the problem that the below code
LOGFONT lf;
CFont font;
m_pWndOutput->ResetContent();
CFontDialog dlg;
if (dlg.DoModal()==IDOK)
{
dlg.GetCurrentFont(&lf);
if (font.CreateFontIndirect(&lf))
{
m_pWndOutput->SetFont(&font);
OutputAllItemsAgain();
}
}
which is a message handler of the Change Font button,
does not change the font itself in the ListBox (m_pWndOutput), it only changes the ListBox item height according to the font size specified in CFontDialog.
I tried this instead of a ListBox with a ListCtrl but experienced the same.
Could somebody please enlighten me?
Thanks
R.
|
|
|
|
|
Here is on solution.
// This should be in the class contructor.
-----
LOGFONT fontLog;
CDC dc;
memset(&fontLog, 0, sizeof(LOGFONT));
// set font size
fontLog.lfHeight = -MulDiv(11, GetDeviceCaps(dc, LOGPIXELSY), 72);
// set font type
strcpy(fontLog.lfFaceName, "Microsoft Sans Serif");
CFont *myFont;
myFont = new CFont();
myFont->CreateFontIndirect(&m_MsgLogFont);
-----
// This should be in the function you use to set the font.
-----
myFont->CreateFontIndirect(&m_MsgLogFont);
// Assuming this is a listview
GetEditCtrl().SetFont(myFont);
-----
Kuphryn
|
|
|
|
|
See the VC forum FAQ. The short answer is the CFont objec is a local variable and gets destroyed as soon as the function returns.
--Mike--
Just released - RightClick-Encrypt v1.3 - Adds fast & easy file encryption to Explorer
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|