|
If you want to use the MFC serialization mechanism, you must use class instead of structure, derive it from CObject and use the DECLARE_SERIAL and IMPLEMENT_SERIAL macros. The MFC serialization is powered by a bunch of runtime-type-information macros and routines, so it's almost impossible to implement it without CObject
Robert-Antonio
"Life is very hard, when you apply E-R model to it."
|
|
|
|
|
|
I want to create a valid domain name.
What is the rule for creating the domain name?
|
|
|
|
|
Hi,
Are you sure that your question is about Visual C++?
Sincerely Yours,
RadioShark
|
|
|
|
|
You might find these guidelines [^] helpful if you're referring to Internet domains. The term 'domain' is rather loosely defined, primarily because Microsoft uses the word for nearly everything, and it's difficult to tell just what you're asking about. If you follow these rules for domain naming, though, I doubt that you'll go wrong regardless of the application.
Will Build Nuclear Missile For Food - No Target Too Small
|
|
|
|
|
I use CDC:SetColorAdjustment to adjust the Image's brightness and colorfulness,but I can not work good, the function return is TRUE, but I can not see the changed,why?thanks for your help...wait....
I am Nizvoo Kensen.
like c/c++
|
|
|
|
|
Stupid thread.
MSN Messenger.
prakashnadar@msn.com
|
|
|
|
|
I'm pretty new to all this. I understand that I was supposed to have a few files. I downloaded the free borland C++ compiler. I have the text editor all setup. However I seem to be missing the .CFG files for the compiler to run on. It's installed at "C:\Borland\BCC55" I would be grateful for any assistance
Yay yayz and lalaz for all programmers n.n
|
|
|
|
|
Last time I setup Borland's compiler was for a friend. As I recall, the config files just contained the include and lib paths. There's a readme file in there somewhere explaining it.
|
|
|
|
|
Hi everybody.
Here is somebody desperate to know how to get the value of a pixel in an image and set the value to another pixel in another image.
Then I need to know how to access the RGB values of the images and manipulate them.
I need to know this quick. I'm desperate!
-Aartee
|
|
|
|
|
Hi,
Look at this (maybe it will be useful for you)
void CImageListFromBitmap::ReplaceBackgroundColor (CBitmap& ioBM)
{
// figure out how many pixels there are in the bitmap
BITMAP bmInfo;
VERIFY (ioBM.GetBitmap (&bmInfo));
// add support for additional bit depths here if you choose
VERIFY (bmInfo.bmBitsPixel == 24);
VERIFY (bmInfo.bmWidthBytes == (bmInfo.bmWidth * 3));
const UINT numPixels (bmInfo.bmHeight * bmInfo.bmWidth);
// get a pointer to the pixels
DIBSECTION ds;
VERIFY (ioBM.GetObject (sizeof (DIBSECTION), &ds) == sizeof (DIBSECTION));
RGBTRIPLE* pixels = reinterpret_cast<rgbtriple*>(ds.dsBm.bmBits);
VERIFY (pixels != NULL);
// get the user's preferred button color from the system
RGBTRIPLE userBackgroundColor = {
GetBValue (m_screenBackColor), GetGValue (m_screenBackColor), GetRValue (m_screenBackColor)};
BYTE imageBlue=GetBValue(m_imageBackColor);
BYTE imageGreen=GetGValue(m_imageBackColor);
BYTE imageRed=GetRValue(m_imageBackColor);
// search through the pixels, substituting the user's button
// color for any pixel that has the magic background color
for (UINT i = 0; i < numPixels; ++i)
{
if (pixels [i].rgbtBlue == imageBlue &&
pixels [i].rgbtGreen == imageGreen &&
pixels [i].rgbtRed == imageRed)
{
pixels [i] = userBackgroundColor;
}
}
}
Sincerely Yours,
RadioShark
|
|
|
|
|
I am a bit confused! If you are programing for windows all that is required is that you load an image into a device context then call GetPixel() to read the RGB value or call SetPixel() to set the RGB value.
Now if you want to access the values directly (which is faster) I recommend 2 aticles: DIBSection By Chris Maunder and CDibData By me. There are probably other aticles at codeproject that will answer your question.
Steps:
1. Load bitmap.
2. Create a memory DC (or CDC in MFC).
3. Select bitmap into DC.
4. Read or Write pixel
(SDK: SetPixel(hdc,x,y,color), MFC: pdc->SetPixel(x,y,color))
5. Select origanal bitmap into DC.
6. Release DC.
Now, If you need to save the image after you have modified it read the articles mentioned above and if you need to support multiple bitmap formats then I recommend looking at CxImage.
INTP
|
|
|
|
|
How can I know the actual size of a menu? I need to display a menu from a CToolBarCtrl toolbar. When the menu is from top to bottom, the menu should be popped up from the bottom of the bar, on the other hand, when the bar is near the bottom of the screen and the menu needs to be displayed from bottom to top, the menu should be popped up from the top of the bar. IE paints menu this way so that the bar won't be blocked by the menu.
But I don't know how to get the acutal size (in pixles) of the menu. Or if I can how which way it pops up the menu, that would be better.
Thanks a lot in advance.
|
|
|
|
|
I beleive that BCMenu By Brent Corkum (@ codeproject) will probably answer your question. The following is from some code I wrote a while ago, it was derivived from Bent Corkum's code (since his was less complicated than my first idea):
BOOL CDialogMenu::TrackWindow()
{
if( m_rcExclude.left == __BADPOSITION )
return FALSE;
CRect rectWindow;
WINDOWPLACEMENT wndpl;
wndpl.length = sizeof(WINDOWPLACEMENT);
if( !GetWindowPlacement( &wndpl ) )
return FALSE;
rectWindow = wndpl.rcNormalPosition;
int cx = ::GetSystemMetrics(SM_CXSCREEN);
int cy = ::GetSystemMetrics(SM_CYSCREEN);
rectWindow.SetRect(
m_rcExclude.left,m_rcExclude.bottom,
m_rcExclude.left+rectWindow.Width(),
m_rcExclude.bottom+rectWindow.Height());
if( m_bCenter )
rectWindow.OffsetRect(-((rectWindow.Width() + m_rcExclude.Width())>>1),0);
if (rectWindow.right > cx)
rectWindow.OffsetRect(-(rectWindow.right - cx), 0);
if (rectWindow.left < 0)
rectWindow.OffsetRect( -rectWindow.left, 0);
if (rectWindow.bottom > cy)
rectWindow.OffsetRect(0,-(m_rcExclude.Height() + rectWindow.Height()));
wndpl.rcNormalPosition = rectWindow;
SetWindowPlacement( &wndpl );
return FALSE;
}
I hope this helps!
Good luck!
INTP
|
|
|
|
|
Here's what I use in the CP SearchBar:
void CalcMenuLocation ( HMENU menu, const RECT& rcBtn,
POINT& ptMenuLocation, UINT& uFlags )
{
POINT pt = { rcBtn.left, rcBtn.bottom };
UINT uMenuFlags = 0;
UINT uItemCnt = GetMenuItemCount ( menu );
int nMenuHeight = uItemCnt * GetSystemMetrics ( SM_CYMENUSIZE );
int nScreenHeight = GetSystemMetrics ( SM_CYSCREEN );
if ( nMenuHeight + pt.y > nScreenHeight )
{
uMenuFlags |= TPM_BOTTOMALIGN;
pt.y = rcBtn.top;
}
ptMenuLocation = pt;
uFlags |= uMenuFlags;
} Call it like this:
LRESULT CSearchBar::OnToolbarDropdown ( NMHDR* phdr )
{
NMTOOLBAR* pnmtb = (NMTOOLBAR*) phdr;
HMENU hmenu, hPopup;
RECT rcItem = pnmtb->rcButton;
hmenu = AtlLoadMenu ( IDR_YOUR_MENU_HERE );
if ( NULL == hmenu )
return TBDDRET_DEFAULT;
hPopup = GetSubMenu ( hmenu, 0 );
ATLASSERT ( NULL != hPopup );
POINT ptMenuLocation;
UINT uFlags = TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_RETURNCMD;
int nMenuItem;
ClientToScreen ( &rcItem );
CalcMenuLocation ( hPopup, rcItem, ptMenuLocation, uFlags );
nMenuItem = (int) TrackPopupMenu ( hPopup, uFlags,
ptMenuLocation.x, ptMenuLocation.y,
0, m_hWnd, NULL );
} Note that this is not multi-monitor aware. I don't have 2 monitors at home so I haven't fixed the code to work on secondary monitors.
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
There is a saying in statistics that a million monkeys pounding on typewriters would eventually create a work of Shakespeare. Thanks to the Internet, we now know that this is not true.
|
|
|
|
|
Mike, I am in the process of writing an article about menus. Would I be able to make use of this code as part of it?
It would be a good complement to some of the stuff I already have complete.
Roger Allen - Sonork 100.10016
Strong Sad:
Clever I am? Next to no one.
Undiscovered and soggy.
Look up. Look down. They're around.
Probably laughing. Still, bright, watery.
Listed among the top. Ten.
Nine. Late night. Early morn.
Early mourn. Now I sleep.
|
|
|
|
|
Roger Allen wrote:
Mike, I am in the process of writing an article about menus. Would I be able to make use of this code as part of it?
Sure, go right ahead
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
Pinky, are you pondering what I'm pondering?
I think so Brain, but if we shaved our heads, we'd look like weasels!
|
|
|
|
|
visual C++ 6
is there an open type variable that can access the string type of data or double ..
( To be used in an edit box, read from and write in )
|
|
|
|
|
I am not sure what you mean by open type! If you mean a variable type the can hold either a double or a string then you are talking about a VARIANT which is communaly used in visual basic (probably where it came from) and when creating OLE controls. If you need and edit box control that is either designed for a perticular data type or can be generalized using masks then goto the the edit controls section of codeproject (where there are many aticles on this subject).
INTP
|
|
|
|
|
I have the following message map:
ON_MESSAGE (WM_ACTION, OnAction)
(where WM_ACTION is defined as WM_USER+0x100 )
and I get the following error:
error C2440: 'static_cast' : cannot convert from 'LRESULT (__thiscall CMainFrame::* )(WPARAM,LPARAM)' to 'LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)'<br />
None of the functions with this name in scope match the target type
Can anybody help?
Thanks
|
|
|
|
|
Naturaly I would look for any where that you use static_cast. In C you probubly would not see the error, but C++ is less forgiving (a good thing).
This is realy not quite enough infomation to solve the problem, although the deference between CMainFrame* and CWnd* does suggest a scopping problem, accept for the fact that static_cast is being used.
If you know the line on which the error occurs (I assume you do), then you have half the problem solved. Now look at all the related functions that take arguments (WPARAM,LPARAM) and work from there.
This is one of the reasons that C++ can be very irritating, because in C what you see is what you get. But in C++, not only does it hide information but, it often hides the reason for the error.
Well! Good luck in solving your problem, it does not look too difficult.
Sorry if this did not help, since it looks like you are already applying the method I would use.
INTP
|
|
|
|
|
Can you show how you have defined the OnAction method, i guess thats where the problem lies.
MSN Messenger.
prakashnadar@msn.com
|
|
|
|
|
OK, i have 2 dialogs. I want to show one as a child of another. Can someone take me through how to do this, i have no idea how. Im using VC++6, and im reletivly new to c++ so please be explain how it works if u would, thank you
i really appreciate it.
---------------------
And Like The Wind Our Hero Vanishes Off Into The Distance...
|
|
|
|
|
|
Thank you, but not exactly what im trying to do. I want to be able to move the child around inside of the parrent, i guess turning my parrent into a sort of MDI Dialog box. But yeah, i want to be able to move the dialog box around, close it...ect
thank you
---------------------
And Like The Wind Our Hero Vanishes Off Into The Distance...
|
|
|
|