|
For more Font Specification you can use the CreatePointFontIndirect() API.
This API uses pointer of the LOGFONT.
The secret of life is not enjoyment
but education through experience.
- Swami Vivekananda.
|
|
|
|
|
Hey i am sorry,
it's boldness is also disabled now.
but now the only problem i am facing is that whenever i paste
saomething in the control it's font remains same..
so i am thinking of something like this whenever user say's Paste.
i will change clipboeard data's font and boldness as i want.
Is this a good approach???
please Guide me as i am not very much familiar with this control
Thanks and Regards
Harshal
|
|
|
|
|
Create a eventhandler for RicheditCtrl on EN_CHANGE
Write Following statement in it.
GetDlgItem(IDC_RICHEDIT21)->SetFont(c);
This will give the desired output.
The secret of life is not enjoyment
but education through experience.
- Swami Vivekananda.
|
|
|
|
|
Thank You very much for your help.
it is working very fine.
Thank's.
|
|
|
|
|
But Apart from this i have another query
i am doing undo redo also.
it is working fine but in undo as well as redo there is one small problem
that whenever i undo/redo then after every undo/redo operation it selects some text and then on next undo/redo it undoes/redoes the character that was typed.
how i can fake the middle selection between two operations??
undo code is like this
if (m_rich.CanUndo())
{
m_rich.Undo();
}
Thanks and regards
Harshal
|
|
|
|
|
Hello everyone. i am trying to upload some Files to an FTP server using CFtpConnection::PutFile() function. Now, how can i detect the loss of FTP connection (if any) while uploading files?? Thanks...
vijay.
|
|
|
|
|
I have a Window which has many client windows. I would like to know the position of all the client windows with respect to the parent window co-ordinates. How do I do it?
I tried using GetWindowRect but it return the rect with respect to the Screen co-ordinates.
---
Hakuna-Matada
It means no worries for the rest of your days...
It's our problem free, Philosophy
|
|
|
|
|
First use GetWindowRect to get the coordinated in screen coordinates. Then you can use the ScreenToClient to convert then to coordinates relative to the client area of a window you specify.
Steve
|
|
|
|
|
|
yes, it's easy to show 16 bit color, but when we show 256 or true color icon in system tray, it can't be correctly showen, I have read this article: http://www.codeproject.com/shell/systray24code.asp[^], but sitll can't resolve my problems, you can use visual studio.net's default icon, like the IDR_MAINFRAME, it's a 24 color icon, but cann't correctly show this icon, it seems it's a 16 bit color icon.
Can anybody help me, thanks.
|
|
|
|
|
my os is win2000, perhaps 24 color can only be applied in winxp
|
|
|
|
|
|
I want to create a button when I will click that button some action should occur.But it should look like 3D coloured (for example on/off switch of Television)
I am able to put the bitmap on the command button.But the bit map doesnt fit properly.Because command button is rectangle look,but the bit map is oval shape.Any other way to represent
|
|
|
|
|
Did you see buttons on codeproject?
|
|
|
|
|
Hi all, I am trying to get the string supplied as a param in this function to be displayed as window title when executed but I am gettin compiler error.
here is the code which is causing compiler error
<br />
hwnd = CreateWindowEx( NULL,<br />
"AeroClass",<br />
"Aerobatics by Scody",<br />
WS_OVERLAPPEDWINDOW | WS_VISIBLE | WS_SYSMENU | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,<br />
100, 100,<br />
500, 500,<br />
NULL,<br />
NULL,<br />
hInstance,<br />
NULL);<br />
and the compiler error is
<br />
c:\visual studio 2005\projects\aerobatics\aerobatics\aerobatics.cpp(132) : error C2440: '=' : cannot convert from 'const char [10]' to 'LPCWSTR'<br />
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast<br />
c:\visual studio 2005\projects\aerobatics\aerobatics\aerobatics.cpp(149) : error C2664: 'CreateWindowExW' : cannot convert parameter 2 from 'const char [10]' to 'LPCWSTR'<br />
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast<br />
Can anyone please help me in gettin this string displayed on the window title when executed.
Thanks
Scody
|
|
|
|
|
Your project settings are set to use Unicode, but you're passing single-byte strings. Either switch to the multi-byte character set or use the _T macro on your literals.
|
|
|
|
|
Use
hwnd = CreateWindowEx( NULL,<br />
_T("AeroClass"),<br />
_T("Aerobatics by Scody"),...
|
|
|
|
|
I changed my project settings to use multi-byte character set and it worked!
Thanks very much!
Scody
|
|
|
|
|
I cobbled this code together by trial and error. I put it in a global procedure and use it to change the value of an edit control in a dialog. This is kind of neat because it's the first way I have found to control a dialog item from outside the dialog. However, the MSFT MFC Reference says about CWnd::GetDlgItem(), "The returned pointer may be temporary and should not be used for later use."
What's up? What makes a pointer temporary? Would I have to get CWnd* pt everytime I want to use it?
CWnd* pt;
pt = (CWnd*)AfxGetApp()->m_pMainWnd->GetDlgItem(IDC_EDIT2);
pt->SetWindowText("JJJJJJJ");
I also note this works without using (CWnd*) cast. Use or not use (CWnd*)?
CWnd* pt;
pt = AfxGetApp()->m_pMainWnd->GetDlgItem(IDC_EDIT2); <-----no (CWnd*)
pt->SetWindowText("JJJJJJJ");
|
|
|
|
|
GetDlgItem() returns a CWnd* so the (CWnd*) cast does nothing.
MFC keeps per-thread maps of some objects, for example that's how it associates a CWnd and an HWND . If an MFC function creates a temp object - one that's not kept in a map - then the temp object may be deleted at any time after your function returns. That's why the docs say don't store the pointer. If you need a longer-lived object, use CWnd::FromHandle() or an equivalent.
|
|
|
|
|
I'm trying to open a dialog box to the user and than take the filename they select and pass it too a DirectX api call which gets details about that file. I've been messing around with this for a few nights and I've got absolutely nowhere. I've read a lot about character encoding and although there are still a few blanks in my understanding I have a fairly good grasp of it. I'd imagine what I'm trying to do is simple enough and I'm running into pitfalls which are common place but no matter what I attempt to do I can't seem to get around these errors. Anyway here's my code, please take a look and if you could shed some light you'd really be doing me a huge favour.
I was given this in an earlier forum post, I really don't understand what it does, but it fixed an eariler problem I had so its in there for now.
#ifdef _UNICODE<br />
typedef wstring tstring;<br />
#else<br />
typedef string tstring;<br />
#endif
This is my function to display a file select dialog box and returns a tstring of the full path.
tstring openFile()<br />
{<br />
OPENFILENAME ofn;
TCHAR szFile[_MAX_PATH];
HANDLE test;<br />
<br />
ZeroMemory(&ofn, sizeof(ofn));<br />
ofn.lStructSize = sizeof(ofn);<br />
ofn.hwndOwner = mainLoop.hWnd;<br />
ofn.lpstrFile = szFile;<br />
ofn.lpstrFile[0] = '\0';<br />
ofn.nMaxFile = sizeof(szFile);<br />
ofn.lpstrFilter = _T("All\0*.*\0Text\0*.TXT\0");<br />
ofn.nFilterIndex = 1;<br />
ofn.lpstrFileTitle = NULL;<br />
ofn.nMaxFileTitle = 0;<br />
ofn.lpstrInitialDir = NULL;<br />
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;<br />
<br />
<br />
if (GetOpenFileName(&ofn)==TRUE) <br />
test = CreateFile(ofn.lpstrFile, GENERIC_READ,<br />
0, (LPSECURITY_ATTRIBUTES) NULL,<br />
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,<br />
(HANDLE) NULL);<br />
<br />
<br />
<br />
tstring temp (ofn.lpstrFile);<br />
<br />
return temp;<br />
<br />
}
When I call this the contents of Info remain null, so I'm guessing what's happening here is the encoding of fileName is incorrect for this function.
fileName = openFile();<br />
<br />
D3DXGetImageInfoFromFile(fileName.c_str(), &Info);
If I call it with the value hardcoded like so:
D3DXGetImageInfoFromFile(_T("F:\\Pictures\\ShannonTrip2006-PrintRun\\ShannonTrip2006 326.jpg"))
it works, it also works if I do the following:
fileName = _T("F:\\Pictures\\ShannonTrip2006-PrintRun\\ShannonTrip2006 326.jpg");<br />
<br />
D3DXGetImageInfoFromFile(fileName.c_str(), &Info);
The memory of fileName in this call looks exactly the same as the memory used when I'm getting the value from openFile() yet one works and the other doesn't. Not sure where I can look after this, any help is greatly appreciated.
|
|
|
|
|
You have problem with return value of fileName.c_str() ?
|
|
|
|
|
Yes when I try to pass fileName.c_str() into the api call when I've gotten its value from the windows file dialog it returns an error, when I attempt it after setting its value with a literal wrapped in _T it works. The memory of the two looks the exact same so I can't tell why one is failing and the other isn't.
|
|
|
|
|
I run your code and fileName.c_str() return file(full with path) but what error?
|
|
|
|
|
The api call returns 0x88760b59 which is D3DERR_INVALIDCALL, which means one of the parameters wasn't valid. The open file part isn't a problem that's getting the file and path out fine, its just when I pass what's being returned by that into a Unicode method I get a invalid call error.
|
|
|
|