|
Ok, I tried doing it this way, and not even using my DLL for initing the header, and it fails. m_SearchList has a valid hwnd after being created, but the header does not (all zeros). If I put WS_VISIBLE in the create flags, it works fine, and gets a valid header...
m_SearchList.Create(WS_CHILD | WS_BORDER | LVS_REPORT, ctrl.cr, this, ctrl.nID);
CHeaderCtrl *hdr;
hdr = m_SearchList.GetHeaderCtrl();
BTW: This is a skinned based app, so the skin designer controls the visibility of the individual controls, although they still have to exist. That is the reason for creating them without visibility.
-- modified at 9:16 Tuesday 23rd January, 2007
|
|
|
|
|
Cpt Rick wrote: BTW: This is a skinned based app, so the skin designer controls the visibility of the individual controls, although they still have to exist. That is the reason for creating them without visibility.
I'm with ya there. Creating/initializing controls before displaying them is common.
I'm going to investigate this further. That kinda sucks if the list control doesn't create
it's header until it becomes visible (as you know )
I'll get back to you.
Mark
|
|
|
|
|
how do I monitor file/directory operations like Filemon (http://www.microsoft.com/technet/sysinternals/utilities/filemon.mspx) do?
Thanks in advance
|
|
|
|
|
It's a rather advanced topic. Maybe the authors of Filemon are you best friends, see here [^].
Cheers
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
how does one do this in gdi+, mfc
- load png image into memory
- access array of values, eg as int or rgb bytes
and apply any changes to image, if this step is needed
- rotate image
- crop image
- save as bmp
i currently used CxImage, but it seems buggy - totally weird things happen after i use ::Rotate
Thank You
|
|
|
|
|
Bitmap class constructors will load a png image (as well as Bitmap::FromFile())
Image::RotateFlip() will rotate and/or flip
To crop, extract the desired portion from the source image into a second image (see below).
There's a Graphics::DrawImage() overload that will do just that.
Bitmap::Save() will save as any of the supported types (see below).
This sample code should be enough to get you started...
Gdiplus::Bitmap SrcBitmap(L"C:\\test.png", FALSE);
Gdiplus::Bitmap DstBitmap(320, 240, SrcBitmap.GetPixelFormat());
Graphics DstGraphics(&DstBitmap);
DstGraphics.DrawImage(&SrcBitmap, 0, 0, 320, 240);
CLSID bmpClsid;
GetEncoderClsid(L"image/bmp", &bmpClsid);
DstBitmap.Save(L"C:\\test.bmp", &bmpClsid, NULL);
int GetEncoderClsid(const WCHAR* format, CLSID* pClsid)
{
UINT num = 0;
UINT size = 0;
ImageCodecInfo* pImageCodecInfo = NULL;
GetImageEncodersSize(&num, &size);
if(size == 0)
return -1;
pImageCodecInfo = (ImageCodecInfo*)(malloc(size));
if(pImageCodecInfo == NULL)
return -1;
GetImageEncoders(num, size, pImageCodecInfo);
for(UINT j = 0; j < num; ++j)
{
if( wcscmp(pImageCodecInfo[j].MimeType, format) == 0 )
{
*pClsid = pImageCodecInfo[j].Clsid;
free(pImageCodecInfo);
return j;
}
}
free(pImageCodecInfo);
return -1;
}
-- modified at 14:14 Sunday 21st January, 2007
edited for splelling
|
|
|
|
|
Forgot one...
You can use Bitmap::LockBits()/Bitmap::UnlockBits() to access the image bits.
Mark
|
|
|
|
|
You can use of GDI+ about this subjects but if you want to load and change some things on the image and save it you can use also of CImage class but for rotate GDI+ is better however its possible with CImage but GDI+ is easy.
|
|
|
|
|
a = b | c | ...
(1)
if (a & b)
{
....
}
(2)
if ((a & b) == b)
{
....
}
(1) and (2), use which is better? why?
thanks.
|
|
|
|
|
If the value 'b ' is a single bit, then the two approaches are equivalent.
If there are multiple bits set in 'b ', then they are not. (1) will be true if any of the bits in b are also set in a . (2) will be true if and only if the same bits that are set in b are also set in a .
Software Zen: delete this;
|
|
|
|
|
umm... Can you example some?
|
|
|
|
|
Example 1: Suppose a=0x1A (00011010 binary), and b=0x08 (00001000 ). In that case, <nobr>'if (a & b) ' and <nobr>'if ((a & b) == b) ' are both satisfied, since 'a & b ' evaluates to 0x08 .
Example 2: Suppose a=0x1A (00011010 binary) again, but this time b=0x09 (00001001 binary). In that case, <nobr>'if (a & b) ' is satisfied, yet <nobr>'if ((a & b) == b) ' is not.
Remember that the first if is satisfied by any non-zero value, while the second one requires that the result of the <nobr>'(a & b) ' expression equal the value of b .
Software Zen: delete this;
|
|
|
|
|
It depends.
If each of b,c,... corrensponds to just one bit set (e.g. <ode>b=1; c=2;...), then the expressions are equivalent (maybe (1) is faster).
On the other hand, if b,c,... holds composite bit values (e.g. <ode>b=3; c=5;...) then you have to carefully choose the expression you need, since (1) meets the requisite of an OR condition, while (2) corrensponds to an AND one). For instance, conside the following code snippet:
enum
{
FEMALE = 1,
YOUNG = 2,
...
};
if b=FEMALE; then both the (1) and (2) meet the condition, but if you are searching for a young female (b=YOUNG|FEMALE; ), the you have to be careful, because (1) holds true also when a represents a young guy or an old lady!
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
a = 1 | 0x10000000
a & 3 = 1 -> if (a & 3) { ...} error
a & 4 = 0
not understand about bit
a = b | c | d
how to define value of b,c, d
|
|
|
|
|
What I mean is that if you have b,c,d,e,f,... each corrensponding to only one bit set, for instance:
b=0x00000001;
c=0x00000002;
d=0x00000004;
e=0x00000008;
f=0x00000010;
then a condition using (a & b) evaluates to true (non-zero) only if a has the bit 0 set and the same holds for a condition using ((a & b) == b) . In the same way, a condition using (a & c) evaluates to non-zero only if a has the bit 1 set, the same holding for a condition using ((a & c)==c) , and so on...
On the other hand, suppose that x is a combination (sum using OR) of the above indipendent values, for instance x= b | e; , so that x=0x00000009 , i.e. x has both the bits 0 and 3 set.
In this case, a condition using (a & x) evaluates to non-zero either if a has:
<list> only bit 0 set only bit 3 set both bit 0 and 3while a condition using ((a & x) == x) holds true only if both bit 0 and 3 are set.
In other words, if x = 0x00000009; then
(a & x) holds true if a = 0x00000001; , or a = 0x00000008; , or a = 0x00000009;
while ((a & x) == x) holds true if a = 0x00000009 .
hope that helps
BTW both conditions are also true if a = 0x00000019 and so on...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Hi all.
I am a new comer to the MFC and VC++ fields.
There are some questions those sounds bit confusing to me, like....
1. What is MFC? Offcource I know that is a collection of classes, structures etc, etc predefined by Microsoft
2. What is VC++? a language or a platforma or something else?
3. VC++ 6.0 or 5.0 (or whatever) is the IDE. Is that right?
Sameer Thakur
|
|
|
|
|
Roughly speaking:
Sameer_Thakur wrote: What is MFC? Offcource I know that is a collection of classes, structures etc, etc predefined by Microsoft
MFC stands for Microsoft Foundation Classes and it is an Object Oriented Library (i.e. basically a collection of classes) that (hopefully) simplify your life as deveoper of Windows applications.
Sameer_Thakur wrote: 2. What is VC++? a language or a platforma or something else?
3. VC++ 6.0 or 5.0 (or whatever) is the IDE. Is that right?
AFAIK, Visual C++ is the IDE, featuring the C++ preprocessor, compiler, linker, resorce compiler and tools.
hope that helps.
BTW there is a lot of documentation about the above topics (see MSDN).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Just to expand a little on CPallini's post:
1. What is MFC?
MFC gives you several basic things for developing Windows applications.
One, it provides a framework for one common style of application: document/view. A 'document' is a data structure that represents the state of the application: the text in an editor, one or more rows from a data base, and so on. The 'view' is how the user interacts with the document. It displays the document and lets the user manipulate it. MFC includes a number of different document and view types that you can derive from.
Two, MFC wraps a number of Windows features in a somewhat object-oriented architecture. These features include windows (the message pump), thread primitives, built-in controls, the common controls, data bases, and so on.
Three, MFC gives you a group of utility classes, including strings (CString ) and collections (arrays, lists, maps).
2. What is VC++? a language or a platforma or something else?
VC++ is Visual C++, Microsoft's implementation of the C++ programming language. Visual C++ was once an independent product. Since Visual Studio .NET 2002, however, it has been part of the Visual Studio product, which includes Visual Basic, C#, etc.
3. VC++ 6.0 or 5.0 (or whatever) is the IDE. Is that right?
VC++ 6.0 was the last separate version of Visual C++ (see #2 above). The current version of the IDE now is Visual Studio 2005.
Software Zen: delete this;
|
|
|
|
|
I should add:
2 - Some people say VC++ when they mean C++ - C++ is a standard language. VC++ is the IDE. VC2002/2003/2005 all offer extensions to the language to access the .NET framework. They were called managed C++ and C++/CLI.
3 - not sure if you mean these are the two you have to choose from - both suck. Use VS2002 at the earliest, the implimentations before that were very broken.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
How to convert value to string in c?
|
|
|
|
|
Agbaria Ahmed wrote: How to convert value to string in c?
Using itoa[^]
|
|
|
|
|
Hi
I am calling one of my SQL server stored procedures using SQLExecute(). If there is a SQL syntax error, I can see it in the C++ code by checking the return code of SQLExecute() and calling SQLGetDiagRec(). If the stored procedure does not error, but outputs some warning message with a SQL PRINT statement, or RETURNs non-zero ... is there a simple way that the C++ code can detect this kind of soft failure ?
cheers,
Neil
|
|
|
|
|
Hi,
I use truedbgrid control to show the table in vc++, but i don't know how to use the function SetEvenRowStyle(LPDISPATCH) and SetOddRowStyle(LPDISPATCH), anyone can tell me how to pass the LPDISPATCH parameter? Thanks!
|
|
|
|
|
I want to create message function that user press "Ctrl+Double click".
Please give me some idea for do this.
|
|
|
|
|
Handle the WM_LBUTTONDBLCLK message and in the handler function use GetKeyState() to check if the control key is pressed.
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|