|
How i can use CreateMDIWindow(...) in my MFC MDI DOC-VIEW application.
I need create new stream for my new mdi-window.
Thanks
Daniil Ushakov
|
|
|
|
|
Hello.
I have a program running under doc/view single doc architecture. When the user opens a text file, the program displays the data from the text file in its original form. Special thanks to Tychom for the key technique.
When the program first opens the file, it saves data into a CStringList. However, if the user make changes to one or more lines of text, I have not been able to access the updated text.
For example:
Original text:
---
a
b
c
---
Modified text:
---
az
b
cy0
---
I can get the updated text using GetWindowText(), but that function only returns a specific line parallel to the cursor. What if the user add one or more new lines? I have no way to accessing a specific line.
There is a function in CEdit, getline(). The first parameter is the line index. The second is a reference to LPTSTR. I tried to use that function to get a specific line, but the program crashed with an error "bad pointer."
LPTSTR text;
CEditCtrl::getline(1, text); // this program crashes here every time
Is there a way to access a specific line inside CEditView not dependent on where the cursor location?
Thanks,
Kuphryn
|
|
|
|
|
The problem is that your string is not initialized. From MSDN (edited for readability):
<br />
int CEdit::GetLine( int nIndex, LPTSTR lpszBuffer ) const;<br />
int CEdit::GetLine( int nIndex, LPTSTR lpszBuffer, int nMaxLength ) const;<br />
<br />
lpszBuffer - Points to the buffer that receives a copy of the line. The first word of the buffer must specify the maximum number of bytes that can be copied to the buffer.<br />
nMaxLength - GetLine places this value in the first word of lpszBuffer before making the call to Windows.<br />
Allocate memory for your buffer and make sure the length is inserted, and it should work....
/moliate
|
|
|
|
|
Call UpdateData(TRUE); at first.
Regards
http://www.ucancode.net/ (Xtreme Diagram++ Library with full MFC Source Code)
|
|
|
|
|
Thanks!
I have one question.
In the line:
// CString myString;
CEditCtrl::GetLine(1, myString.GetBuffer(255), 255);
Is 255 the maximun number of characters in *that line*?
I would like to get everything on that line.
In general, is the size (255 in this case) referring to bytes or characters (characters * bytes = maxsize?).
Kuphryn
|
|
|
|
|
Hi
Is there any class or template like CArray not written in c++?
I used CArray, but now I need to write an app without MFC support.
If there exists some subtitute for CArray, could you please explain how to use it?`
Thanks in advance
modified 12-Sep-18 21:01pm.
|
|
|
|
|
I think STL will help you. CArray is not the best analog of stl.
And I don anderstand what you mean Gregor S. wrote:
not written in c++?
|
|
|
|
|
Thanks!
My fault, I meant "not written in MFC".
Could you give me a link or tutorial that explains how to use the STL? I never used it before
modified 12-Sep-18 21:01pm.
|
|
|
|
|
There some articles here
http://www.codeproject.com/vcpp/stl/
It is not very difficult to use STL. It has look nearly as MFC Classes such as CArray
|
|
|
|
|
CArray was written as a substitute for vector while waiting for the C++ standard. Here is a link to the first of my STL articles, which covers vector. You'll find the STL is far superior to CArray.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm somewhat suspicious of STL though. My (test,experimental) program worked first time. Whats that all about??!?!
- Jon Hulatt, 22/3/2002
|
|
|
|
|
Christian Graus wrote:
Here is a link to the first of my STL articles, which covers vector
uhhhh where is the link?
Nish
One little CD gone,
Then two CDs gone,
Then 5 more gone,
For a total 7 gones,
If I was a CD R,
I'd wanna cry,
Cause I'd be just a goner,
For a nasty CD burner.
[funny how frustration wakes up the poet in me]
|
|
|
|
|
I dunno - I posted it.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm somewhat suspicious of STL though. My (test,experimental) program worked first time. Whats that all about??!?!
- Jon Hulatt, 22/3/2002
|
|
|
|
|
Christian Graus wrote:
I dunno - I posted it.
Huh? You mean an entire a-href vanished???
Nish
One little CD gone,
Then two CDs gone,
Then 5 more gone,
For a total 7 gones,
If I was a CD R,
I'd wanna cry,
Cause I'd be just a goner,
For a nasty CD burner.
[funny how frustration wakes up the poet in me]
|
|
|
|
|
Well, I typed it in, so I guess so. It probably got typed in wrong, so it's in the page but has not translated to a link.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm somewhat suspicious of STL though. My (test,experimental) program worked first time. Whats that all about??!?!
- Jon Hulatt, 22/3/2002
|
|
|
|
|
Hi there,
I have question about using of an Activex which called Microsoft Coolbar control 6.0
One of a functions in this activex is about setting an image list ...
[ccode]
m_Coolbar.SetRefImageList(LPDISPATCH newValue);
[/ccode]
I can make an image list by CImageList class, but how can i use it in SetRefImageList function ?
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Does anyone know how (if it is possible) to change the client rectangle of a common control (ListBox, EditBox ... etc)? The reason I ask is because I created a skinable scrollbar class and want to add it into the non-client area of an edit box or list box. My thinking is that if I could shrink the client area I could create my new scrollbar window in the non-client space, which would not be painted over.
Any help would be greatly appreciated
|
|
|
|
|
handle the WM_NCCALCSIZE message. Have a look at my article at http://www.codeproject.com/editctrl/fileeditctrl.asp where I used this method to embed a button in an edit control.
HTH
---
CPUA 0x5041
Sonork 100.11743 Chicken Little
It may be that your sole purpose in life is simply to serve as a warning to others.
|
|
|
|
|
Thanks a lot, that did the job. Great article too
|
|
|
|
|
My MenuBar class use the HMENU ant the ::TrackPopupMenu, the problem is not with the HMENU command, is with the ::TrackPopupMenu, i'm writing my own menu class, but this is not a menu, is a window that acts as a menu, and when i use the ::TrackPopupMenu, i get the classic menu made by Windows, how can i make that the ::TrackPopupMenu shows my menu(fakemenu)?.
|
|
|
|
|
I am trying to create a borderless window that will just be display text of statis and will close by itself if statis is positive. The window will only display buttons to handle error and will have another chance to close app. And no taskbar button.
I have VS.NET but using VC++ 6.0 code(Win32API only). I have tried calling CreateWindow() with many different window styles but some work but not like I wanted and others build stops at the end of building and doesn't switch over to debug mode.
Note: if the backgroud was white and I was to run it windows should only paint white over the current screen.
Any help.
Real World Coding:
POP& BuyAPop(Money ADollar){...};
|
|
|
|
|
Omit the border styles (WS_BORDER, WS_THICKFRAME, etc.) and add the extended style WS_EX_TOOLWINDOW.
--Mike--
Actual sign at the laundromat I go to: "No tinting or dying"
Like the Google toolbar? Then check out UltraBar, with more features & customizable search engines!
My really out-of-date homepage
Big fan of Alyson Hannigan and Jamie Salé.
|
|
|
|
|
Thank for reply...
Your reply help up to here...
I changed the style param for CreateWindow() to 0.
I added SetWindowLong(...,GWL_STYLE, 0);
and SetWindowLong(...,GWL_EXSTYLE, 0);
All that has change is I can drag window, curved ends XP titlebar and all borders are gone are gone(or transparent). The only thing is left is the titlebar is still painted and when Debuging and VS.NET is maximized and program is below it
Two thing I can do...
1) I DbClick VS.NET caption and some of my program show but VS.NET UI is not erase from non-client area.
2) I click my program taskbar button and only the client area of appears on top(non-client area seems transparent). This is what I wanted along.
Also I still cant get rid of that taskbar button.
Any more help...
Thanks...
Real World Coding:
POP& BuyAPop(Money ADollar){...};
|
|
|
|
|
Would it be easier to create a hidden parent window and just have the child borderless window display.
Real World Coding:
POP& BuyAPop(Money ADollar){...};
|
|
|
|
|
Use ModifyStyle(..)
Or ModifyStyleEx(..) to change the window style.
Regards
http://www.ucancode.net/
|
|
|
|
|
I'm trying to post a meesage from one class to another, passing a CString value with the message. Currrently, I casting the CString into a LPARAM and passing that. Then in the function that receives the meesage, I'm casting the LPARAM into an LPCTSTR/CString.
The LPARAM value is passed across correctly, but when I recast back to the LPCTSTR, the data is garbage.
Any ideas on what I'm doing wrong?
// posting function
CString myStr = _T("some data");
LPARAM lParam = (LPARAM)myStr;
::PostMessage(HWND_BROADCAST, WMU_MY_MSG, 0, lParam);
// receiving function
LPCTSTR lp = (LPCTSTR)lParam;
lp holds garbage data.
Thanks!
|
|
|
|