|
Got the ASSERT to work, needed DEBUG::ASSERT, but doesn't like GetActiveView, says identifier not found. Am calling from a normal function
void Test01(void)
{
// Call is in here
}
The form I'm calling is
public __gc class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
}
public:
void Form1::set_address(char *add)
{
char temp_str[80];
sprintf(temp_str,add);
textBox1->AppendText(temp_str);
}
//Loads of other standard definition and click button stuff
}
Is this a problem of calling managed types from unmanged types?
Its an SDI only.
Dave C
|
|
|
|
|
Hello all,
I am working on an editor that automatically applies some formatting as the user types. Among these operations are syntax highlighting and character string insertions. I am currently using the ITextRange interface to apply syntax highlighting since it has been suggested elsewhere that this is the key to maintaining undo/redo ability in this context. Unfortunately I am not having any luck preserving the undo buffer in any useful state! Does anyone have any experience with this? Is it a matter of grouping operations with the (TextDoc) Begin/EndEditCollection functions? So far they have not yielded their secrets to me either
Any advice would be greatly appreciated!
Thanks,
Jon
|
|
|
|
|
Hi I'm having a lot of problems with mouse events. In an MDI application I have a CDialogBar derived class which needs to keep track of mouse movements in the parent frame. Using the ClassWizard I've added the necessary functions but they don't work. Within the CDialogBar derived class there's a CEdit object. Within the WM_NCMOUSEMOVE event handler the CEdit object has it's window text set to the mouse position. Well nothing happens. The application runs, but for whatever reason the dialog bar doesn't get the non-client mouse move event. I've added handlers for WM_NCLBUTTONDOWN and WM_NCLBUTTONUP but nothing happens.
Can anyone tell me what's going on? How do I make my CDialogBar derived class capture mouse events in the parent frame?
|
|
|
|
|
Have you tried to handle these events in CMainFrame and then let CMainFrame call a user defined function in your derived CDialogBar class?
Rob
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
I just tried that, and it doesn't work. The code compiles, and application runs but the CFrameWnd derived class still doesn't get any mouse events. I also tried OnNcMouseMove(UINT nHitTest, CPoint point) in the dialog bar, but no dice.
I'm at a total loss...there must be something I'm missing. I can email you the project, maybe you can figure it out.
|
|
|
|
|
I would try to handle the WM_MOUSEMOVE event with in CMainFrame or CFrameWnd (SDI or MDI) what ever the case maybe.. You can even try to do TRACE("Mouse Moving\n"); With in a bunch of functions in the MainFrame or ChildFrame classes to see what window is receiving the messages you are looking for.. here is a example of handling the WM_MOUSEMOVE with in CMainFrame class.. note this is by hand, I havent compiled it.
void CMainFrame::OnMouseMove(UINT nFlags, CPoint point)
{
CFrameWnd::OnMouseMove(nFlags, point);
}
Rob
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
I just downloaded the zip and made the adjustments.. I just emailed the project back to you.. Just incase here is the code...
LRESULT CChildView::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
if(message == WM_MOUSEMOVE)
{
CMainFrame* pMain = (CMainFrame*)AfxGetMainWnd();
ASSERT(pMain);
TRACE("Mouse Movement\n");
CPoint point = (CPoint)lParam;
CString str;
str.Format("OnMouseMove at (%d,%d)",point.x,point.y);
pMain->SetMessageText(_T(str));
}
return CWnd ::WindowProc(message, wParam, lParam);
}
Rob
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
I have an application with two panes - a tree view in the left pane and a set of property pages in the right. I can put any value into an edit control from the program but I can't type any entries in from the keyboard. The only key that seems to work is the 'Delete' key in the numeric keypad. The edit control is not read only. I've tried making the edit control a CString, an int and a CEDIT and the result is always the same.
If I put exactly the same code and dialog in a popup dialog instead of a property page it works perfectly
Anybody got any ideas??
Tim
|
|
|
|
|
Just a guess...but maybe it has something to do with the property page capturing the keystroke messages and not passing them onto the edit controls???
Sounds like something that may be in the C++ FAQ...might wanna check it out
Cheers...
How do I print my voice mail?
|
|
|
|
|
Hi,
Please forgive me any redundancy or newbie naivete, but i am having a problem with setting text in a static field in a dialog with the full pathname retrieved by a call to GetPathName() member of the CfileDialog class. Specifically, a path such as:
D:\Program Files\Microsoft Visual Studio\MyProjects\CmodConverter\Debug. It gets truncated to:
D:\Program Files\Microsoft Visual.
I presume this is due to a long-filename issue since d:\celestia\models\cassini.3ds works fine.
Any ideas?
Thanks,
Sean
Firefly, Stargate, Farscape: in that order
|
|
|
|
|
It sounds like you need to make the static control wider.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Hmmm,
It seemed big enough but i did not check it with that big a string - i will experiment further. Also, I was wondering about the backslashes in the path - could an escape sequence be happening? I will fiddle with that notion too...
Thanks for the reply!
Sean
Firefly, Stargate, Farscape: in that order
|
|
|
|
|
smbika wrote:
Also, I was wondering about the backslashes in the path - could an escape sequence be happening?
No, that only applies to string literals in the code.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Thanks again for the help - it was indeed the size of the field, but i did find i had to change the slashes to double slashes or they did not show up - sigh...
I have another problem which i will begn another thread on...
lemme know...
Firefly, Stargate, Farscape: in that order
|
|
|
|
|
darn it - looks like i was wrong about the double slashes too - sokay - as long as it works and i have learned
thanks again and my apologies for the mistake...
Sean
Firefly, Stargate, Farscape: in that order
|
|
|
|
|
Hi,
I am using a frame, which is an inherited class from CFrameWnd, in an
MFC application.
When I open & close the frame, there are few extra GDI objects & User
objects that gets created. That is, when a close is performed, all
those user objects & GDI objects created do not get lost. I am
monitoring this using the Windows Task Manager itself.
Presuming a memory leak, I tried stepping thru the code to notice any
memory leak but that is not reported either...
Can somebody please help me with some pointers regarding this...?
Sailu
|
|
|
|
|
Does it leak the GDI objects everytime you open and close the frame or just the first time. If it is just the first time then it is nothing to worry about and is just MFC keeping handle to things that it will reuse.
If the GDI count keeps going up with repeated open/closes then you do have a probelm.
Mike
|
|
|
|
|
Yes. It indeed keeps going up with repeated open/closes.
Any ideas as to how do I exactly zero-in to the cause...???
-Sailu
Mike Beckerleg wrote:
Does it leak the GDI objects everytime you open and close the frame or just the first time. If it is just the first time then it is nothing to worry about and is just MFC keeping handle to things that it will reuse.
If the GDI count keeps going up with repeated open/closes then you do have a probelm.
Mike
|
|
|
|
|
Try posting some code for us to have a look at.
|
|
|
|
|
p->name is chinese word as
char name[32];
int idname;
m_role_file.FindFirst();
while (m_role_file.FindNext(idname))
{
CRole *p = m_role_file.Find(idname);
HTREEITEM treeitem;
treeitem=tree_ctrl->InsertItem(p->name,p->rolenum+2+6,p->rolenum+2+6,root2);
tree_ctrl->SetItemData(treeitem,ROLE_ITEM+p->rolenum+1);
}
|
|
|
|
|
Hmm...
I can't help you with the problem, because I don't think you've provided enough data. What was the word you tried to add for instance?
But asides from that, considering you are working with chinese words, wouldn't Unicode be better suited for your needs?
"After all it's just text at the end of the day. - Colin Davies
"For example, when a VB programmer comes to my house, they may say 'does your pool need cleaning, sir ?' " - Christian Graus
|
|
|
|
|
Hi,
I have read a lot of articles and "Tips" but nothing couldn't help me. I use the Stringtable for my ToolTipTexts and have a modal DialogBox.
I've the following problem: I nedd ToolTips with more than 80 characters.
---------------------------------------------------
Inside the PreTranslateMessage function I call the RelayEvent function of the CToolTipCtrl-Class and inside the OnInitDiaog i registered and attached a Tool to the created CToolTipCtrl-Object. And I also used the SetMaxTipWidth(). And everything works fine but only with 80(!!) characters.
----------------------------------------------------
Can anybody help me to overcome this problem?
Thank you!
|
|
|
|
|
I am using the procedure "CreateWaitableTimer" in my program. When I try to compile it in VC++ ver 6.0 under windows 2000 ver5, service pack 2, it gives the error "undeclared identifier" inspite of the following:
->The library "kernel32.lib" has been linked in Project Settings.
->The header "winbase.h" has been included.
->The following Macros are defined before including "windows.h".
#if !defined _WIN32_WINDOWS
#define _WIN32_WINDOWS 0x0500
#endif
#if !defined _WIN32_WINNT
#define _WIN32_WINNT 0x0500
#endif
It will be great if anybody can help me to sort out this problem.
Thanks
|
|
|
|
|
sampal wrote:
#if !defined _WIN32_WINDOWS
#define _WIN32_WINDOWS 0x0500
#endif
#if !defined _WIN32_WINNT
#define _WIN32_WINNT 0x0500
#endif
Both of those preprocessor directives already have values so your code is not going to work as expected (i.e., they will only get assigned a value if they do not already have one). Remove the #if directive. Are those statements included before any other #include , not just windows.h ?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
The error continues to appear even after removal of #if. These statements are not included before any #include.
|
|
|
|