GetSel/SetSel problem on CEdit-derived class

I have a subclass of CEdit, which there are a overidden
SetWindowText(...) method.


void CMyEdit::SetWindowText(LPCTSTR lpszString)
{
          ...

      CEdit::SetSel(0, 7);

      int s1, s2;
      CEdit::GetSel(s1, s2);

          ...
}

What I expect is that the GetSel will return same values as parameters
in SetSel.
However, if there is a selection before CMyEdit::SetWindowText is
called, regardless what number of selection will be set, the GetSel
won't return the expected number.
In the other hand, if there is no selection before
CMyEdit::SetWindowText is called, everything works fine.

0
tchochai (1)
5/15/2006 7:33:47 AM
vc.mfc 33608 articles. 0 followers. Follow

1 Replies
1066 Views

Similar Articles

[PageSpeed] 31

I couldn't reproduce your problem.  It gave me the correct numbers.

BEGIN_MESSAGE_MAP(CMyEditCtrl, CEdit)
   ON_MESSAGE(WM_SETTEXT,OnSetText)
END_MESSAGE_MAP()

// CMyEditCtrl message handlers

LRESULT CMyEditCtrl::OnSetText(WPARAM wParam,LPARAM lParam)
{
   LRESULT Result = Default();

    //just testing
   SetSel(0,7,FALSE);
   int Start,End;
   GetSel(Start,End);

   return Result;
}

AliR.

<tchochai@hotmail.com> wrote in message
news:1147678427.828262.267850@j55g2000cwa.googlegroups.com...
> I have a subclass of CEdit, which there are a overidden
> SetWindowText(...) method.
>
>
> void CMyEdit::SetWindowText(LPCTSTR lpszString)
> {
>           ...
>
>       CEdit::SetSel(0, 7);
>
>       int s1, s2;
>       CEdit::GetSel(s1, s2);
>
>           ...
> }
>
> What I expect is that the GetSel will return same values as parameters
> in SetSel.
> However, if there is a selection before CMyEdit::SetWindowText is
> called, regardless what number of selection will be set, the GetSel
> won't return the expected number.
> In the other hand, if there is no selection before
> CMyEdit::SetWindowText is called, everything works fine.
>


0
AliR3470 (3235)
5/15/2006 4:14:53 PM
Reply:

Similar Artilces:

Report Problem with Access 2007
I have a report that I created with Access 2003 that is 8 1/2 x 3 1/2 inches. It worked great in Access 2003, but in Access 2007 it prints the 1st page ok (info centered where I want it), but prints the info on the 2nd page moved to the top of the page (almost like there is no margin). The strange thing is that after the bad 2nd page, all other pages print just fine.?.? The pages selected to print are entered in a range from a query. Thanks WWV ...

Shadow Copy problem
I am running CRM 1.2 on sbs2k3. Shadow copy isnt working because of the SQL server running on the same SBS machine. Does anyone know how to fix this? repost to microsoft.public.windows.server.sbs "Jeremiah" <anonymous@discussions.microsoft.com> wrote in message news:216a01c427a6$f71a0af0$a601280a@phx.gbl... > I am running CRM 1.2 on sbs2k3. Shadow copy isnt working > because of the SQL server running on the same SBS > machine. Does anyone know how to fix this? ...

Function problem
Please help.I am new to VBA. I want to create a public function and embed it in my startup splash form that quits the application if date() > mydate unless a user puts in a value(input box in the function will take this value and assign it to a variable). Please help. hi, niclive@gmail.com wrote: > Please help.I am new to VBA. > I want to create a public function and embed it in my startup splash > form that quits the application if date() > mydate unless a user puts > in a value(input box in the function will take this value and assign > it to a variable). Public S...

Problem with sending PO as PDF
I have one user who all of a sudden is not able to email Purchase Orders as PDF. He can do it as text. He can send other reports (such as Service calls) as PDF. All other users can do it either as text or PDF The client is Outlook 2003 and the full Adobe PDF package is installed. Any ideas? TIA What version of GP are you using? What version of Adobe? "Jeff Metcalf" wrote: > I have one user who all of a sudden is not able to email Purchase Orders as > PDF. > He can do it as text. > He can send other reports (such as Service calls) as PDF. > All other users can ...

Boot problem
After installing and removing the program "Paragon Partition manager 10.0 Personal" I got a hold-up in the PC upstart. In Dos booting I see now a black page with a text message lines: drive 0 : primary 00 Vista/2008/7 NTFS and primary 00 Linux. Insert startup disk in floppy drive and press F2 to run setup. By pressing "enter" Windows 7 Professional starts and runs further normally. Is there any suggestion to remove this startup page Search for EasyBCD.exe and download and run it. You will be presented with options to edit/modify your boot condition...

outgoing SMTP problem
I have a test Exchange 2003 server, running on Windows 2003 server with a weird problem. There have been instances of this server sending multiple copies of files that have large attachments, something that has been seen on another similar instance on Exchange 2003. However my current problem is that all outgoing SMTP queues are clear within Exchange manager. The C:\Program Files\Exchsrvr\Mailroot\Vsi 1 subdirectories are all empty, Yet if I stop and start the SMTP service - either with Exchange System manager or directly via services then the server forms an SMTP connection with ...

