|
Hi,
I have a picture control on a dilaog box which is contained in a property sheet. Now whenever I increase the resolution of the PC, size of the controls on my application will be same, and it will show some space to the right of the application controls when it is displayed. I can change the position of the controls but how to increase the width & height of a bitmap in mfc.
Controls size will remain same irrespective of the resolution of the monitor, rather it will show an empty space at the bottom & right of the controls ( in case ur monitor size is large and you increase the resolution).
Any help will be appreciated.
Regards,
Mbatra
|
|
|
|
|
How you draw the bitmap into picture control ?
|
|
|
|
|
Hi,
The 'Type' property of Picture Control has been set as Frame.
The Bitmap position is just fixed on the window.
Regards,
Mbatra
|
|
|
|
|
You can use the CopyImage() function to scale a bitmap. With a CStatic picture control it can be used this way:
void CMyStatic::ScaleImage(const CSize& sz)
{
HBITMAP hBitmap = GetBitmap();
if (hBitmap)
{
HBITMAP hCopy = (HBITMAP)CopyImage(hBitmap, IMAGE_BITMAP, sz.cx, sz.cy, 0);
if (hCopy)
{
SetBitmap(hCopy);
::DeleteObject(hBitmap);
}
}
}
Another option is to use owner drawing calling StretchDIBits() to scale the image.
But resizing a bitmap may result in bad looking images.
|
|
|
|
|
I've dug up SteveKing's old article SpellEdit:
SpellEdit[^]
Originally it was made for Visual Studio 7.1 (2003) but I managed to fiddle with it to get it compiling/working under Visual Studio 6.0 (because that's what I have).
Everything is working however the project is non-UNICODE. So I converted the project into UNICODE and now I get lots of build errors, such as:
error C2664: 'spell' : cannot convert parameter 1 from 'class CString' to 'const char *'
The whole MySpell library/code uses char * everywhere... and even HunSpell uses char * everywhere too. So how come previously (in non-UNICODE) there was an implicit conversion between CString & const char *, but after changing project to UNICODE I get this error.
PS: This is not problem about converting CString to char * - even though I've tried this, it just doesn't work.
|
|
|
|
|
A quote from the MySpell link of the SpellEdit article:
Quote: MySpell has been replaced with hunspell starting with OpenOffice.org 2.0.2. Hunspell builds on MySpell but supports Unicode and adds several other useful features. So you can't use MySpell with Unicode builds because it supports only ANSI character sets.
Hunspell has Unicode support but uses UTF-8 strings while Windows uses UTF-16. So Windows strings must be converted to UTF-8 before passing them to the spell checker.
With UTF-8, strings are still passed as char* because a single character is encoded as sequences of bytes with variable length while UTF-16 charcters are represented by two bytes (wchar_t ). When using CString objects, they will be CStringA or CStringW according to the Unicode setting of your project. You may use CString s to convert between ANSI and Unicode:
LPCSTR lpszAnsi = "ANSI text";
LPWCSTR lpszWide = L"Unicode text";
CStringA strA = lpszWide; CStringW strW = lpszAnsi;
But for UTF-8 conversions, you must use WideCharToMultiByte() and MultiByteToWideChar() .
You may have a look at http://sourceforge.net/projects/hunspell/files/Misc/RichEdit/[^] which implements spell checking for a RichEdit control using Hunspell.
|
|
|
|
|
Hello Friends
I am creating a MfC Dialog based application using vs2010 in XP. I am adding some controls to dialog by using Template. Now,When I am opening that application in Win7, the default XP style with additional control is coming fine but it replacing Win7 Dialog standard controls like Search feature.
And If i Pass the last parameter to CFiledialog [bVistaStyle] to TRUE then only Win7 style dialog is appearing but not additional controls tht i added using template.
I want dialog should appear like Xp style with template and and with win7 standard controls too.
Any Ideas ?
Regards
Y
|
|
|
|
|
yogeshs wrote: Any Ideas ? Yes, but unlessyou show us the code that is not working it is unlikely that we can guess what is going wrong.
Use the best guess
|
|
|
|
|
 Here is the Class that i Sublasses from CFileDialog with setting last parameter in CFileDialog bVistaStyle to FALSE.
FileDialogTemplate::FileDialogTemplate(const LPCSTR caption, BOOL bOpenFile,
LPCSTR lpszDefExt, LPCSTR lpszFileName, DWORD dwFlags, LPCSTR lpszFilter,
CWnd* pParentWnd, int idx, BOOL pain, BOOL sav7, char* DefDir, int typ,
BOOL ivrit, int ver, int nVersion, BOOL multy, LPFNDLL_SWITCHREAD pSwitchRead)
: CFileDialog(bOpenFile, bOpenFile ? lpszDefExt : NULL,
alignFileName(lpszFileName),
(typ == sf_spec) ?
((dwFlags != 0) ? dwFlags : OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT) :
(typ == sf_bmp || typ == sf_fpf) ?
(OFN_PATHMUSTEXIST | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT |
OFN_NOCHANGEDIR | OFN_ENABLETEMPLATE | OFN_EXPLORER) :
(typ == sf_dsn_dir) ?
(OFN_HIDEREADONLY | OFN_NOVALIDATE | OFN_ENABLETEMPLATE | OFN_EXPLORER) :
(typ == sf_dsn || typ == sf_dsp || typ == sf_rul) ?
(OFN_PATHMUSTEXIST | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT |
OFN_ENABLETEMPLATE | OFN_EXPLORER) :
(typ == sf_log) ?
(OFN_PATHMUSTEXIST | OFN_HIDEREADONLY | OFN_EXPLORER) :
(OFN_PATHMUSTEXIST | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_EXPLORER),
lpszFilter, pParentWnd,0UL,FALSE)
{
m_pSwitchRead = pSwitchRead;
m_DefExt = (bOpenFile || lpszDefExt == NULL) ? "" : lpszDefExt;
m_Multy = multy && bOpenFile;
HMODULE hResourceOld = ::AfxGetResourceHandle();
::AfxSetResourceHandle(SHARED_RES_MODULE);
ivrit_eng = ivrit;
m_ver = (typ == sf_dsn_dir ||
typ == sf_dsn || typ == sf_dsp || typ == sf_rul) ? ver : 0;
rul_num = rul_size_num = 0;
bOpenFileDialog = bOpenFile;
sv7 = FALSE;
paint = (pain &&
(typ == sf_dsn_dir || typ == sf_dsn || typ == sf_dsp || typ == sf_bmp ||
typ == sf_rul || typ == sf_fpf || typ == sf_spec));
type = typ;
save7 = 0;
m_pImage = NULL;
m_Bitmap = NULL;
m_IsModulateFile = FALSE;
m_SizeSel = 0;
m_ofn.hInstance = SHARED_RES_MODULE;
title = new char[_MAX_PATH];
title[0] = '\0';
m_ofn.lpstrFileTitle = title;
m_ofn.nMaxFileTitle = _MAX_PATH;
int buf_size = 65536;
file_buf = new char[buf_size];
file_buf[0] = '\0';
file_buf[buf_size-1] = '\0';
if ( lpszFileName != NULL )
lstrcpyn(file_buf, lpszFileName, buf_size-1);
m_ofn.lpstrFile = file_buf;
m_ofn.nMaxFile = buf_size - 1;
if ( caption != NULL ) {
m_ofn.lpstrTitle = caption;
} else
m_ofn.lpstrTitle = title;
LPCSTR DefExt = lpszDefExt;
char un[8];
if ( idx != 0 && lpszFilter != NULL ) {
m_ofn.nFilterIndex = (DWORD)idx;
int ii = idx + idx - 1, in = 0;
const char* p = lpszFilter;
while ( ii > 0 ) {
if ( *p == '|' )
ii--;
p++;
}
p += 2;
while ( *p != '|' && in < 4 )
un[in++] = *p++;
un[in] = (char)0;
DefExt = un;
}
lstrcpyn(str, ::TGetIniString("ExtPath", DefExt), _MAX_PATH);
m_ofn.lpstrInitialDir = (DefDir == NULL) ? str : DefDir;
m_ofn.lpTemplateName = MAKEINTRESOURCE(
(ver == 0) ? IDD_OPENSAVE_TEMPLATE : IDD_OPENSAVE_TEMPLATE_NEW);
if ( !bOpenFile && typ != sf_dsn_dir )
m_ofn.Flags |= OFN_FILEMUSTEXIST;
NOVALIDATE_flag = ((m_ofn.Flags & OFN_NOVALIDATE) != 0);
if ( !NOVALIDATE_flag && typ != sf_dsn_dir )
m_ofn.Flags |= OFN_NOVALIDATE;
if ( m_Multy )
m_ofn.Flags |= OFN_ALLOWMULTISELECT;
m_view_mode = -1;
::AfxSetResourceHandle(hResourceOld);
}
Regards
Y
|
|
|
|
|
Sorry, but I cannot make head or tail of the above code. I would suggest you do some testing with basic CFileDialog templates to try and see what differences are happening.
Use the best guess
|
|
|
|
|
ok, I will try that way.
Thanks.
Regards
Y
|
|
|
|
|
I want to change my system IP, subnet mask, host name etc. using win32 VC++.
I've tried AddIPAddress function but that's not persistent.
I want to change it that it should be change without rebooting system and should be there after restarting the system.
Thanks!
|
|
|
|
|
|
Hi,
I am working on a project in which I have a Property Sheet and 3 Property Pages. I have some controls on Property pages. I want to make my project DPI independent, SO whenever I'll change the position of any control, the control at the bottom will get hidden. The control will be moved to the bottom but will get hidden. Say If I change the position of the control from rc.top to rc.top + 20, it will move down but will get slashed off from the bottom.
Is it possible that the size of the Property sheet is fixed.?
How to change the the size of Property Sheet or Property Pages in MFC.
Any help will be appreciated.
Regards,
Mbatra
|
|
|
|
|
mbatra31 wrote: Is it possible that the size of the Property sheet is fixed.? It assumes the size of the largest property page.
mbatra31 wrote: How to change the the size of Property Sheet or Property Pages in MFC. Change the size of any window using SetWindowPos() and MoveWindow() .
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
In scenario like this, I've putted pseudo function GetRTTI().
How can I detect in the runtime the actual(derived) class type?
class the_base
{
};
class A : public the_base
{
};
class B : public the_base
{
};
class C : public the_base
{
};
...
the_base* pList[] = { new A(), new B(), new C());
C* pTarget = nullptr;
if(pList[2]->GetRTTI("C"))//detecting the actual type
{
pTarget = dynamic_cast< C* >(pList[2]);//casting to the type
}
//using pTarget
...
|
|
|
|
|
The class type or the class name? Is typeid() of any help?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Class name would be good.
But indeed doesnt matter, I have to somehow detect the actual class for the further casting.
Thanks.
|
|
|
|
|
I think that at runtime, you will have to use the (slow) dynamic_cast or have the classes know their types via a ID of some sort.
Nihil obstat
|
|
|
|
|
This is my first code using DirestShow and could use some help with this linker issue.
The “problem “ is that the second usage of CoCreateInstance with CLSID parameter of CLSID_VideoMixingRenderer fails to link.
Here is “standard” linker error:
VMR_Capture.obj : error LNK2001: unresolved external symbol _CLSID_VideoMixingRenderer
Debug/OpenCamera.exe : fatal error LNK1120: 1 unresolved externals
I have included Microsoft SDKs\Windows\v7.1\Include\uuids.h and both of these CLSID are defined there.
Here is the failing code snippet
….
hr = CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER,
IID_IGraphBuilder, (void **)&m_pGB); // links fine
if(SUCCEEDED(hr))
{
hr = InitializeWindowlessVMR(hWnd);
…..
hr = CoCreateInstance(CLSID_VideoMixingRenderer, NULL,
CLSCTX_INPROC, IID_IBaseFilter, (void**)&pVmr);
// fails to link
I would appreciate any help/ suggestions on how to troubleshoot this.
Thanks for your time.
Vaclav
|
|
|
|
|
From the error message above it appears that this CLSID is not defined properly in the header. Check back and see what value it generates.
Use the best guess
|
|
|
|
|
Richard,
thanks for your advise.
I have replaced ( in uuids.h) failing CLSID with working one , same linker error.
Since I do not know squat about this I guess I need to find out what it should be to make this troubleshooting more effective.
// VMR GUIDS
// -------------------------------------------------------------------------
#pragma message ("CLSID_VideoMixingRenderer")
// {B87BEB7B-8D29-423f-AE4D-6582C10175AC}
OUR_GUID_ENTRY(CLSID_VideoMixingRenderer,
//0xB87BEB7B, 0x8D29, 0x423f, 0xAE, 0x4D, 0x65, 0x82, 0xC1, 0x01, 0x75, 0xAC)
0xe436ebb3, 0x524f, 0x11ce, 0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70)
Addendum
Just changed the CLSID to CLSID_VideoRendererDefault and getting same linker error.
|
|
|
|
|
I think you need to include the Strmiids.lib library as described on this MSDN page[^].
Use the best guess
|
|
|
|
|
The library is inluded. That is why I am lost since one of the CLSID works and the other does not.
Maybe I should look for #ifdefs in the uudis.h, but the compiler "reported" the #pragma message I stuck in front of the "bad" CLSID.
Go figure.
|
|
|
|
|
Vaclav_Sal wrote: one of the CLSID works and the other does not. Then the chances are that there is another missing library. Unfortunately I have no experience of this package and only found the answer by searching through the documentation. I am afraid you will have to do the same.
Use the best guess
|
|
|
|