|
MFC uses message maps to enable and disable things. Sounds like you're fighting with MFC over whether it should or shouldn't be neabled.
If there are no handlers for the message, it's automatically disabled. If you do have a handler, then you need to handle the ON_UPDATE_CMD_UI messages and call pCmdUI->Enable(FALSE).
|
|
|
|
|
Thanks a lot, it works
- Anders
|
|
|
|
|
Hi,
I have a CDialog which has a menu. In that menu, I have a popup-menu that contains my last opened files, like the last opened project in the Visual Studio. This works
wonderful when I start my program, but I have a problem with the update on that MRU lis during the run-time. Ususally, the current opened filename is on the top of that list.
When you choose that 3rd file in that list, usually, it will be moved up the the first position. And yes, it does so, the only problem is that the menu-item-text doesn't seems to
get updated with the new name, since I don't get the filename that is written there, I get the last opened file instead. How can I force my program to update the item text of
that menu??????
Thanx,
Grit
|
|
|
|
|
Hi i believe some people from this newsgroup have obtained wincap 32 from microsoft sdk and i was wondering has anyone obatined this project and made alterations to it such that it can be compiled by Visual c++ complier and can work in win 95? If anyone has already successful in doing so , can you emailed your wincap project to me ?
|
|
|
|
|
Hello,
A few months ago I posted a message that I encounter problems with the String Table in Visual Studio Pro C++ V6.00. So far I did'nt receive any suggestion. I like to repeat my question.
The problem is that if the String Table has to have more than 300 string items, one particular string form the string table appears unwanted in the message box to prompt for a save operation at closing the child window.
Can sombody give some advice how to remediate this problem ?
thanks.
|
|
|
|
|
isn't you problem you resource string number conflict with mfc text(s)?
(try look into your resource.h IDS_ and compare with AFX_IDS_ into afxres.h and similar files)
me one time happened this - i wanted to get over one mfc text and wizard for my next new strings used next
numbers in "mfc system text index range"
if you creating new resource and select id from existing and modify it (f.e select IDS_TEXT and change to IDS_TEXT2)
wizard will keep the same number (#define) for both cases
t!
|
|
|
|
|
Your hints to inspect AFX_IDS_... are most welcome. In my String Table only a few AFX_IDS_... are present as AFX_IDS_APP_TITLE 57344 to AFX_IDS_PREVIEW_CLOSE 61445.
I see in the properties table of a string item in the String Table that there exist an AFX_IDS_ASKTOSAVE ID but I don't known how I can open the afxres.h file. I don't find such a file in my project. I find only include staements. Please can you tell me how I get access to the afxres.h file.
I struggle with this problem for a long time.
|
|
|
|
|
afxres.h you can find into your devstudio instalation
(something like program files/.../mfc/include)
when i look into there is f.e. AFX_IDS_SAVEFILE 0xf001 (and anothers)
try to change id of by you critical text (resource.h) what appears in save question and rebuild all
when situation changes problem is with resource id
|
|
|
|
|
Hi Everyone,
I'm using a DIALOG with some buttons to play sounds (wav/mp3) with DirectX.
it has it's own CSound class which holds all the interfaces and such. In that
class I have a IMediaEventEx, which I used to call the 'SetNotifyWindow'
function, with as param the GetSafeHwnd() from the dialog, and a WM_USER+1
for the message.
My Problem is that my dialog never receives the Msg. Is this because it's a dialog??
Thanks!
Stefan
|
|
|
|
|
Any article or book available for "How to write Network(like client-server communication )programs using Visual C++ -step by step approach"?
|
|
|
|
|
How about Ralph Davis' "Win32 Network Programming". Addison Wesley. ISBN 0-201-48930-9
|
|
|
|
|
I've defined following classes (standart example):
A
/ \
B C
\ /
D
B and C are virtually inherit A.
But following code failed at compile time:
A* pa = new B();
B* pb;
pb = (B*)pa;
How can I resolve such error?
|
|
|
|
|
This sort of thing requires either a reinterpret cast if you are CERTAIN that pa will always be an actual instance of a B, or you need to enable RTTI and use dynamic_cast.
|
|
|
|
|
Thanks. It very helps me.
|
|
|
|
|
I can capture the screen and copy it into a bitmap and can anyone suggest how i can save this into a file ? If i save my captured screen into a DIB and how can i save into a file? Anyway , which will be a better option for win98 - save into DIB or bitmap?
|
|
|
|
|
This code works fine in our project
void WriteBmpToFile(HBITMAP hBmp)
{
BITMAP Bmp;
BITMAPINFOHEADER BmpInfoHeader;
BITMAPINFO * pBmpInfo;
BYTE * pData;
::GetObject(hBmp, sizeof(Bmp), &Bmp);
memset(&BmpInfoHeader, 0, sizeof(BmpInfoHeader));
BmpInfoHeader.biSize = sizeof(BmpInfoHeader);
BmpInfoHeader.biWidth = Bmp.bmWidth;
BmpInfoHeader.biHeight = Bmp.bmHeight;
BmpInfoHeader.biPlanes = 1;
BmpInfoHeader.biBitCount = 24;
pBmpInfo = (BITMAPINFO * )&BmpInfoHeader;
int nSize = Bmp.bmWidth * Bmp.bmHeight * 3;
pData = (BYTE*)malloc(nSize);
HDC hDC = ::CreateDC(_T("DISPLAY"), NULL, NULL, NULL);
::GetDIBits(hDC, hBmp, 0, Bmp.bmHeight, pData, pBmpInfo, DIB_RGB_COLORS);
::DeleteDC(hDC);
int file = _lcreat("file.bmp", 0);
if (file != -1)
{
BITMAPFILEHEADER hdr;
hdr.bfType = 0x4d42;
hdr.bfSize = (sizeof(BITMAPFILEHEADER) + sizeof(BmpInfoHeader) + nSize);
hdr.bfReserved1 = 0;
hdr.bfReserved2 = 0;
hdr.bfOffBits = sizeof(BITMAPFILEHEADER) + sizeof(BmpInfoHeader);
_lwrite(file, (const char*)&hdr, sizeof(hdr));
_lwrite(file, (const char*)&BmpInfoHeader, sizeof(BmpInfoHeader));
_lwrite(file, (const char*)pData, nSize);
_lclose(file);
}
free(pData);
}
|
|
|
|
|
If you want to write DIB with different color depth, don't forget to write palette between header and color data
|
|
|
|
|
int nSize = ( Bmp.bmWidth * 3 + 3 ) / 4 * 4 * Bmp.bmHeight;
|
|
|
|
|
Hey Feng !! That book of yours ever going to be published ?
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
Christain.
It's going to be printed tomorrow (Nov/30).
|
|
|
|
|
Why so difficult ?
Usually, I use
pBmi->bmiHeader.biSizeImage = ((((Bmp.bmWidth * Bmp.bmBitsPixel) + 31) & ~31) >> 3) * Bmp.bmHeight;
but in this case I need only 24-bits bitmap, so I can count nSize as I did before
|
|
|
|
|
If width is 1
1*3 is 3
while (1*3+3)/4*4 is 4
It's only the same for 32-bpp DIB
|
|
|
|
|
Does anyone know what the limit for the length of a single CString is? I thought it was 255 characters, but I can't find any documentation on it. Any references to documentation on this would be appreciated as well.
I'm using MFC 6.0.
Thanks,
Jason
|
|
|
|
|
No, it's not 255 characters. There are limits on the length of strings in resources and other places, but the only limit is the length of the CString length variable, which is a signed int. Thus, assuming you have enough virutal memory space, you can create strings up to 2GB.
|
|
|
|
|
From the topic 'Strings in MFC' (from VC5.0 documentation, YMMV):
"A CString object can store up to INT_MAX (2,147,483,647) characters. "
|
|
|
|