Exel Problems!
Any help with my 2 problems would be much appreciated. 1) I have selected 'wrap text' format for a number of cells - however the text is not wrapping and does not display. The cell does not extend and the text cannot be seen. 2) I have saved my spreadsheet with another one open - now I have 'Links' to other pages. When I open the spreadsheet I get a message notifying me of this. I have gone to the Edit - Links option - which lets me see the links. However I really want to delete them. Cheers, Phil Hi 2): goto: http://oaltd.co.uk/MVP/Default.htm and search for Findlin...

Problem with OnActivateView
Hi all... This is a MDI Application in Visual C++ 6.0 When a user open more than one document of the same template, the Window menu is filled with all opened documents, giving the chance to make active any document the user wants (to make it on top of the other documents). When that action occurs, depending on which document view was activated, a CTreeCtrl node has to be selected (this tree control is in a dialog bar). To accomplish it, I used OnActivateView so that when the view get activated, OnActivateView selects the tree control node if bActivate parameters is TRUE. Well.. all works p...

tough IF problem
I download a file into excel & have to deal with the fact that it does not come out in a particular order. So I have data as: B1 C1 D1 E1 410 410-xxx data Result My formula states =IF(LEFT(C1,3)=RIGHT(B1,3),E1,"") and I get the answer "Result" However, the download also places info as follows: B1 C1 D1 E1 A222XXX HF01 Result 6.5 I have done an interim fix which will result in a long winded route of getting all the "Results" in 1 column but is there any way of having a single cell formula that will pick up both "Results" w...

Excel Problem
I have a 23.8 meg excel 2000 spreadsheet set for manual calculation saved to my local hard drive. Every time I try to open it, it takes forver and sometimes never opens but I do not get any error messages, let me just tell you that I am running a P4, 1 GB memory, Office 2K with SP3, and nothing else running when I try to open it. As I said it is set for manual calculation, and it is cleared to not auto calculate when opening or closing. Any idea's as to why this is happening? -- Todd I don't know why you're having this problem but I would like to point something out for w...

do i have a problem??
A few weeks ago my exchange 2003 server started messing me around. I posted here and got a few pieces of help, but I think that I fixed that issues by applying several exchange specific patches, then server 2003 SP1, then enabling the directory filtering and the tarpit with a 5 second timeout. The box has stopped crashing (previously it would stop delivering main to the mailboxes, filling up the queues with many thousands of messages) Now I have a new problem. In the last week I have started getting memory errors from the system notification. I found a previous posting that offered u...

IE8
Hi I am having problems using IE8 on XP SP3. Basically the browser is unresponsive regularly, hangs regularly on exit (especially after downloads and multi-tabbing). Poor performance at times as well. I am a little dissapointed I must say. For example, I can no longer browse to CodePlex - HTTP Status is: 400 Bad Request. I know it's the browser because none of these problems happen whatsoever when using Firefox. I have tried clearing all History and temp files, cookies etc.... no effect. Perhaps in the next service pack someone can sort this out once and for all. ...

Open relay problem
We are running Exchange 5.5 SP4 on NT4SP6 with GFI mail essential 3.3. Our server is sending hundreds of spam mails everyday using our domain name. I followed the advise from TechNet to tick the following check boxes on connections in IMS properties; 1. Hosts and clients that successfully authenticate. 2. Hosts and clients with these IP_addresses Our server is still sending hundreds of spam. Can anybody help? try unchecking the authentication checkbox, spammers might use an account on your server to authenticate and send mail Gyula Karakas orf support www.vamsoft.com/orf "C...

Excel 2003 Problems with charting
Has anyone come across the following problem with Excel 2003. I am using Pivot charts and they work fine in Excel 2000. But in 2003 the stacked columns lose their colour or don't colour in properly. Also if I add a gradient background it produces a very odd appearance. Is this a known Bug? If so is there a fix? I don't see any problem with the colour in Excel 2003 pivot charts, compared to earlier versions. You could check the printer manufacturer's web site, and download the latest copy of the print driver for your operating system. For example, if for an HP printer, check he...

Help needed with form problem
Workbook contains several forms of varying style and function. One form shows the results of 10 recent tests in a countdown fashion, showing just the results of one test, followed by a one-second delay, followed by just the results of the second test, and so on until the result of each of the 10 tests has been shown. Then the program proceeds on to the next step by calling up a different form. The problem . . . Sometimes when the program starts running one or two of the forms are blanked out ("white" with just the top header showing). The forms continue to function within the ...

Combo Box Sorting Problem
Hello experts, My report deals with data for wells. I have a combo box where the user will choose the name of the well, then it will display the appropriate report. It works great. However, the list in teh combo box shows as follows: paramount 1 denver Atlas Bailey 1 Bailey 5 Bell 10 Bell 12 Bell 14 Bell 17 Bell 2 Bell 5 Bell 6 Borie 1 BELMOT 1 BELMOT 12 BELMOT 2 BELMOT 3 Obviously, the issues are: upper/lower case not consistent; the numbers next to names are not sorted properly. Is there a code that would allow no case sensitivity and sort names with numbers appropriately? I a...

