|
Hello,
i have problems creating a larger projects.
i want my project to have a directory structure like this
main
+ bin
-+ debug
-+ release
+ source
-+ project1
-+ project2
-+ project3
what is the best way to start this?
how can i reuse these settings for new projects?
all ideas are welcome.
|
|
|
|
|
I am developinng a MDI application.
Wanna know if there are ways to record how many windows
were open last time when you close an application.
Just like photoshop.
Shin
|
|
|
|
|
I am not sure your question.
Do you wanna restore all windows opened last time when you run your application again, or just record the number of windows.
For the latter one, you can write this as a key into your ini file or registry before you destory all your windows.
Nice to learn
yfmain
|
|
|
|
|
Hi,
Can we use the BOOL and bool interchangebly in a VC++ code.
That means can true and TRUE be used interchangebly?
I have a piece of code, working fine but using false for a BOOL variable.
Regards,
Saurabh
|
|
|
|
|
|
I think the Frankie goes to hollywood song "Relax, don't do it" comes to mind.
|
|
|
|
|
BOOL is a Windows typedef, 4 bytes long. Its values are TRUE and FALSE .
bool is a built-in C++ type, 1 byte long. Its values are true and false .
That's all you need to know. Don't mix them. Sure, if you write:
BOOL b = false;
it will work, but it also looks like you don't know the difference between BOOL and bool . If you write this during an interview, it will reflect unfavorably on you.
--Mike--
Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber
CP SearchBar v2.0.2 released
|
|
|
|
|
BOOL
====
typedef int BOOL;
bool From MSDN Library
=======================
In Visual C++4.2, the Standard C++ header files contained a typedef that equated bool with int. In Visual C++ 5.0 and later, bool is implemented as a built-in type with a size of 1 byte. That means that for Visual C++ 4.2, a call of sizeof(bool) yields 4, while in Visual C++ 5.0 and later, the same call yields 1. This can cause memory corruption problems if you have defined structure members of type bool in Visual C++ 4.2 and are mixing object files (OBJ) and/or DLLs built with the 4.2 and 5.0 or later compilers.
|
|
|
|
|
hi
can anybody send me a fingerprints recognition code. in vc++ or any other language. or even tell me where to get tht code.
i'll b very thankful to u ppl
|
|
|
|
|
Right now, I'm doing this:
CPaintDC dc(this);<br />
CBrush brush(RGB(255,0,0));<br />
HBRUSH oldbrush=(HBRUSH)dc.SelectObject(&brush);<br />
...<br />
dc.SelectObject(oldbrush);
It works, but there's a HUGH memory leak. If I remove the SelectObject() lines, there's no leak anymore, so I assume that it's the SelectObject() , or the Brush maybe. But objects are destroyed at the end of the scope, no?
Is there another solution that guarantees complete release of resources?
using: [VISUAL STUDIO 6.0 sp5] [WIN98/2]
|
|
|
|
|
Changed to this:
dc.SelectObject(brush);
and the leak is gone.
So, you should pass a copy of the object instead of the pointer to the object. Strange, cause I've seen this code hundreds of times on this site...
I was stuck with this for a couple of days, and you'll always see that the moment you post a question about this, you'll find the solution yourself. Sorry about that.
|
|
|
|
|
You could try
dc.SaveDC();
and
dc.RestoreDC(-1);
to save and restore the DC state. That should work.
The brush and any other objects can only be destroyed if they are not being referred to by the DC, so your stuff should work anyway...
Steve S
|
|
|
|
|
It works, that's true ... but after 5 seconds you've wasted 512 meg of ram.
Adding dc.SaveDc() and dc.RestoreDC(-1) doesn't make a difference, still leaking.
Passing the brush object instead of the pointer is the only thing that works. But then we are using deep copies (I assume that) and that doesn't speed things up.
using: [VISUAL STUDIO 6.0 sp5] [WIN98/2]
|
|
|
|
|
Your mix of things might be why.
Does
CBrush* pOld = dc.SelectObject(&brush);
...
dc.SelectObject(pOld);
still leak?
Steve S
|
|
|
|
|
That results in a crash when selecting a pen instead of a brush (selecting a brush is doing allright).
Strange...
Is it the stockobject?
CPen* oldpen=(CPen*)pDC->SelectObject(GetStockObject(NULL_PEN));
using: [VISUAL STUDIO 6.0 sp5] [WIN98/2]
|
|
|
|
|
Wouldn't it be easier to use pDC->SelectStockObject(NULL_PEN) ?
There are caveats to do with the fact that the pointer may well, in this case be to a temporary CGdiObject, so shouldn't be used in different messages.
I normally use SelectStockObject, or failing that,
CPen* oldpen = (CPen*)pDC->SelectObject(CPen::FromHandle(::GetStockObject(NULL_PEN)));
I prefer use of an explicit FromHandle() call rather than relying on a cast operator.
Steve S
|
|
|
|
|
SelectStockObject instead of SelectObject(GetStockObject) does the trick.
tnx.
|
|
|
|
|
This eats ram like hell too:
CPen pen(PS_SOLID,1,m_clrForeground);<br />
CPen* oldpen=(CPen*)pDC->SelectObject(&pen);<br />
...<br />
pDC->SelectObject(oldpen);
I don't understand this, it's code I see a lot. I feel kinda stupid...
using: [VISUAL STUDIO 6.0 sp5] [WIN98/2]
|
|
|
|
|
Hi CPians!
I'd like to debug my app, which is a C-dll with visual C++ 6.0. It is bound to an application, which is loaded when starting the debugger.
My problem is that the debugger will not stop at the breakpoints ... I made sure that I have opened the corresponding file (I mean the file that actually gets compiled, and not a copy of the project), that my dll is really being loaded by the application (renaming it would crash the app), and that my code gets compiled (I do not get that message you usually get when trying to put a breakpoint on a part of code which is not compiled). Besides, I am really positive that the code has to go through where I put my breakpoints.
So ... I am lost ... any suggestion ?
Thanks
~RaGE();
|
|
|
|
|
This can sometimes happen moved your project to a different directory, then editted code in the new directories. Some files are still pointing to the old directory.
J.
----------------------------
|
|
|
|
|
hi,
i have a problem with my MFC Dialog, i want to add a minimized respectively a maximized item into the popupmenu, which appears if the right mouse button is pressed on my dialog in the taskbar! There are only MOVE and EXIT items in it! I don't know how to get them in there!
Can someone help me ?
Thanks in advance!
|
|
|
|
|
Hi,
the MFC Dialog, sets the menu options in the OnInitDialog() method. look at the following code:
BOOL CMyDlg::OnInitDialog()
{
CDialog::OnInitDialog();
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
SetIcon(m_hIcon, TRUE);
SetIcon(m_hIcon, FALSE);
return TRUE;
}
the pointer pSysMenu is the handler to the system menu, and you can add your menu items using pSysMenu->AppendMenu() method, same as the MFC by default adds the 'About' menu.......
hope this helps ya
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
how to save a flash in a webpage as a jpg/gif/bmp file? zhongxunyang 3:53 25 Sep '03
how to save a flash in a webpage as a jpg/gif/bmp file?
i used a flash object that i downloaded from the site of http://bukoo.sourceforge.net to create a flash movie file, and now i want to add a function and it can allow people to save this flash movie as a jpg/gif/bmp file.Can anyone here provide some codes or component to help me realize this function?
|
|
|
|
|
Have you tried getting the display context for the app running the flash object and using BitBlt?
That is where I would start.
|
|
|
|
|
can you provide a source code for how to do it?
is there any component can realize this function?
thanks very much!
|
|
|
|