|
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?
|
|
|
|
|
Why do you need to put it in a DLL?
|
|
|
|
|
Does "COleServerItem" have something to do with strctured storage?
Thanks.
Maer
|
|
|
|
|
Does "COleClientItem" have something to do with strctured storage?
Thanks.
Maer
|
|
|
|
|
Hi, all!!!
Does anyone know how can I catch CTRL+ALT+DEL before the system (win 2000)?
10x.
BTW: for some of you that wished for CodeProject irc server
I create a channle on DalNet called "#CodeProject "
|
|
|
|
|
To be honest I don't think it's possible on Win2k...
for some of you that wished for CodeProject irc server I create a channel on DalNet called "#CodeProject"
Yea, just sad it's always empty...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
yeah I know
but if people will come and stay instad of come and go.
then this place will NOT be empty.
BTW: for some of you that wished for CodeProject irc server
I create a channle on DalNet called "#CodeProject "
|
|
|
|
|
You probably have to replace som input DLL( _very_ dangerous ).
What if the user installs a servicepack?
|
|
|
|
|
I have service pake 3, and I don't really know what it means ?
BTW: for some of you that wished for CodeProject irc server
I create a channle on DalNet called "#CodeProject "
|
|
|
|
|
Look at Gina in msdn.
Maybe low level keyboard hook may help: SetWindowsHookEx ??
|
|
|
|
|
Hi,
I had problem of CTRL+ALT+DEL last few days. I searched discussion board for that but didnot found proper solution. I only found that use Gina Dll inplace of microsoft's MSGina.dll. That is not proper solution. Now i solved my purpose to disable CTRL+ALT+DEL in win2000. I don't know about WinNT but it will work for it also. So i want to contribute this part to all user.
Steps are as follows :
1. Open Microsoft SDK Examples. In That Example, Open GinaStub example.
2. Find function
int
WINAPI
WlxLoggedOnSAS(
PVOID pWlxContext,
DWORD dwSasType,
PVOID pReserved
)
3. In this function remove all code written and only return like this
return WLX_SAS_ACTION_NONE;
4. So it looks like this...
int WINAPI WlxLoggedOnSAS(
PVOID pWlxContext,
DWORD dwSasType,
PVOID pReserved
)
{
return WLX_SAS_ACTION_NONE; // Return code for doing nothing ... return to desktop
}
5. Now Make dll.
6. Goto Registry by regedit.
7. goto
\HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon
(WindowsNT is also there. So dont confused it is | Windows(Space)NT | okay)
8. Make New string value and give data like this
name : GinaDLL
Type : REG_SZ
Data : C:\WinNT\System32\mygina.dll (path of your gina dll(suppose mygina.dll))
9. Reboot computer And your control+alter+delete not worked at all.
----------------------------------------------------------------------------------------
If You want this mygina.dll then contact me on my personal email address.
manish_ld@rediffmail.com
m_codeproject@rediffmail.com
if still not contact me then and then try : pansiniya_manish@hotmail.com
----------------------------------------------------------------------------------------
Thanx in advance.
--------------------------------------------------
Say Whatever You Know.
Helping other people is good for health.
=========
Manish
=========
---------------------------------------------------
|
|
|
|
|
Hello,
My email address is changed.
Changed email address is : manish_ld@yahoo.com.
Please mail on this address for gina.dll.
Enjoy~!!!
|
|
|
|
|
Hello,
My email address is changed.
Changed email address is : manish_ld@yahoo.com.
Please mail on this address for gina.dll.
Enjoy~!!!
|
|
|
|
|
I have this in the .h file:
typedef enum { _P1=0, _P2=15, _P3=6, _PDefault=15} PDef;
MyFunc(PDef a){...};
and when I use it .cpp file like this:
MyFunc( (PDef)1785);
is there a way I can overwrite the '(PDef)' convertion?
e.g.
(PDef)1785- will return _PDefault ?
or somthing like that
thanks
BTW: for some of you that wished for CodeProject irc server
I create a channle on DalNet called "#CodeProject "
|
|
|
|