|
zach7 wrote: I really need help. I dont know the first thing about C++ and C++ is such a huge language. Im so lost. Where should I start. I went to the beginners section of C++ tutorials and I looked at the bits and bytes tutorial and it was really confusing.
http://www.cplusplus.com/doc/tutorial/[^]
Here is the good atritcals on C++
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
how do i show the menu in a listbox i have the menu resource i want to use a right click to show the menu i have the right click function but i dont know how to call the menu.
im using MFC/Visual C++ 6.0
and i have this bit of code
enum FindOptionsEnum
{
FIND_SIZE = (1L << 0),
FIND_DATEMODIFIED = (1L << 1),
FIND_DATECREATED = (1L << 2),
FIND_DATEACCESSED = (1L << 3),
FIND_ATTRIBUTES = (1L << 4),
FIND_TEXT = (1L << 5),
};
but when i try to #include "vfw.h"
the compiler gives a error on that code anyone know why?
error C2059: syntax error : 'constant'
error C2143: syntax error : missing ';' before '}'
error C2143: syntax error : missing ';' before '}'
all 3 errors goto that code
-- modified at 21:55 Tuesday 13th June, 2006
|
|
|
|
|
map the right click message of the control
and use a CMenu object to create popup menu
MSDN has the sample code
here it is
VERIFY(m_NewMenu.CreateMenu());
VERIFY(m_FileMenu.CreatePopupMenu());
m_FileMenu.AppendMenu(MF_STRING, ID_APP_EXIT, (LPCTSTR)"E&xit");
m_NewMenu.AppendMenu(MF_POPUP, (UINT) m_FileMenu.m_hMenu, "&File");
SetMenu(NULL);
CMenu* old_menu = CMenu::FromHandle(m_hMenuDefault);
old_menu->DestroyMenu();
SetMenu(&m_NewMenu);
m_hMenuDefault = m_NewMenu.m_hMenu;
SaRath.
"Don't Do Different things... Do Things Differently..."
Understanding State Pattern in C++
|
|
|
|
|
if you need to right click for menu do you see WM_CONTEXTMENU
whitesky
|
|
|
|
|
did you saw vfw.h you use from FIND_SIZE and ... that are in these file
whitesky
|
|
|
|
|
if you want to show menu only in listbox use from a if
if(pWnd->m_hWnd==m_List.m_hWnd) then menu functions
whitesky
|
|
|
|
|
Hi,
I wanna make a simple application that finds a certain text string periodically on the Internet Explorer's current loaded webpage. If it finds text that I predefined, it will pop-up message box and that's all.
This webpage is updated quite often by server without user's input.
Could you suggest any briliant idea to make this simple & fast?
|
|
|
|
|
PLease see the IHtmlDocument2 interface in the MSDN you can find all the methods which are exposed by this interface.
Cheers
"Peace of mind through Technology"
|
|
|
|
|
Joseph Lee wrote: Could you suggest any briliant idea to make this simple & fast?
You may required to write plugin for IE which keep track of webpages.
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
Hello everyone,
Im displaying a captured image onto the the screen. I use the following code to display the image.
<br />
void draw()<br />
{<br />
if(m_imageData == NULL)<br />
return;<br />
glPixelStorei(GL_UNPACK_ALIGNMENT,1);<br />
glRasterPos2i(m_xOffset,m_yOffset);<br />
glDrawPixels(m_width,m_height,GL_RGBA,GL_UNSIGNED_BYTE,m_imageData);<br />
glFlush();<br />
}<br />
the fuction draws the image ok but the glDrawPixels function creates a memory leak. Does anyone know a work around glDrawPixels or a way to track the memory leak (don't know if it's possible on my end since it's a openGL function).
Thank's everyone
|
|
|
|
|
I am trying to change colors using variables in the initialization of a RGB command. The following are the commands used in MFC/Visual C++ 6.0:
int a = 200;
int b = 180;
int c = 125;
CMainFrame::CMainFrame()
{
//Set color frame
colorbar.CreateSolidBrush(RGB (a, b, c));
}
void CMainFrame::OnPaint()
{
CPaintDC dc(this);
CRect rc(100,150,150,200);
a = 140;
dc.FillSolidRect(&rc,RGB(a,b,c));
}
No matter what I set a to, it always displays with the original value for color. Is there a way to change the RGB colors after initialization? Please let me know at sid_kraft@msn.com. Thanks in advance, Sid Kraft
Sid
|
|
|
|
|
Seems this will work properly. check for local definitions of variable 'a'
You always filling a rectangle with a value 140,180,125
the how you could track the difference?
When filling a solid rectangle, you don't need to create teh solid brush.
the brush you have created is not selected by any dc. so if you are not using that, remove the same.
SaRath.
"Don't Do Different things... Do Things Differently..."
Understanding State Pattern in C++
|
|
|
|
|
a rectangle with green color(almost) of course OnPaint in
CSDIView::OnPaint()
whitesky
|
|
|
|
|
I wrote a Wizard page using PropertySheet, and a manifest file under XP.But when I run it under Windows vista, the header of wizard doesn't display. then, I remove the manifest file, the header display correctly. So I want to why?and if I don't remove the manifest file, how can I modify it?
Thank you very much.
|
|
|
|
|
Does anyone know how to create a thread using an unmanaged class?
|
|
|
|
|
CreateThread/Ex
AfxBeginThread
CWinThread
|
|
|
|
|
led mike wrote: CreateThread/Ex
is not thread safe. Use _beginthreadex instead.
- It's easier to make than to correct a mistake.
|
|
|
|
|
Jun Du wrote: CreateThread/Ex is not thread safe.
Huh?
|
|
|
|
|
Jun Du wrote: is not thread safe. Use _beginthreadex instead.
IF you use certain functions in the CRT, then you should use _beginthreadex . However, if you use only Win32 calls and other functions in CRT, then CreateThreadEx is perfectly fine. (As a rule, if I use any of the CRT, I use the former function, but I have used the latter in production code.)
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
If we are using Win32 APIs only, then CreateThread would be good enough but if we are using any CRT function that requires tiddata structure, it is must to use _beginthreadex function. Otherwise memory leak will occur because CloseHandle, corresponding to CreateThread API, won't free the dynamically allocated tiddata structure.
There is one more problem related to SEH frame.
For better understanding, please go through following link:
http://www.microsoft.com/msj/0799/Win32/Win320799.aspx
|
|
|
|
|
That's what I said. (Not all CRT functions require the local data, but knowing which ones do and which ones don't isn't generally worth the effort.)
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Jun Du wrote: is not thread safe. Use _beginthreadex instead.
Who said this?????
SaRath.
"Don't Do Different things... Do Things Differently..."
Understanding State Pattern in C++
|
|
|
|
|
Using CreateThread is not thread safe, not because CreateThread is not thread safe itself, but because using it in applications linked with a CRT (C/C++ Run-Time) library is not. Some notable items:
1) The applications built on VC++ 6, regardless of type, have been linked to one of the CRT libraries shiped with VC++:
Single-Threaded (default)
Multithreaded
Multithreaded DLL
Debug Single-Threaded
Debug Multithreaded
Debug Multithreaded DLL
You could avoid calling CRT functions in your module, but you have no control over who, where and when CRT is used in the application.
2) For multithreaded C/C++ to work properly, a data structure must be created and associated with each thread that uses CRT functions. CreateThread is an OS call, but _beginthreaded is a CRT call. If you call CreateThread, OS doesn't know:
- your application is written in C/C++,
- you are calling functions that aren't natively thread-safe
- it needs to allocate a CRT data block for the new thread
When you call _beginthreaded, CRT knows and handles all these in a proper manner. Then, CRT calls CreateThread inside _beginthreaded to actually create the thread you wanted.
Jeffery Richter's classic text "Programming Applications for Microsoft Windows" (4th Ed.) Chapter 6 has explained this in more detail.
- It's easier to make than to correct a mistake.
|
|
|
|
|
I'm using a CButton with the BS_BITMAP flag to draw a simple bitmap button.
I load the bitmap like this :
m_hBitmap = (HBITMAP) ::LoadImage(AfxGetResourceHandle(),
MAKEINTRESOURCE(IDB_MY_BITMAP ),
IMAGE_BITMAP, 20, 18, LR_LOADMAP3DCOLORS );
to draw it "transparent" on the button.
and set the bitmap like :
m_Button.SetBitmap( m_hBitmap );
This works well, EXCEPT when the button is disabled; when enabled, the transparent part is "transparent", and the non-transparent part display nicelly.
When the button is disabled, the WHOLE bitmap is drawn as a dark gray rectangle.
Is there a solution to that ? I would like the disable state ( that is computed automatically ) look like what disabled buttons on toolbars look like.
Also, The LoadImage with the LR_LOADMAP3DCOLOR flag seems to be working on Win2K, but when I try my application on WinXP the color substitution does not seem to be working fine, the bitmap background is not the same as the button color.
Is there a known issue with LoadImage on XP or with BS_BITMAP ?
Thank you all.
Max.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Maximilien wrote: Is there a solution to that ?
What about DrawState(..., DST_BITMAP | DSS_DISABLED) ?
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|