|
<<< In the name of GOD >>>
Hi all.
I want to get ID of object that we are in that(Focus).
For example if i am in Edit Box, this function should return ID of
Edit Box ...
OK ???
Hadi Rezaie
|
|
|
|
|
First you have to get a pointer to the control having input focus. I assume you need the id from the dlg control or parent of all child controls.
//Step 1
static CWnd* CWnd::GetFocus ()
//Step 2
After getting the pointer to the control having input focus call
CWnd::GetDlgCtrlID
this function will return you the window or control identifier value for any child window.
here is an example which can be used from a dlg
CWnd * pWnd = GetFocus ();
int iID = p -> GetDlgCtrlID ();
I hope this helps.
www.geocities.com/ton_soft
|
|
|
|
|
Thanks a looooooot.
Hadi Rezaie
|
|
|
|
|
Hi, Just wondering if anyone can give me some hints on how to
display a pop-up tool tip message when the user moves the mouse
over an instance of a custom class derived from CObject, drawn
within the main window of an SDI app.?
Thanks
|
|
|
|
|
Since your class isn't derived from CWnd, it doesn't receive window messages (like WM_MOUSEENTER, WM_MOUSEMOVE, etc.) Here's a simple-minded solution that
you can quickly implement.
1 Add a bool isPtInObject (CPoint pt) method to your class, which returns
true if pt is contained within the bounds of the object. This method
should be as fast as possible.
2 Override WM_MOUSEMOVE in your view class (SDI/MDI doesn't matter) and
call isPtInObject() for each object contained in the view. If the
method returns true, display the popup window.
You'll need to keep track of the object that caused the previous popup (if
any to be displayed). If that object is not null, it means you need to kill
the previously displayed popup window, if any.
/ravi
"There is always one more bug..."
ravib@ravib.com
www.ravib.com
|
|
|
|
|
Thanks Ravi, I've already implemented the methods to determine when
the cursor is over the objects. I just need to know how to display
the tool tips.
Thanks.
|
|
|
|
|
|
Although I try to be helpful in this forum, in this case I doubt I am medically qualified to assist you....
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
Does any know how to write a cd burning software or have any idea, library to get me start.
SpitFire
|
|
|
|
|
|
Hello,
I'm looking for an easy way to create a virtual directory in IIS via an application written in Visual C++. I know that the Internet Service Manager (HTML version) is using IIS Admin Objects via ADSI, but where can I find some info of how I can use those objects.
Is this method compatible with both IIS 4 and 5? If not what is the best way to go about this?
Best regards,
Philip
|
|
|
|
|
Hi,
I need a simple and small class that I can serialize to disk (using fstream in binary mode). In the class I have a Standard C++ library string member, but after pumping objects of this class to disk I lost the string value on reading back. The class is something like this;
class Person
{
public:
string sName; (private or not doesn't matter)
int nAge;
Person(const string&Name, int nAgeOfPerson);
string GetName() {return sName;};
int GetAge() {return nAge};
}
and the ctor,
Person(const string&Name, int nAgeOfPerson)
{
sName = Name; //tried both, don't work.
sName = Name.substr(); //using initializing list also not!
nAge = nAgeOfPerson;
}
For my class, sizeof tell me the object is alway and only 28 bytes, even when the name is 29 characters long. I have no problem getting the age back. I guess when I write out to the file the name characters were somehow lost. I want to use Standard C++ Lib and using string but I don't know enough .
If I go back the old way using a char szName[50], for example, then everything is OK. But I really don't want to assign 50 bytes for every attribute in the class (small is beautiful for me here). Can someone tell me it is possible to force a value into the string member sName?
I am not sure if I make the point clear. Thanks in advance.
Will
|
|
|
|
|
The problem is that string stores the string you allocated on the heap, not within the class itself. The class only has a pointer to the string, thus when you write the binary contents of the class (including the string) to disk it saves the pointer to string as it exists right now, but when you reload that data, that data doesn't exist anymore, and thus the pointer is pointing off into nowhere.
What you are doing is called "bitwise" persistance, which means it saves the data bit for bit. What you want is called "deep" persistance. And to do this, you have to develop a mechanism to differentiate different types of data in your persistance file.
The easiest way to do this is to store the data as text, using the insertion operators of fstream:
(assumes using namespace std)
void person::opersist(fstream& out)
{
out << sName << endl << nAgeOfPerson << endl;
}
void person::ipersis(fstream& in)
{
in >> sName >> nAgeOfPerson;
}
|
|
|
|
|
i think u r taking in wrong way.
I have to read and write on the contents tab(which appears when u rigth click on any word file and select the properties).i am able to read and write rest all the tabs like (General,Summary,Statstic and custom) but not on contents. I am using IPropertySetStorage. the code i am using is given below please suggest some solution.........
Pankaj Mongia
|
|
|
|
|
Hello,
I created a listbox in a dialog-based application. I already changed (programmatically) the background color of the listbox, and also the text color of its items. But now, I would like to change the highlite color from the default windows color (blue). I would appreciate any help or ideas.
Thank you.
-Jake
|
|
|
|
|
|
Not an easy job. You'll have to create an owner drawn listbox and handle all the drawing and highligting yourself.
|
|
|
|
|
Give me a yell in a week or so to remind me to post my over-blown CListCtrl class. It's abhorantly huge and bloated but has most of the tricks you would ever need to work with a CListCtrl (and works with pre 4.71 common controls DLL).
cheers,
Chris Maunder
|
|
|
|
|
See http://www.codeproject.com/combobox/disableditemslistbox.asp as a starting point. You can ignore the "is disabled" logic and do your custom handling of WM_DRAWITEM, depending on whether the item is selected.
/ravi
"There is always one more bug..."
ravib@ravib.com
www.ravib.com
|
|
|
|
|
We have developed a COM object in VC++ and the graphical interface in VB.
We have defined in VB a variant array where will be stored the value returned by a VC++ function which is also a Variant.
The problem is that we get a “Type mismatch” error when an empty value is returned.
Can anybody help us? How would you do it?
Below you can find our code:
VB code
Dim MyArray() As Variant
MyArray = COMObject.MyFunctionInVC(CLng(IntData), IntData)
VC code
VARIANT MyClass::MyFunctionInVC (long ldata, SHORT ndata)
{
VARIANT vaResult;
VariantInit(&vaResult);
If (conditions)
{
……………
while (more conditions){
COleVariant vOle(csline, VT_BSTR);
safRet.PutElement(index, &vOle);
index[0]++;
}
vaResult=safRet.Detach();
}
else
{
COleVariant vOle("", VT_BSTR);
vaResult=vOle.Detach();
}
return vaResult;
}
|
|
|
|
|
ewhh.. that's just nasty.
C++ COM methods return HRESULT not VARIANT. If you want to return a variant array to your VB code, then you will need to define your method like the following:
IDL:
interface IMyClass : IDispatch
{
[id(1), helpstring("method MyFunctionInVC")] HRESULT MyFunctionInVC([in]long lngData, [in]short nData, [out,retval] VARIANT** ppVariantArray);
};
C++ Code:
STDMETHODIMP CMyClass::MyFunctionInVC(long lngData, short nData, VARIANT **ppVariantArray)
{
return S_OK;
}
|
|
|
|
|
Does anybody know how to alter the size of a Floating control window.
The obvious MoveWindow and SetWindowPos have no effect.
TIA
Norm
|
|
|
|
|
Silly suggestion time.
Have you tried MoveWindow() and then watched to see if the window received the
events and then ignored them. Some time ago (year or more) I had to deal with
a toolbar problem that MFC didn't handle. Turned out it was a nightmare because
MFC had all sorts of code that made blanket assumptions about behaviour and
forced certain things to happen even if you were trying to do the opposite.
Positioning and sizing problems were the main issue. I don't know if this
helps, but maybe it'll give you a pointer to find which part of MFC is ruining
your day. Try looking for WindowSizing and WindowSized events.
All that said, I like MFC, up to a point.
Stephen Kellett
|
|
|
|
|
I've got the pointer to the CMiniDockFrameWnd after the window was floated. Somewhere in the bowels of MFC, the window refuses to size after movewindow and setwindowpos have been thrown at it, its very hard to step thru the code, resize caused the code to fly everwhere.
The reason behind the question is that I want to roll out the sliding docking windows seen in Visual Studio.Net.
Anway back to operating on the bowels of MFC...
|
|
|
|
|
Dear all,
I am having some problem to use the AVICap macros provided by Windows. I am writing an application to constantly (say 1 second) grab an image from the web camera and save it as an bitmap file. I used capFileSaveDIB() to save the image captured into the bitmap file. The program works fine when it is the active window (running at the foreground). If the application is minimized, or covered by another application, which means the preview window is invisible, then, capFileSaveDIB() will not save the current image to the file.
Can anybody help me on this? Should I use capFileSaveDIB() for this? Or any setting that I have forgotten?
Thanks
Yong Haur
|
|
|
|