|
thanks for the answers guys!
|
|
|
|
|
How to register a window class exactly the same as the "View" window except the backcolor in a MDI/SDI application?
Thanks.
Maer
|
|
|
|
|
Handle OnEraseBackground to change the background colour if that's all you want to change. I don't believe you can change it by creating a Window class ( although I could be wrong ). Full instructions are in the FAQ.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
You *can* control the background color in a view by creating a Window class. See TN001 in MSDN Library.
Cheers
Steen.
"To claim that computer games influence children is rediculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
What means ATOM?
Thanks.
Maer
|
|
|
|
|
VC help -> Contents -> Platform SDK -> Base Services -> Interprocess Communications -> Atoms
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Hi, Sowinski!
Thanks for your reply.
It helps a lot.
Best regards,
Maer
|
|
|
|
|
Hi,
In one of my apps I have a class requiering an HBITMAP as input but my
images are all stored as icons.
Does anyone know of a nice way of converting between an icon and a bitmap?
I know the CImageList does this somehow but it is not a very neat solution.
Johannes
|
|
|
|
|
|
I am writing a class to create our own toolbar in Win32. For Dialog boxes I create a dialog template dynamically and then call CreateDialogIndirect. I want to create a toolbar with the WS_EX_TOOLWINDOW style set, so that the caption and system menu are the smaller size. Am I right in thinking that this means I need to create a *window* with this style, draw the background grey and then add my buttons ? This is a major pain as it means I can't inherit from my dialog class....
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
Dialogs can certainly have the WS_EX_TOOLWINDOW style. Are you trying this and it's just not working?
--Mike--
http://home.inreach.com/mdunn/
You are the weakest link, GOODBYE!
|
|
|
|
|
It doesn't work if I set the style to include this value, but using SetWindowLong works just dandy - I was about to post and say I'd got it working
I have another problem though - I am currently creating a lot of windows that all have their own 'button' on the status bar, but when I click on some of them they are not shown. I tried handling WM_SHOWWINDOW, to find it's not being called. Can you suggest what I might need to do to fix this ?
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
I was wondering how can I have a text area liked control in my dialog based application (win32). I try to use the resource editor but cannot find any text area liked control ?
thank you
|
|
|
|
|
How is what you want different from the edit box and rich edit control provided by the resource editor ?
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
Hi,
Am using an owner drawn list control, and I handle the WM_MEASUREITEM message to set the item height. Problem is, this message is sent only when a window is created (or so the MSDN documentation says). I'd like to set the item height, in response to user button clicks (to provide for the effect of zooming items)-this would let the user increase or decrease item heights by clicking buttons. Problem is, as noted earlier, the message is sent only when the list control is created-how do I set the item height, without destroying and creating the control again?
Any help is much appreciated.
--Shanker.
"When it's done" - 3D Realms.
|
|
|
|
|
The fact that there is no way to set an item's RECT and that ListViews only supports LVS_OWNERDRAWFIXED leads me to believe that you are, unfortunately, out of luck...
Unless, you only have one column in the ListView in question, then might I recommend moving to a ListBox instead... its WM_MEASUREITEM suffers the same problem ( only ever getting called once ), but you can set an items RECT at runtime ( like when the user clicks on it ).
void CMyZoomListBox::OnSelchange()
{
if ( -1 != m_nLastSelection ) {
SetItemHeight ( m_nLastSelection, m_nNormalSize );
}
m_nLastSelection = GetCurSel ();
SetItemHeight ( m_nLastSelection, m_nZoomSize );
Invalidate ();
}
Ben Burnett
---------
On the topic of code with no error handling -- It's not poor coding, it's "optimistic"
|
|
|
|
|
I asked this same question for SendMessage HERE once before. However, it appears as though the solution for SendMessage does not work for PostMessage.
I want to pass a CString as one of the parameters of PostMessage. How is this done?
|
|
|
|
|
I want to pass a CString as one of the parameters of PostMessage. How is this done?
Well, you can pass a pointer to a CString, however this will work only if the receiver of the message to is in the same process as the sender, otherwise the pointer will be meaningless. You also have to make sure that the CString object exists long enough for the receiver to use it. Since posted messages are handled asynchronously, you'll need to arrange this part yourself.
--Mike--
http://home.inreach.com/mdunn/
You are the weakest link, GOODBYE!
|
|
|
|
|
Assuming the target window is in the same process, you can send a CString via PostMessage like this:
void SendTextToWindow(HWND hwndTarget, UINT uiMessage, LPCSTR lpszText);
{
CString* pText = new CString;
(*pText) = lpszText;
::PostMessage(hwndTarget, uiMessage, (WPARAM)pText, 0);
}
Then, in the message handler for uiMessage,
LRESULT OnSomeMessage(WPARAM wParam, LPARAM lParam)
{
CString* pText = (CString*)wParam;
ASSERT(pText);
delete pText;
return 0;
}
I have used this, but I do not recommend it because there is a potential that the message could not make it to the target window and thus the CString never be destroyed. Also, this only works if the target window is in the same process. Ultimately, if you really need to do this often, I would recommend creating a manager class (something line CStringMessageManager), and have it be responspilble for deleting CString objects created and passed via PostMessage.
|
|
|
|
|
I went ahead and posted the code I use to deal with this situation. You can find it at
http://www.codeproject.com/useritems/sendcstring.asp
|
|
|
|
|
I wrote a program by dialog project , that works excellent.
Now I need to convert it to DLL.
---------------------------------------------------------
I opened project (MFCAppWizars(dll)).
I attached the recource dialog and all his class (CMainDlg).
I opened also exe project for test the dll and there I wrote:
HINSTANCE hInstance;
hInstance = LoadLaibrary("main.dll");
---------------------------------------------------------
My questions:
1. Where have I write CMainDlg::DoModal() if I want that it wiil shown immidietly when this dll will act ?
2. How can I get and return parameters ???
3. How can I acted this dll from the another exe program ???
------------------------------------------------------
PLEASE !!! HELP ME !!!
Thanks
|
|
|
|
|
Do not use LoadLibrary for this case.
In dialog class declaration (header file) put:
#ifdef DLL_BUILDING
#define DllExportImport __declspec(dllexport)
#else
#define DllExportImport __declspec(dllimport)
#endif
class DLLExportImport CMyDialog : public CDialog
...
In project settings of dll add DLL_BUILDING define
The same header, do include in exe project.
(As You can see, this time CMyDialog class will be defined as dllimport).
In link tab (project settings) of exe project, add path (relative or full) to .lib file generated during build of dll.
It will work
|
|
|
|
|
Although I dont just understood it.
Thank you!
|
|
|
|
|
Do not use LoadLibrary for this case.
Create DLL project. In this project, create header file. In this header write:
In dialog class declaration (header file) put:
#ifdef DLL_BUILDING
#define DllExportImport __declspec(dllexport)
#else
#define DllExportImport __declspec(dllimport)
#endif
class DLLExportImport CMyDialog : public CDialog
...
In project settings of dll add DLL_BUILDING define
That's all for now for dll project. Compile and forget.
Let's go back to exe project.Include the header, You have created in the dll.
The difference, is that when building dll, DLL_BUILDING macro will be defined, so DLLExplortImport will be changed by preprocessor into __declspec(dllexport). When building exe project, You won't have DLL_BUILDING defined, so __declspec(dllimport) will be used.
In link tab (project settings) of exe project, add path (relative or full) to .lib file generated during build of dll.
For more information, see msdn and search for dllexport or dllimport.
uki?
|
|
|
|
|
An so what's the point about COleDropTarget?
|
|
|
|