|
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. "
|
|
|
|
|
I have a basic MFC app. Basically, you can start the MFC appwizard, choose Dialog Based, and arrive at a dialog. Now, I want the dialog to monitor they keys pressed on the keyboard (some keys in combination), so I use GetKeyboardState(). The problem is whenever I hit a key it dings. I've attempted to override the WM_KEYDOWN, CHAR and other relative messages. Furthermore, I seem to fail to set the focus away from the OK button by using SetFocus() in the OnInitDialog(). When I remove ALL the controls, the dialog finally gets my WM_KEYDOWN events. I should be able to set the dialog to receive events even with controls on it shouldn't I? But I digress. The only reason why I'm attempting to override those events is because of the dinging.
My goal is to make an app in MFC where I can use the keyboard to modify a state structure via quake-like key bindings.
I think once I fix the dinging, I'll be happy.
Thanks in Adavance
|
|
|
|
|
In order to use SetFocus() in OnInitDialog(), you need to return FALSE from the OnInitDialog() function (as it says in the comment at the bottom of the function)
You can also trap key events in PreTranslateMsg function.
|
|
|
|
|
The OK button by standard is the default button.
You might want to change that too.
Wolfgang Reichl
|
|
|
|
|
I need to contain a web folder view (like the one in the Explorer) in an application for a selected file.
Does anyone know how to implement it in an easy way?
Can I use a shell view for this?
Thanks!
|
|
|
|
|
Hi,
Is it possible to retreive the type of a variable ?
I want to pass this type to a template like in :
Vect2d < int > vect, but I want to replace "int" by an
argument containing the type.
I have tried with a string, but whitout success.
Anybody knows if I can do that ?
Thanks,
Claude
|
|
|
|