|
I have a graph that I am displaying in a CScrollView derived window. I have circles representing the nodes and arrows representing the edges. When I move my cursor over a node, a tooltip appears showing the contents of the node. Sometimes the graph displayed is much bigger than the current view so one has to scroll to see the rest. And now finally for my problem ... After I have scrolled the view and then place my cursor over a node, no tooltip appears. It only appears when I scroll back to the original position the graph was displayed in. I have tried overriding OnVScroll() and OnHScroll(), but then the graph doesn't get drawn properly.
Any help with finding a solution or any ideas will be greatly appreciated.
|
|
|
|
|
I've just started to learn and write distributed application and i want to know what kind of apps work on winNT and not work on win98...
If you can point me to some documentation on the subject please let me know.
|
|
|
|
|
Apps that call methods only NT supports. MSDN alwyas tells you what Windows version is required for a function, if you don't have it on CD, you can go to msdn.microsoft.com
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
I need to check whether the URL is valid or is exist,and return its status code,such as 404 means file not found,and so on. how can I?
thank you for advanced!
|
|
|
|
|
Do you want to write your own webbrowser?
You could handle the "NavigateError" event and browse to your own 404 site.
This works only if IE6 is installed
regards
|
|
|
|
|
I'm writing an SDI application which uses a dialog box to prompt the user. In this dialogbox I have a 2 ComboBoxes which need to be populated with different data every time the dialog is called. I have two problems:
1. This is the major one. Although I get no errors, and I've stepped through the code, the ComboBoxes always remain empty. I've included code at the bottom to show what I'm doing at the moment.
2. This is more a coding design question. Where is the best place to put this code? I can't put it in the Class Constructor because that causes an assertion error (No hWnd?). At the moment I'm trapping the ShowWindow Message and setting a flag to say whether or not I've already added stuff to the ComboBoxes
Any Help would be appreciated,
- X
// Populate Combo Boxes
CComboBox* temp1;
CComboBox* temp2;
int i;
temp1 = (CComboBox *)GetDlgItem(IDC_MEM1); // IDC_MEM1 and 2 are the ID's
temp2 = (CComboBox *)GetDlgItem(IDC_MEM2); // Of the combo boxes
for (i = 0; i < 32; i++) {
temp1->AddString((LPCTSTR)m_pDoc->MemoryLocations[i]);
temp2->AddString((LPCTSTR)m_pDoc->MemoryLocations[i]);
}
|
|
|
|
|
hi..
* the right place to initalise a dialog box would be "WM_INITDIALOG" / "OnInitDialog"... but this function is just called once (like a constructor.. but the HWND is already defined)
(btw.. for deconstruction "WM_DESTROY" / "OnDestry" would be the right place.. there the HWND is still defined)
* to your coding question.. i don't know why this doesn't work.. i use pretty the same code.. i am just using membervars of the type "control".. and this works absolutely fine for me.. the first thing i would look at is, if adding works if you put constant strings in it (like temp->AddString("Hello");)
if this works your m_pDoc->MemoryLocations[i] will not work.
hope i could help you a little bit..
Bernhard
"After twelve years of therapy my psychiatrist said something that brought tears to my eyes. He said, 'No hablo ingles.'" Ronnie Shakes
|
|
|
|
|
First remark: read essay of Joseph Newcomer on this web site under C++/MFC/STL>>General about the use of GetDlgItem. Using MFC the right way doesn't require GetDlgItem calls.
Give a control variable names to your controls:
c_cbxMem1 to IDC_MEM1
c_cbxMem2 to IDC_MEM2
Adding strings to comboboxes is done by:
c_cbxMem1.AddString(sMyString)
But this is not the reason why your code doesn't work. Perhaps you didn't initialize the m_pDoc pointer the right way.
Put the handler to invoke your dialog in the application Document and initialize the member m_pDoc as follows:
...OnMyDialog()
{
CDialog myDlg;
myDlg.m_pDoc = this;
myDlg.DoModal();
...
}
and if your strings in the application document are intialized correctly the AddString() function in the comboboxes should work fine.
I hope this will help.
|
|
|
|
|
Just a wild stab-in-the dark, but when i first used combo boxes, they always appeared empty to me.
Then I finally twigged that you have to drag out the size of the dropped down list in the dialog editor. i hadn't done this, and my dropped down list was so small it appeared empty.
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
Hello All,
Forgive me if this isn't the right place to post this, but I'm new to this community.
As the subject reads, I would like to pass a ponter to a function as an argument to another function. I'm pretty comfortable with that, but here's the catch: the function is a an method of an object.
Is this possible?
Any suggestions pointning me in the right direction would be apreciated.
Thanks in advance,
mark
|
|
|
|
|
Unless its a static function , you will get errors as there is no this pointer . Therefore you either pass an object , or pass a pointer to a static function.
|
|
|
|
|
The syntax for at typedef of a pointer to a member is:
(a member of CMyClass returning an int and taking a long and a void* as arguments, just an example)
typedef int (CMyClass::* LPFNMYCLASSMEMBER)(long, void*);
...
bool YourFunction(LPFNMYCLASSMEMBER pfnMember)
{
...
CMyClass* pClass = something;
int iRetVal = pClass->*pfnMember(aLongParam, aVoidPtrParam);
...
}
As I have shown you will have to have a valid object on which you can call the member function (unless it's a static member function which has no this pointer). So you cannot use non-static member functions as callbacks, for instance.
Cheers
Steen.
"To claim that computer games influence children is rediculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
Thank you Steen (and Andrew).
I'll let you know how it works out when I try to implement it.
However, could you pleas explain what you mean about "...non-static member functions as callbacks?"
thx,
mark
|
|
|
|
|
A good example is for timers (this is not what you want to do, but it illustrates the problem).
class CTestClass
{
public:
int ANonStaticMember(void* pData);
static int AStaticMember(void* pData);
CString m_csNonStaticData;
static CString m_csStaticData;
}
CString CTestClass::m_csStaticData = "";
int CTestClass::ANonStaticMember (void* pData)
{
m_csNonStaticData = *(CString*)pData;
m_csStaticData = *(CString*)pData;
}
int CTestClass::AStaticMember (void* pData)
{
m_csStaticData = *(CString*)pData;
}
void Foo()
{
SetTimer(NULL, 1000, &CTestClass::AStaticMember);
SetTimer(NULL, 1000, &CTetsClass::ANonStaticMember);
}
The above code will probably not compile, but I hope you get the idea. The key issue here is that a non-static member function is passed a pointer to the object on which it should act (the this pointer) as it first (and hidden) parameter. The function using the callback function will have to know what object to call the function on to be useful.
But I guess, if you pass a pointer to a non-static member function as a callback to a function you write yourself, and if you in that function calls the callback function on a valid object, it could be OK. Didn't think of that.
Cheers
Steen.
"To claim that computer games influence children is rediculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
Thanks for the example-that makes sense.
"...and if you in that function calls the callback function on a valid object, it could be OK. Didn't think of that."
This is probably what I will do for what I'm working on, but it is very good to know that non-static calback wouldn't otherwise work.
--mark
|
|
|
|
|
Might you know why I'm getting an error message like:"term does not evaluate to a function?"
typedef void (BinarySearchTree::*BSTmemptr) (const &int);
main()
{
BinarySearchTree<int,string> t(error); //intitializes a BST
BSTmemptr fnc; //declare pointer to member funct
fnc=BinarySearchTree::remove; //assign funct to pointer
t.*fnc(9); //attempt to call funct--error is for this line
//....
//....
}
thanx again.
|
|
|
|
|
Operator preceedence. Evaluation of the function operator "()" goes before evaluation of ".*". Put t.*fnc in paranthesis and everything works:
fnc=BinarySearchTree::remove;
(t*.fnc)();
For reference, search VC++ docs at MSDN Lib for "pointer to member", see the article "Expressions with Pointer-to-Member Operators".
Cheers
Steen.
"To claim that computer games influence children is rediculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
Once again, you're right.
Thank you for your patience--it's is sincerely appreciated. I'll also refer to the article.
How long have you been coding for?
|
|
|
|
|
Around 15 years. If interested you can see check my profile (just click on the little head next to my name).
Cheers
Steen.
"To claim that computer games influence children is rediculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
I Tried to do what I have with success done with a normal program, to put resources in dll files.
I've done everything accordning to "Q198846-HOWTO: Create Localized Resource DLLs for MFC Application".
However, in a ActiveX this doesn't seem to work.
First problem is when compiling the ResourceDll.
It complains that the file "MyOcx.tlb" can't be found, thats not odd, since it hasn't been created yet.
//from the MyOcx.rc file
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
//1 TYPELIB "MyOcx.tlb"
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
So I snuffed it out and tried, and it compiled. Well that won't probably work later, but i kept trying.
I Compiled the MyOcx and it worked, until it tries to register the ActiveX Control. Then regsvr32 asserts, so it cant be registered.
I presume it's either the preprocessor def AFX_RESOURCE_DLL or the LoadLibrary i make that crashes it.
So now my question is, can I, in any way, add multilanguage support to my ActiveX, or do I have to think in a totally diffrent way and maybe use plain old textfiles for language files.
TIA
Fredrik Sigbjörn
|
|
|
|
|
Hi,
I recently discovered the CTabCtrlSSL demo on this site (http://www.codeproject.com/tabctrl/ctabctrlssl.asp) and this was exactly what I needed for my problem... but still not completely.
In my program I had the situation in which I have one dialog showing up on 2 places: once as a stand alone modal dialog and once within a tab control as a sheet of the tab control. In situation 1 I need to show the title bar, in the second case I need to hide it. (I created the dialog in the resource as a title-bar-less dialog)
The problem is that I don't know how to do this in an easy way. I figured out it's got something to do with the CreateEx function, but how do I fit all this inside the dlg-framework??
Thanx,
Dave
Structured programming vs. chaotic mind boggling
|
|
|
|
|
How does it work ? (in relation to TCP/IP )
and how||where do I alter it ?
Thanks for your time
Regardz
Colin J Davies
|
|
|
|
|
Hi,
I'm capturing the mouse with "SetCapture()" and then process the mouse movement in OnMouseMove(UINT nFlags, CPoint point).
The problem is that every time I get outside of my dialog window, the OnMouseMove routine isn't called anymore. How come
My project is a dialog based application and I remember not having this problem with a non-dialog based application.
Also how can I make my cursor invisible?
Any idea??
Thanks
|
|
|
|
|
I think non-dialog and dialog based applications have the same problem. Because once the mouse move outside a window, the mouse messages won't be sent to the window unless a mouse button has been pressed down. It is capable even to the window used "SetCapture()". Sorry but it's out of my reach to solve this problem. But you can use the sentence "::SetCursor(::LoadCursor(NULL,NULL));" to make your cursor invisble and use the sentence "::SetCursor(::LoadCursor(NULL,IDC_ARROW));" to restore it. And, you can always use GetCursorPos() function to retrieve the mouse cursor's current position.
Hope it can help you.
Law is meaningless without chaos.
Chaos without Law is equal to destruction.
Chaos and Law create our rich and colorful world.
|
|
|
|
|
Yes, your are right, I noticed that it has nothing to do with dialog/non-dialog based application. It just happened that in one I used the mouse capture while the mouse button was down...
Thanks again for your help
|
|
|
|