|
Hi,
I have a rather large bitmap (1MB) that I need to use in my project. A gif would be much smaller and I was wondering if there was a way to use a gifs in the project resources.
If so, how? The image is beign used as a dialog background.
Thanks!
|
|
|
|
|
I am creating the control based on SysListView32. Can some tell me how can i draw the subitems in OnDrawItem event.
|
|
|
|
|
|
Thanks.... I have try this code it works fine... but When i tried to draw a rectangle around the subitem in POSTPAINT event it did not work.
Please see the code below
<br />
else if ( (CDDS_ITEMPOSTPAINT | CDDS_SUBITEM) == pLVCD->nmcd.dwDrawStage )<br />
{<br />
if ( 0 == pLVCD->iSubItem )<br />
{<br />
RECT rc;<br />
HPEN newPen, oldPen;<br />
newPen = CreatePen(PS_SOLID,1, RGB(0,0,0));<br />
oldPen = (HPEN)SelectObject(pLVCD->nmcd.hdc, newPen );<br />
Rectangle(pLVCD->nmcd.hdc, pLVCD->nmcd.rc.left, pLVCD->nmcd.rc.top, pLVCD->nmcd.rc.right, pLVCD->nmcd.rc.bottom);<br />
SelectObject(pLVCD->nmcd.hdc, oldPen );<br />
<br />
}<br />
else if ( 1 == pLVCD->iSubItem )<br />
{<br />
<br />
HPEN newPen, oldPen;<br />
newPen = CreatePen(PS_SOLID,1, RGB(0,0,0));<br />
oldPen = (HPEN)SelectObject(pLVCD->nmcd.hdc, newPen );<br />
Rectangle(pLVCD->nmcd.hdc, pLVCD->nmcd.rc.left, pLVCD->nmcd.rc.top, pLVCD->nmcd.rc.right, pLVCD->nmcd.rc.bottom);<br />
SelectObject(pLVCD->nmcd.hdc, oldPen );<br />
<br />
}<br />
<br />
<br />
*pResult = CDRF_SKIPDEFAULT;<br />
}<br />
Please tell me whats wrong with this code....
Secondly can i display combo on one of the column using the CustomDraw event.
|
|
|
|
|
Check the rectangle that you're drawing. From the docs for NMCUSTOMDRAW :- rc
- RECT structure that describes the bounding rectangle of the area being drawn. This member is initialized only by the CDDS_ITEMPREPAINT notification. Version 5.80. This member is also initialized by the CDDS_PREPAINT notification.
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
"Kosh reminded me of some of the prima-donna programmers I've worked with. Knew everything but when you asked them a question; never gave you a straight answer."
-- Michael P. Butler in the Lounge
|
|
|
|
|
I am doing it in hardest way by capturing the OnDrawItem event.
i am trying to dislay the Combos over the cell in this event, but problem is that when i resize the other column combos did not refreshed properly. What is the solution for this.
thanks
|
|
|
|
|
Hi,
I'm not an expert in GDI raster operations, so please excuse the lame question...
Well, I have ::DitherBlt() and ::TransparentBlt() at my disposal, as well a background COLORREF and/or a masked bitmap where all transparent bits are black (coming from a masked image list using ::ImageList_GetImageInfo()).
Can anyone point me in the right direction to combine both functions, so as to draw a disabled bitmap transparently?
Cheers.
--
Maxime Labelle
maxime.labelle@freesurf.fr
|
|
|
|
|
|
|
I've got a little app that I want to use a minimal amount of memory. I have one function that creates COM object (CComPtr), uses it, then returns, the memory used by the program (in Task Manager) jumps up about 1.5 MB, but never drops back down. It's not simply a leak, because calling the function many times doesn't cause the memory usage to grow.
Another question along these lines: I've seen some programs (like smss, lsass, cmd and EmEditor when minimized) that are able to use a relatively small amount of memory, but when I create a simple "hello world" program (without MFC or any other framework slop) with MSVC or Borland's compiler, it uses at least 2 MB. Anyone know what trick is being used in these?
Matt Gerrans
|
|
|
|
|
When you free memory or release COM objects, the memory manager doesn't immediately remove that used memory from your working set. It assumes that you will probably request memory again pretty soon, which is true for most apps. To trim unused memory from your working set, call SetProcessWorkingSetSize(GetCurrentProcess(), -1.-1) or use the /WS linker switch.
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
Laugh it up, fuzzball.
You cannot stop me with paramecium alone!
|
|
|
|
|
Arigato Gozaimashita Michael-san. That's a little gem my colleague will appreciate.
Do you know why a process drops a lot of memory when its windows are minimized by the way? Open task manager, and look at let's say devenv.exe. Minimize it and you'll see a huge drop in memory consumption. Do you have any idea what that's all about? I suppose it's just a "trick" as the VM size doesn't change a bit.
--
Arigato gozaimashita!
|
|
|
|
|
Iie, dou itashimashite!
I remember seeing on RaymondC's blog that when you minimize a window, its memory is immeidately marked for swapping, so it will be one of the first bits of memory swapped to disk if some other app needs more physical RAM.
OT: I think you asked a while ago about the spalling of "gozaimashita". There is a pronunciation rule that [i] and [u] become voiceless between voiceless sounds. So in "shita", [i] is between [sh] and [t] (both voiceless) so the [i] becomes voiceless as well, and the sound blends into the [sh] part. (Sorry if this is too technical, I don't really know how to explain it without using linguistic terms.)
When you write "gozaimashita" it is 6 characters (go-za-i-ma-shi-ta) and the romanization reflects that.
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
"Linux is good. It can do no wrong. It is open source so must be right. It has penguins. I want to eat your brain."
-- Paul Watson, Linux Zombie
|
|
|
|
|
Michael Dunn wrote:
When you write "gozaimashita" it is 6 characters (go-za-i-ma-shi-ta) and the romanization reflects that.
Ah, so basically, "shi" is a hiragana(?) character, and "shi" is its name? I guess the same applies to our alphabet. H's name is "age", but it's not pronounced that way when used as part of a word.
Michael Dunn wrote:
There is a pronunciation rule that [i] and [u] become voiceless between voiceless sounds.
Do you know the official explanation of why [u] isn't pronounced in words such as desu? I read on a webpage that only speakers of old dialects pronounce [u], and that it has apparently been optimized away with time. The web page I read it on didn't seem all that serious (rude japanese expressions was a large part of the repertoire).
--
Arigato gozaimashita!
|
|
|
|
|
Jörgen Sigvardsson wrote:
Do you know the official explanation of why [u] isn't pronounced in words such as desu?
Ah, actually I left out something in my earlier post. [i] and [u] also become voiceless after a voiceless sound when they are at the end of a word, such as in "desu" or the verb ending "masu".
This is a common phenomenon in languages, unstressed vowels can be "reduced" since they aren't the focal point of the word. For example in English, "several" is usually said as two syllables "sev-ral" with the middle "e" being dropped entirely. A similar thing happens with consonants in many languages, eg German and Russian. In German "tag", the [g] becomes devoiced to [k].
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
|
|
|
|
|
Excellent!
I wanted my little process to return from the ~4MB it jumped to after using the COM objects, to the ~2MB it started from -- this call popped it all the way down to ~500KB.
Thanks a million! ...or should I say thanks 3.5 million?
Matt Gerrans
|
|
|
|
|
Hi,
I have a componenet developed in C#.Net which will fire an event. The .Net component will send two parameters of type object (typecode : System.String )with that event.
I used the tlb file of that component for my VC++ client.
In the corresponding .tlh file generated by the VC++ compiler, the signature of the event handler is like
HRESULT HandlerforEvent (
const _variant_t & send,
const _variant_t & tkInfo );
I have done the following in my VC++ application.
1. I have created a class derived from IDispEventSimpleImpl
2. I used SINK_ENTRY_INFO with _ATL_FUNC_INFO as one of the parameter.
_ATL_FUNC_INFO OnEventInfo = {CC_STDCALL, VT_HRESULT, 2, {VT_BSTR,VT_BSTR}};
3. I have written a handler for the event.
4. Inthe CPP file,
I get the address using cocreateinstance and I used the DispEventAdvise for my object. Also I have written the implemention code for the event handler.
But still I am not able to capture the event from the component.
Can any one of you please tell me the solution for my problem... or is there any other way to capture the event from a .Net component in VC++.
Thanks
Kannan
|
|
|
|
|
I met a same problem before! I suggest that you created a singking class derived from IDispEventImpl.
you get the address using cocreateinstance and then call AtlGetObjectSourceInterface to get m_iid and m_libid, then use DispEventAdvise
to capture the event from the component!
andy_cn
|
|
|
|
|
HI,
I m new to ATL DLL
I want to make a Dll from which i want to get the functionality of CSocket class through ASP.NEt.
I run the ATL COM wizrad use ATL DLL , soporting MFC , proxt stub , MTS all ..
I added a MFC Class CSock Inherited from CSocket class.
When i compile it . it gives error .
CSocket undefined ???????????
How i can handle it.
and i want to use this DLL for ASP.NEt page to give the functionalty to a ASP.Net page connect to a client application through IP and Port.
m i doing a right solution. means ATL DLL , and use this DLL behind a ASP.NET page.
and tell me y CSocket is Undefined
thanx
Regards.
|
|
|
|
|
I have a ATL dialog class based on CAxDialogImpl. And I have added message handler for WM_CREATE for it:
BEGIN_MSG_MAP(CMyDialog)
...
MESSAGE_HANDLER(WM_CREATE, OnCreate)
MESSAGE_HANDLER(WM_DESTROY, OnDestroy)
CHAIN_MSG_MAP(CAxDialogImpl<cmydialog>)
DEFAULT_REFLECTION_HANDLER()
END_MSG_MAP()
And when instance of it is created through:
CMyDialog dlg;
dlg.Create(::GetDesktopWindow());
it does not receive the WM_CREATE notification.
Interestingly, it Does receive WM_DESTROY notification.
Am i missing something?
|
|
|
|
|
Dialogs don't receieve WM_CREATE . They do receive WM_INITDIALOG though - that's the message you want to trap. This applies for all dialogs, active x or not.
--
Arigato gozaimashita!
|
|
|
|
|
I need to take an opinion on whether our approach is right (described below):
Problem
We have a ATL windows service which also exposes one COM class - say MainServer. MainServer interacts with other internal COM objects and a VB ActiveX control. Client application can instantiate MainServer component and fire some methods on it. The VB ActiveX control needs a form container - so we are using ATL dialog (invisible, modeless) to host it. And fire methods on the dialog.
Output
Service when tested through control panel GUI, it works perfectly and we can fire methods on ActiveX control through its container in ServiceWinMain(), Run() and other methods.
But when tested with Client application which instantiates MainServer and fires methods, we have an unspecified exception.
My questions are:
1. Is it possible to host ATL dialog like I mentioned in a Windows service?
2. What is the best way to make this application thread safe?
3. Is this approach right?
|
|
|
|
|
Someone wrote:
2. What is the best way to make this application thread safe?
Is STAs possible when running as a service? If so, then COM solves it for you. If not, I'd use the locking mechanisms built into ATL to protect the COM objects against unsafe parallell access.
I suppose your COM component inherits from either CComObjectRoot or template <typename ThreadingModel> CComObjectRootEx . Make sure you inherit from CComObjectRootEx<CComMultiThreadModel> and use the Lock() and Unlock() methods appropriately. You can also use the type ObjectLock if you need to lock temporarily using the RAII idiom. ObjectLock lock(this); calls Lock() at construction time and Unlock() at destruction time.
Other than that I can't be of much more help as I don't have experience with COM servers in services.
--
Arigato gozaimashita!
|
|
|
|
|
Thanks Jörgen,
Solution did not require me to use Locks. But your answer did give a spark to think in a particular direction and finally I reached a solution.
Suchit.
(why doesn't my name appear besides by posting? I am logged in using my CodeProject ID).
|
|
|
|
|
You're welcome! May I ask how you solved it?
Someone wrote:
why doesn't my name appear besides by posting? I am logged in using my CodeProject ID
I believe it's because you are using HTML commands in your name. Your name shows up as <font face= in the email notification. Try changing your CP settings.
--
Arigato gozaimashita!
|
|
|
|