|
What I mean is that if you have b,c,d,e,f,... each corrensponding to only one bit set, for instance:
b=0x00000001;
c=0x00000002;
d=0x00000004;
e=0x00000008;
f=0x00000010;
then a condition using (a & b) evaluates to true (non-zero) only if a has the bit 0 set and the same holds for a condition using ((a & b) == b) . In the same way, a condition using (a & c) evaluates to non-zero only if a has the bit 1 set, the same holding for a condition using ((a & c)==c) , and so on...
On the other hand, suppose that x is a combination (sum using OR) of the above indipendent values, for instance x= b | e; , so that x=0x00000009 , i.e. x has both the bits 0 and 3 set.
In this case, a condition using (a & x) evaluates to non-zero either if a has:
<list> only bit 0 set only bit 3 set both bit 0 and 3while a condition using ((a & x) == x) holds true only if both bit 0 and 3 are set.
In other words, if x = 0x00000009; then
(a & x) holds true if a = 0x00000001; , or a = 0x00000008; , or a = 0x00000009;
while ((a & x) == x) holds true if a = 0x00000009 .
hope that helps
BTW both conditions are also true if a = 0x00000019 and so on...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Hi all.
I am a new comer to the MFC and VC++ fields.
There are some questions those sounds bit confusing to me, like....
1. What is MFC? Offcource I know that is a collection of classes, structures etc, etc predefined by Microsoft
2. What is VC++? a language or a platforma or something else?
3. VC++ 6.0 or 5.0 (or whatever) is the IDE. Is that right?
Sameer Thakur
|
|
|
|
|
Roughly speaking:
Sameer_Thakur wrote: What is MFC? Offcource I know that is a collection of classes, structures etc, etc predefined by Microsoft
MFC stands for Microsoft Foundation Classes and it is an Object Oriented Library (i.e. basically a collection of classes) that (hopefully) simplify your life as deveoper of Windows applications.
Sameer_Thakur wrote: 2. What is VC++? a language or a platforma or something else?
3. VC++ 6.0 or 5.0 (or whatever) is the IDE. Is that right?
AFAIK, Visual C++ is the IDE, featuring the C++ preprocessor, compiler, linker, resorce compiler and tools.
hope that helps.
BTW there is a lot of documentation about the above topics (see MSDN).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Just to expand a little on CPallini's post:
1. What is MFC?
MFC gives you several basic things for developing Windows applications.
One, it provides a framework for one common style of application: document/view. A 'document' is a data structure that represents the state of the application: the text in an editor, one or more rows from a data base, and so on. The 'view' is how the user interacts with the document. It displays the document and lets the user manipulate it. MFC includes a number of different document and view types that you can derive from.
Two, MFC wraps a number of Windows features in a somewhat object-oriented architecture. These features include windows (the message pump), thread primitives, built-in controls, the common controls, data bases, and so on.
Three, MFC gives you a group of utility classes, including strings (CString ) and collections (arrays, lists, maps).
2. What is VC++? a language or a platforma or something else?
VC++ is Visual C++, Microsoft's implementation of the C++ programming language. Visual C++ was once an independent product. Since Visual Studio .NET 2002, however, it has been part of the Visual Studio product, which includes Visual Basic, C#, etc.
3. VC++ 6.0 or 5.0 (or whatever) is the IDE. Is that right?
VC++ 6.0 was the last separate version of Visual C++ (see #2 above). The current version of the IDE now is Visual Studio 2005.
Software Zen: delete this;
|
|
|
|
|
I should add:
2 - Some people say VC++ when they mean C++ - C++ is a standard language. VC++ is the IDE. VC2002/2003/2005 all offer extensions to the language to access the .NET framework. They were called managed C++ and C++/CLI.
3 - not sure if you mean these are the two you have to choose from - both suck. Use VS2002 at the earliest, the implimentations before that were very broken.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
How to convert value to string in c?
|
|
|
|
|
Agbaria Ahmed wrote: How to convert value to string in c?
Using itoa[^]
|
|
|
|
|
Hi
I am calling one of my SQL server stored procedures using SQLExecute(). If there is a SQL syntax error, I can see it in the C++ code by checking the return code of SQLExecute() and calling SQLGetDiagRec(). If the stored procedure does not error, but outputs some warning message with a SQL PRINT statement, or RETURNs non-zero ... is there a simple way that the C++ code can detect this kind of soft failure ?
cheers,
Neil
|
|
|
|
|
Hi,
I use truedbgrid control to show the table in vc++, but i don't know how to use the function SetEvenRowStyle(LPDISPATCH) and SetOddRowStyle(LPDISPATCH), anyone can tell me how to pass the LPDISPATCH parameter? Thanks!
|
|
|
|
|
I want to create message function that user press "Ctrl+Double click".
Please give me some idea for do this.
|
|
|
|
|
Handle the WM_LBUTTONDBLCLK message and in the handler function use GetKeyState() to check if the control key is pressed.
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
PJ Arends wrote: in the handler function use GetKeyState() to check if the control key is pressed.
Why ?
wParam value can be checked for MK_CONTROL .
i.e.
if (wParam & MK_CONTROL)
{
}
|
|
|
|
|
Handle WM_LBUTTONDBLCLK .
void CWnd::OnLButtonDblClk(UINT nFlags, CPoint point)
{
if ( nFlags & MK_CONTROL)
{
}
CWnd::OnLButtonDblClk(nFlags, point);
}
|
|
|
|
|
hi i have a small problem.
first i am a c# developer.
i want to use the windows media sdk.
the sdk is only available for c++.
what does i need.
the standard Directshow Filter WM ASF Writer (is from microsoft).
is it posible to build an directshow filter / that includes the WM ASF Writer and add an method that i set in the filter with an pubilc method to an prx file which is locate in the local filesystem.
this is the code that i allredy have / but i don know how i can build an direct show filter that include this....
does have anybody an idea ?
exsisting directshow warper and also warper for the windows media format sdk doesnt work.
best regards enrico hofmann
ok, thx for the firsttime
#include "wmsdk.h"
#include "WMSysPrf.h"
#include "Dshowasf.h"
...
void CIPCameraTestAppDlg::OnFilterCreatedMvsmartcontrol(LPCTSTR Label, LPUNKNOWN Filter)
{
CString szASFWriter = "WM ASF Writer";
if( szASFWriter.Compare(Label) == 0 )
{
IWMProfileManager *pProfileManager = NULL;
HRESULT hr = WMCreateProfileManager( &pProfileManager );
if( hr == S_OK && pProfileManager != NULL )
{
IWMProfile* pProfile = NULL;
// Set a Standard System profile
pProfileManager->LoadProfileByID( WMProfile_V80_BESTVBRVideo, &pProfile );
if( hr == S_OK && pProfile != NULL )
{
IConfigAsfWriter *pProp;
hr = Filter->QueryInterface(IID_IConfigAsfWriter, (void**)&pProp);
if( hr == S_OK && pProp != NULL )
{
hr = pProp->ConfigureFilterUsingProfile(pProfile);
}
}
}
}
}
|
|
|
|
|
Folks,
I've written a template tokenizer class. (BTW, code and the write-up about this class is posted here http://www.codeproject.com/useritems/TemplateTokenizer.asp[^].) All of the template class' code (declaration and implementation) resides in one *.h file. Everything compiles, links and runs just fine, when the template class header file is #include d only in one *.cpp file. But when the header is included into 2 *.cpp files, I get the linker errors:
ParseCSV2.obj : error LNK2005: "protected: void __thiscall CStringTokenizer<class CStringArray>::Add(char const *)" (?Add@?$CStringTokenizer@VCStringArray@@@@IAEXPBD@Z) already defined in ParseCSV.obj
ParseCSV2.obj : error LNK2005: "protected: void __thiscall CStringTokenizer<class CStringList>::Add(char const *)" (?Add@?$CStringTokenizer@VCStringList@@@@IAEXPBD@Z) already defined in ParseCSV.obj
Debug/ParsingNMEA.exe : fatal error LNK1169: one or more multiply defined symbols found
The header file has both #ifndef and #pragma once
#ifndef STRINGTOKENIZER_H
#define STRINGTOKENIZER_H
#pragma once
[declaration+implementation]
#endif // STRINGTOKENIZER_H
Template class headers contain the implementation. They are included into both descendents. Linker sees this as an error. From the linker's perspective, these errors make sense.
What can I do to fix this problem?
Thanks!
Nick
P.S. It seems like it could be a fairly common problem, but I couldn't find a solution on this forum or on the web.
P.P.S. I'm using VC++ 6
|
|
|
|
|
The functions that are defined in a header file need to be inline .
|
|
|
|
|
Michael Dunn wrote: The functions that are defined in a header file need to be inline.
... only when they are not templates (which seems to be the case looking at the linker error).
|
|
|
|
|
I have added the inline to the function definition. The linker error had disappear, and the project links and runs fine. Thanks! However, doesn't inlining defeat the original intended purpose of the functions (from the 1960s) - to reduce the code size? Does the inlining has a different effect on a template method compared to a non-template method?
|
|
|
|
|
The need for things to be inline is a downside of templates. The C++ FAQ Lite section on templates[^] goes into more detail. And remember, writing "inline" doesn't always make the actual code inline. While you need "inline" in some situations to satisfy the compiler or linker, the optimizer will determine on its own which methods should actually be inlined.
Nick Alexeev wrote: Does the inlining has a different effect on a template method compared to a non-template method?
Well, a template function is not code. When you instantiate a template, the compiler generates code from the template, and at that point it's no different from a non-template method. So the end result is the same.
|
|
|
|
|
I use EnumChildWindow() search for "Edit Control" in target windows.
But I don't know the handle that I get from this function if it belong to "Edit Control" handle.
Anybody know, what's function use for this issue.
|
|
|
|
|
you can call GetClassName and check if the returned class is "EDIT" .
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Try using GetClassName() on each enumerated HWND and look for the class name "EDIT".
Mark
|
|
|
|
|
To add to previous replies, Use GetClassName , and compare if it with WC_EDIT . WC_EDIT is defined as "EDIT".
|
|
|
|
|
Hi.
I'm having problems with CTreeCtrl derived class. I'm trying to set dynamic item height, for each of the items. I've managed to draw the items correctly, but now i encounter hit test issues.
Has anyone done this before ? I'm using VS2005 MFC project.
Thanks,
Chen.
|
|
|
|
|
1 - where is the number that is Recive
2 - How can I access that Number ( Modem)
Thanks
|
|
|
|