|
Again, i say check what Collapse returns, maybe it's something logical, also try setting a range explicitly to 0 to 100 for example just to see if it works that way or not, maybe the provlem lies in the value of lChar or such...
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Hi,
I checked this things... Collapse() returns (HRESULT)S_OK, so no problem there. Also I tried different values, like you said from 0 to 100.
Interesting is, that this is not the only Method that does not work from ITextRange. Some work like GetText() but others don't like ChangeCase(). This really starts bothering me.
But thanks for your interest and help.
|
|
|
|
|
Maybe Rich edit doesn't have those methods implemented and it only returns you S_OK and does nothing, althorough -afaik- the correct thing to do if you don't implement a method of an interface is to return E_NOTIMPL, so maybe it is something different.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Hi,
bad news. Seems the language problem was too big or the description in the MSDN too bad. Anyway collapse does not have the effect I though it would have. I found the following description:
The expand and collapse Methods
The expand method expands a TextRange object to fully encompass a character, a word, a sentence, or the entire text of the text edit owner on which it was created. For example, if the TextRange object spans a portion of a word, calling its expand method with the parameter word causes it to span the entire word. The expand method returns a Boolean value indicating whether the method succeeded.
The collapse method performs the reverse operation, placing the TextRange object's begin and end markers together as an insertion point. An optional parameter determines whether the insertion point is placed at the beginning or end of the current range; the default value is true, which places the insertion point at the beginning.
This means, it only changes the range that is marked and not the text itself. Too bad, this would have been nice and easy. Looks like I have to think about creating OLE objects myself again.
|
|
|
|
|
Think of it this way: now you have the great opportunity to learn about writing OLE objects. Too bad it doesn't work the way we thought it would. I haven't done much COM object implementing either (only a few times here and there), but if you get stuck somewhere feel free to ask, if i can, i will help, and i am sure others here will too. I think that IRichEditOle::InsertObject Method[^] could be a startup point for your "research", good luck.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Hi all,
I am developing a DrawCli like application in which I apply the double buffering using Keith Rule's class CMemDc.
Now the class works meanwhile I use the CView class as base class for my View class. When I use CScrollView I have some problem. Meanwhile I don't use the scrollbar there isn't any problem but when I use the scrollbar The part of the screen the isn't visualized before appears as white before it charges the object on the background so I have a flicker like effect when I scroll the screen.
To solve the problem I have thought to do a two bitmap structure with a bitmap that will contain all the scrollable area and a second bitmap that will contain only the part of the bitmap that will be shown on screen. I think that in theory the solution will work but I'm not able to develop that solution. My problem are:
1- How can I do a bitmap that will containt all the scrollable area?
2- How I have to organize the double bitmap system in order to make it efficient?
(in the article that I have read often to actualize the solution there are reference to cached bitmap should I have to use this solution and if yes how can i do that?)
Hope that I'll be clear thank you in advance for your help
|
|
|
|
|
I am trying to include AddFontResourceEx(Fontname,FR_PRIVATE,0); but get the error message that the function and FR_PRIVATE are undefined. Of course I have wingdi.h in the opening lines :
#define UNICODE // Save as Unicode -Codepage 1200
#include <windows.h>;
#include <wingdi.h>;
The error is produced when I try to compile.
I have added gdi32.lib to the command line.
What am I supposed to do about gdi32.dll ?
Thanks for any help
Raymond Mercier
|
|
|
|
|
Sorry, this failed to appear !
#define UNICODE // Save as Unicode -Codepage 1200
#include <windows.h>
#include <Winbase.h>
#include <WinGDI.h>
|
|
|
|
|
|
Thanks for the tip, but I should have mentioned that I have been compiling with VS 6 with Net Framework 1.1.
Meanwhile I have managed (sort of) with these lines, which do allow me to get the function.
I still fail to see why I have to go through all this, but not for AddFontResource,
and I still have to put 0x10, since FR_PRIVATE is not recognized.
static FARPROC fpAddFontRes,fpRemoveFontRes;
HMODULE hLibrary;
hLibrary=LoadLibraryW(L"gdi32.dll");
fpAddFontRes=GetProcAddress(hLibrary,(LPCSTR)"AddFontResourceExW");
fpRemoveFontRes=GetProcAddress(hLibrary,(LPCSTR)"RemoveFontResourceExW");
.....
nFontLoad=(*fpAddFontRes)(Bact,0x10,0);
At least this works fine !
Raymond Mercier
|
|
|
|
|
RaymondM wrote: Thanks for the tip, but I should have mentioned that I have been compiling with VS 6 with Net Framework 1.1.
My recommendation remains the same. The updated headers are included with the Platform SDK. You can use the Platform SDK with VC6. I have a copy of VC6 installed along-side several versions of the Platform SDK. I can't believe that you went this many years without it.
The LoadLibrary/GetProcAddress technique will also work if you choose to do it that way. But the next time you try to use a new GDI enum/constant or data type you might be back in the same boat.
RaymondM wrote: I still fail to see why I have to go through all this, but not for AddFontResource
AddFontResource[^] was included in the VC6 header distribution. AddFontResourceEx [^]is available in Windows 2000 and above and the header file was updated in the Platform SDK.
The declaration for AddFontResourceEx [^]is preceeded by:
#if (_WIN32_WINNT >= _WIN32_WINNT_WIN2K)
So you would need:
1.) A header file with the AddFontResourceEx declaration.
2.) Declare a windows version greater or equal to _WIN32_WINNT_WIN2K.
Best Wishes,
-David Delaune
modified on Tuesday, January 27, 2009 3:19 AM
|
|
|
|
|
|
RaymondM wrote: I don't know why you think that I do not already have the headers
Because you told me that you were compiling the project with VC6.
RaymondM wrote:
So I only need to add #define _WIN32_WINNT 501 before windows.h, and then I can call the function I need. That is of course the only point that I had overlooked.
Exactly what I stated in my last response. I am happy to hear that you have corrected the problem.
Best Wishes,
-David Delaune
|
|
|
|
|
first, the MSDN about CreateWindow() not mention of close the handle of window it returns.
is it means that we donnot need to care about it?(Sorry about the title if it is true)
second, I test of this in the code like this
HWND hWnd;
unsigned __stdcall SecondThreadFunc( void* pArguments )
{
hWnd = CreateWindow(
L"BUTTON"
,L"dmyWnd"
,WS_DISABLED
,CW_USEDEFAULT
,CW_USEDEFAULT
,0
,0
,NULL
,NULL
,::AfxGetInstanceHandle()
,NULL
);
while( (bRet = GetMessage( &msg, NULL, 0, 0 )) != 0)
{
if (bRet == -1)
{
TRACE(L"[Thread] ERROR\n");
}
else
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
return 0;
}
_beginthreadex( NULL, 0, &SecondThreadFunc, NULL, 0, &threadID );
I try to call
int nRt = ::GetWindowText(hWnd, cs, 256); before and after I
::PostThreadMessage(threadID, WM_QUIT, 0, 0); to end the thread.
The result is sccess when thread alive and invalid handle when thread exit.
I am not sure if this can prove that window handle is be safely closed.Could any one tell me
that is it true "Window Handle from CreateWindow will colse itself when thread exit"
|
|
|
|
|
fitatc wrote: Could any one tell me
that is it true "Window Handle from CreateWindow will colse itself when thread exit"
No, not necessarily - it'll be because the thread's has gone. GetWindowText performs a SendMessage of WM_GETTEXT to the window you want. SendMessage to a window owned by another thread means switching to the thread and calling the window's WndProc. If the thread no longer exists, that's not possible, so the function returns an error.
|
|
|
|
|
To a certain extent windows (HWND s) belong to the thread that created them. For example, the thread that created the window is the thread that pumps its messages. See Thread affinity of user interface objects, part 1: Window handles[^] for deatils. It doesn't make sense to create a window with a thread and then let it outlive its parent thread.
Steve
|
|
|
|
|
Hi,
fitatc wrote:
I am not sure if this can prove that window handle is be safely closed.Could any one tell me
User applications do not manage window handles. To be more specific your application does not create/destroy or manage windows directly. The windows kernel does all of this for you when you request it.
There is a device driver named 'Win32k.sys' which through ntdll.dll creates and manages the window for you. when you make a call to CreateWindow it ultimately passes through VerNtUserCreateWindowEx then ZwUserCreateWindowEx and your window is created. Event messages are then placed in the message que associated with the window. At this point your application can retrieve these messages and react to them.
If you don't understand anything I just said... just remember that you do not need to close window handles.
Best Wishes,
-David Delaune
|
|
|
|
|
Thank you very much, that just the answer what I need!!!
|
|
|
|
|
HI,
I am having a CView which has some controls, i would like my top part(1/3rd portion) of the view to be hidden dynamically when ever i press some button.
How do i go about.
|
|
|
|
|
Hi,
well, I would write a function with
GetDlgItem(IDC_MYCONTROL)->ShowWindow(SW_HIDE); for each of your controls.
That should do what you want.
|
|
|
|
|
HI, thanks for the reply...this would actually just hide the controls, but i would like my bottom part of the view to be shifted to top.....
|
|
|
|
|
Try Splitter windows.. You can get lot of articles in CP..
Selva
|
|
|
|
|
Hi, if your problem is not solved yet have a look at this article[^]
If you combine this with moving your controls with
GetDlgItem(IDC_MYCTRL)->SetWindowPos(); you should be fine.
|
|
|
|
|
Hi,
I want to constuct a data structure with following condition-
The first structure is having 3 element e.g Name1 ,age1 ,roll no1.
The second structure contain the 3 element i.e roll no 1, subject 1
roll no 1, subject 2
roll no 1, subject 3
i.e Roll no may have one or more than one subject associated with it. I want to write a program which will take input as Name,Age, Roll No ,subject(no.of subjects may very).
Then I will take Input from user As Roll No, Query the structure and display name,age and subject/s.
Can you please suggest which data structure (CMAp,CList... etc.) is suatiable for such condition?
Thanks:-
Mike
|
|
|
|
|
Something like:
struct
{
string name;
int age;
int roll;
vector<string> subjects;
};
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|