|
|
Thanks a lot
It is my solution
Best Regards
youssef
|
|
|
|
|
I declare this CArray in Header file
CArray<int, int=""> m_arrHashFileListBoxWidth;
When I compile, there are error message show
error C2143: syntax error : missing ';' before '<'
error C2501: 'CArray' : missing storage-class or type specifiers
error C2059: syntax error : '<'
error C2238: unexpected token(s) preceding ';'
Do you know how to solve this problem?
Thank you for your answer.
|
|
|
|
|
First, you really should use > and < in place of > and < when posting code, as it'll mess up otherwise (or just uncheck the "display as HTML" checkbox).
Second, you most likely need to #include the file afxtempl.h, as that is where CArray is defined.
Third, if at all possible use the STL classes (i.e. vector<> ) instead; they work better, are more portable, and will in general ensure you less headaches in the future.
Shog9
------
So they took me down to the gallows
And this boy, he said to me:
"Why do you smile, when the rope's around your neck?"
I said, "I tell you boy, when i get back..."
|
|
|
|
|
Thank you.
I will use this when I post code
>
Thank you
<
|
|
|
|
|
Hi
Try like this and it should work.
CArray < Your class name, Your class name > m_arrHashFileListBoxWidth;
e.g.
CArray < CMyClass,CMyClass > m_arrHashFileListBoxWidth;
This is because CArray is a template class and it expects the type of argument whenever it try to initialize.
Kindly tell me whether it works or not.
Thanks
|
|
|
|
|
Hello,
Does anyone know where I can find a visually small calendar control (perhaps similar to the "Palm Desktop" mini calendars) that I could use? I would like to tweak it slightly for a project. It need not respond to mouse-clicks.
thanks!
JennyP
|
|
|
|
|
MS calender control won't cut it...?
Anyways have you looked under (i think) Misc. controls here at CP I know theres a mini calender control there which is totally rockin'
Cheers!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Hello All,
In my project, I am using IStorage::CreateStream(). What I am doing is creating storage, and adding a file into the stream. For that I am using CreateStream, but the problem is, if the file name is large my program is crashing. I read MSDN, that CreateStream can't handle large filename (more than 31 characters.) Its giving me an error invalid pwcsName.Is there anyway to handle this problem???
Or is there any alternative which can solve this problem. Please, help.
Thanks,
|
|
|
|
|
The SDK reference for IStorage::CreateStream[^] is quite clear that pwcsName must not exceed 31 characters. Just use a short version of the file name (<= 31 chars long,) and put the real file name length as the first thing in your stream, and the actual name right after. When "walking" the streams in your storage, you can always read in the length and the actual file name from each stream.
Assuming your file name, strFileName, is an STL string , you can:
ULONG nLen = strFileName.length();
ULONG cbWritten = 0;
pIMyStream->Write(reinterpret_cast<void*>(&nLen), sizeof(ULONG), &cbWritten);
pIMyStream->Write(reinterpret_cast<void*>(strFileName.c_str()), nLen, &cbWritten);
And
ULONG nLen = 0;
ULONG cbRead = 0;
pIMyStream->Read(reinterpret_cast<void*>(&nLen), sizeof(ULONG), &cbRead);
char* pszBuf = new char[nLen + 1];
memset(pszBuf, 0, nLen + 1);
pIMyStream->Read(reinterpret_cast<void*>(pszBuf), nLen, &cbRead);
strFileName = pszBuf;
delete [] pszBuf;
Or something like that...
-- ian
http://www.ian-space.com/
|
|
|
|
|
I would like to know how one determines the state of all keys pressed when OnKeyDown is triggered in a MFC dialog. I need this to do a special key combination that only I will have access too while developing the application. Specifically "s" and "+" as well as "s" and "-"
Thanks,
Clint
|
|
|
|
|
Try looking at either one of these API functions:
GetAsyncKeyState
GetKeyboardState
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
You can do something like this in your OnKeyDown handler:
if( nChar == _T('S') || nChar == _T('s') )
{
if( GetKeyState( _T('+') ) & 0x10000000 )
{
}
else
if( GetKeyState( _T('-') ) & 0x10000000 )
{
}
}
Chris Richardson
|
|
|
|
|
Does anybody know, which image format is supported by ListCtrl ? I create CImageList from resource. I tried do put there 32-bit bitmap, 8 bit indexed bitmap, but there always was an problem with colors - some colors in image was changed. When i use standard colors in VC++ bitmap editor, it's ok, but i need to use non-standard colors. Any idea how to do that ?
Thanks.
rrrado
|
|
|
|
|
1) Make sure you're not editing the bitmap in Visual Studio; it won't work for 32bit images, and generally chokes badly on anything better than 4-bit color...
2) The normal MFC code to load a bitmap from resources doesn't work on high-color images. You can use either of the following techniques to get a bitmap from resources into your image list (we'll assume the resource ID is IDB_MY_IMAGES, and you want it split into 6 16x16 pixel images with no transparency):
CImageList MyImageList;
MyImageList.Attach(ImageList_LoadImage(AfxGetResourceHandle(), MAKEINTRESOURCE(IDB_MY_IMAGES), 16,0,
CLR_NONE, IMAGE_BITMAP, ILC_COLOR32));
or:
CImageList MyImageList;
MyImageList.Create(16,16,ILC_COLOR32,0,6);
CBitmap bmpTmp;
bmpTmp.Attach(::LoadImage(AfxGetResourceHandle(), MAKEINTRESOURCE(IDB_MY_IMAGES),
IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION));
MyImageList.Add(&bmpTmp, NULL);
Shog9
------
So they took me down to the gallows
And this boy, he said to me:
"Why do you smile, when the rope's around your neck?"
I said, "I tell you boy, when i get back..."
|
|
|
|
|
Thank you very much !
The first solution didn't work - it did exactly what standard
imageList.Create(IDB_MAILSTAT,16,1,RGB(255,255,255));
but second solution is working !
rrrado
|
|
|
|
|
is it fast, reliable? What are the cases it is must suitable for and what
are the cases it shouldn't be used?
Thanks a lot!
Wenrich
|
|
|
|
|
I am using pipes for comunicate threads in a security system And I never had problems with that...
Best Regards...
Carlos Antollini.
Pi Five[^]Creator
Sonork ID 100.10529 cantollini
|
|
|
|
|
It's a terrible, and extremely inefficient, way to communicate between threads. A semaphore based queue will be the most efficient general solution. If complex synchronization isn't needed, or we're talking just mainting state information, using CriticalSections or the Interlocked... calls is sufficient.
|
|
|
|
|
Name pipe is a good solution for communication between multiple processes. For communication between threadings I recommend CRITICAL_SECTION, mutex, event, and sephamore.
Kuphryn
|
|
|
|
|
I have an MDI application with a view class .
The View class is derived from CFormView and contains a CTreeCtrl and an MSFLExgrid.
Whenever I change the size of the Frame that contains the view , I want the controls inside the view to also resize.
I have included OnSize method in the View class that makes a call to
CFormView::OnSize
What else should i be doing to resize the controls of the FormView ?
Please Help
|
|
|
|
|
Hello!
Calling the CFormView::OnSize function won't resize the form view, you have to do it yourself. This is because the OnSize function is merely a handler for when the form view gets resized.
Here is what you want:
(inside your OnSize method in the view class)
<br />
CRect rc;<br />
GetClientRect(rc);<br />
m_yourFormView->MoveWindow(rc);<br />
That code will resize the form view to fit your entire view. You might need to then add code to resize the tree control and MSFlexGrid inside the form view. In order to do that, you probably want to look at some layout managers in the Dialog & Windows section of CodeProject.
Hope that helps!
Sincerely,
Alexander Wiseman
Est melior esse quam videri
It is better to be than to seem
|
|
|
|
|
Any one knows how to use complex class in VC++? How to declare it and how to use it? Thanks.
mIchAel Liu
__________________________________________________________
The secret of business is to know something that nobody else knows.
|
|
|
|
|
What do you mean by complex classes?
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Hi all
I want an application , which can trace the Email origin ,ie from where the Email actualy coming frm(The Details abt the ISP,IP address etc..),Is here any articles discussing about that..? or any Idea abt how it is possible.
Thank You
Mad Coding.
|
|
|
|