Problems with excel please help
I am new to excel and can't find an answer to my problem i'm sure its easy. I have a cell/field with about 100 numbers in which i want to copy which ive done and then multply it by 100 and display the result automaticallyhow can this be done. If you just want to multiply cell A1 by 100 and put the result in B1, you need the following equation in B1 =A1*100 "Paul Moseley" wrote: > I am new to excel and can't find an answer to my problem i'm sure its > easy. I have a cell/field with about 100 numbers in which i want to > copy which ive done and then multp...

commandbar problems
On My PC with Excel 2000, I have developed an Excel workbook with a custom command bar. The resulting 'xls' file is in a folder on our network and available to everyone in our company. When opening this Excel workbook on other PCs in my office with Excel 2003 or Excel 2000, the custom command bar is missing some of the controls and appears to be an older version of the one that shows on my own PC where the command bar was created and where any modifications are performed. I believe the problem is related to the command bars being stored locally along with the Excel applicatio...

Vista Bussines and Framwork CRM Install Problem
hi i try to install the crm 3.0 outlook client on my vista bussines (last update)but it will not work ,setup says framwork 1 or 1.1 is need but i have install framwork 3.0. i try deinstall framwork 3 and reistall but not work. cd relase is x13-09468 thx for help You need to install the .NET Framework 1.1 (As MS Dynamics CRM uses .NET 1.1) and you probably want to check on .NET 2.0 as well. -- Anne Stanton, MBSCP-CRM President, The Norwich Group Principal, GlobalBrain LLC The CRM Lady at www.CRMLady.com ----------------------------------------------------------------------------------...

WM_MOUSEWHEEL problem!
I created a window as following /////////////////////code m_pSecondWnd = new CWnd; m_pSecondWnd->Create (m_lpszSecondClassName, NULL,WS_CHILD | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL, CRect (0,0,0,0),this, 1005); OldProc = (WNDPROC)::GetWindowLong(m_pSecondWnd->m_hWnd, GWL_WNDPROC); ::SetWindowLong (m_pSecondWnd->m_hWnd, GWL_WNDPROC, (long)ScrollProc); /////////////////////code ends However, I cannot catch the WM_MOUSEWHEEL message in the ScrollProc. Why? No one know this? Please google the 100,000 or so web pages on making good newsgroup posts. -- - Mark...

(CStringList)...folder_list.Find(...) problem.
Hello all, I hope this is in the right place this time.... MFC. I am trying to create a basic app with a treeview control that displays just the folders of the hard drive... This part i have achieved but with bugs (sort of) so far i have only been iterating through the HDD contents with a simple while loop but i really need to test against the drives contents - so i don't repeat the folders in my list - It displays about 50 Windows and Westwood Folders at the end of the list. Im trying to use: <CStringList variable>.Find(.....); to test weather or not the folder that is abou...

link viewer problem
First off - I am running Excel 2000. I have a workbook that has several sheets. On one sheet when I click an icon that is linked to a file on my hard drive it opens the right viewer (ACDSee). On another sheet it opens the wrong viewer(Paint Shop Pro). I have checked file associations in ACDSee, Paint Shop Pro, and Windows Explorer/ folder options/ file types. Any suggestions would be greatly appreciated as I have about 1000 links to do. Thanks in advance, Carol ...

Problems creating my own AFX_MODULE_STATE for multiple gui threads
I'm trying to convert a single gui threaded application to use multiple threads (one for each main window). I've created my own CWinThread subclass and use that to spawn new gui threads. Everything runs properly until I try to shut down my applications and close my threads -- various asserts start to fire. The shutdown of a gui thread invokes the function AfxEndThread which will call AfxOleTermOrFreeLib, which eventually calls COleObjectFactory::RevokeAll, and here is my problem. RevokeAll will go through all the class factory objects registered in the module state's m_factoryL...

Problem with first page of tabbed form
The second and third pages of my form work fine. No matter what I put on the first page it takes up the entire screen when viewed, with no tabs visible. I'm carefully avoiding puting the controls on the main form -- I put them within the black box that appears when the tab is clicked. If I leave the first page blank the other pages work well. If I move the second page up to the top of the page order, I have the same problem -- the form tabs no longer show. How can the same page work correctly when it is in the number 2 position and not when it is in the number 1 position? What a...

Performance problems
Hi! We are experiencing a lot of problems when user jump between mails and opening attachments. It can take up to a minute to open an attachment (.doc, ..xls, .pdf etc.) on the LAN (100 mbit). The server is not using much processor (10-20%) and no cpu queues or nothing. The RPC ops /sec is peaking to 818 and averages to about 80%sec. Is this much? I cannot see why it would do this since it's not "doing" anything more at theese times. We have about 160 accounts/mailboxes on this IBM x225 with 1 x 2.67 Ghz Proc and 2.5 GB memory (uses 1,8) Here are the Perfmon for it. Plea...