|
Daniel Turini wrote:
it's the VC STL documentation that sucks!
I second that
Cheers,Joao Vaz
And if your dream is to care for your family, to put food on the table, to provide them with an education and a good home, then maybe suffering through an endless, pointless, boring job will seem to have purpose. And you will realize how even a rock can change the world, simply by remaining obstinately stationary.-Shog9
Remember just because a good thing comes to an end, doesn't mean that the next one can't be better.-Chris Meech
|
|
|
|
|
Hi.
Is it possible for me to use CSplitterWnd class in My ActiveX object or Dialog box .Can i use any oter method to achive a Normal SplitterWindow like view in my activeX control; or Dialog box. So that i hav a Left view & Right View
the left view may contain few controls and the rightView too, and i must manage all these controls position when i move the splitter.
Please do a reply as early as possible
regds..
Jibesh.V.P
Jibesh.V.P.
India
|
|
|
|
|
|
This link shows the method of using CDoument and CView in a Dialogbased application .
http://www.codeguru.com/dialog/vwindlg.html
When i tried the same Procedured in my Active -X there is a Excpetion in Assiging CDocument class to the CCreateContext member variable.
how can i perfor that in my ActiveX
Jibesh...
|
|
|
|
|
I have two files:
a.txt:
20020102,23.0
20020103,23.0
.............
20021220,23.5
b.txt:
20010101,22
20010102,25
...........
20010301,35
Now I want to append the lastest datas of the file "a.txt" to the file "b.txt". How could I do ! Please tell me the easy way to do it! Thanks a lot!
|
|
|
|
|
You can do somethig like that:
<br />
FILE* m_pFile1;<br />
FILE* m_pFile2;<br />
<br />
m_pFile1 = fopen("a.txt","r");
m_pFile2 = fopen("b.txt","a");
<br />
char Dummy;<br />
while (!feof(m_pFile1))<br />
{<br />
Dummy = fgetc(m_pFile1);<br />
fputc(Dummy,m_pFile2);<br />
}<br />
|
|
|
|
|
Don't be rediculous,
fgetc & fputc? Reading & writing file by character....
LPTSTR lpBuf;
DWORD dwRead, numChars;
HANDLE hFile = CreateFile(fileNameA, GENERIC_READ,0,0,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0);
if ( hFile != INVALID_HANDLE_VALUE)
{
numChars = GetFileSize(hFile,0);
if ( numChars )
{
lpBuf = new char[numChars+1]
::ReadFile(hFile, lpBuf, numChars +1, &dwRead, NULL);
HANDLE hFileB = CreateFile(fileNameB, GENERIC_WRITE,0,0,OPEN_ALWAYS,FILE_ATTRIBUTE_NORMAL,0);
if ( hFileB != INVALID_HANDLE_VALUE)
{
::SetFilePointer(0, 0, FILE_END);
::WriteFile(hFileB, lpBuf, numChars, &dwRead, NULL);
CloseHandle(hFileB);
}
CloseHandle(hFile);
}
}
|
|
|
|
|
Oh , the spelling mistake. the lastest should be "latest"
The focus is: I want appending the "latest" datas of aa.txt to the file bb.txt
The latest datas in the file aa.txt are the datas that are not included in the file bb.txt.
Note: i only want to append the datas that the bb.txt is not included.
Thanks!
|
|
|
|
|
i have placed a CRichEditCtrl in a View.Size of that Control is exactly same as that of the View.No Vertical & Horizontal scrollbars for that CRichEditCtrl. AutoScrolling also disabled.using lfHeight of LOGFONT i set the hieght & using SetFont, i have set it to that Ctrl.now i know the Font height & height of the CRichEditCtrl.(GetClientRect())
With this information how can i calculate maximum number of lines that could be displayed in that Ctrl without scrolling?.
I assumed,
MaxNumberOfLines=(Height of the CRichEditCtrl)/ FontHeight.
but it is not exactly correct.i think there i am missing the vertical space b/w 2 lines.
Vinothini A
|
|
|
|
|
If you are using a single font in your rich text document then you should be able to select the font into a display compatibler DC (possibly tempory) then use FontHeight = GetTextExtent().cy to determine the maximum FontHeight of a line of text. The string passed to GetTextExtent() can be either the entire text you with to display or a subset like "iWy", the subset would have to contain tallest (W,H,$) and lowest hanging (y,g,p) charactes that you expect to use.
I have written some text editors, including color coded, and this basicaly how I determine the height of all text lines.
Trust in the code Luke. Yea right!
|
|
|
|
|
|
Hi All,
I am working on a project(.dsp in Visual C++ 6.0) which
has multiple .idl files, many of these .idl files has
cross reference. Actually what I mean is, a function
inside file1's interface(interface_of_file1) takes a
parameter of file2's interface(interface_of_file2). Plus,
a function in interface_of_file2 takes parameter of
interface_of_file1. I hope you people got the idea that
both files need the other file to be compiled. In this
situation, if I import file2 in file1 and compile file1,
compiler tries to compile file2 first and gives error
that:
error MIDL2025 : syntax error : expecting a type
specification near "interface_of_file1" .
Now this is a kind of Dead Lock. I did Forward declaration
instead of importing the file(I do not exactly know the
method offorward declaration in MIDL). I did it in file1
like:
interface interface_of_file2;
Now this gives a different error and a warning:
==============================================
error MIDL2011 : unresolved type declaration :
interface_of_file2 [ Parameter 'parameter1' of
Procedure 'get_CashPeriod' (
Interface 'interface_of_file1' ) ]
warning MIDL2039 : interface does not conform to
[oleautomation] attribute : [ Parameter 'parameter1' of
Procedure 'get_CashPeriod' (
Interface 'interface_of_file1' ) ]
==============================================
Now please tell me, whether I'm doing forward declaration
wrongly? or can anyone suggest some other solution to this
problem?
I will be really thankful for any good answer.
Regards,
Ahsan
Ahsan
|
|
|
|
|
why don't you import the idl-file where the referenced interface is declared
as you do with normal C++ header?
e.g.
import "YourInterface.idl";
...
...
the you can use it...
interface IOtherInterface : IYourInterface
{
...
};
|
|
|
|
|
I have already done it the way you are saying. I tried to say the same thing in my question. I have imported the "MyInterface.idl" in "OtherInterface.idl". But when I import MyInterface.idl, MIDL compiler goes and compiles "MyInterface.idl" first. Now problem starts here, "MyInterface.idl" also uses "OtherInterface.idl".
Let me write the scenario in the form of code, this might be better understandable.
========================
Start of MyInterface.idl
========================
import "oaidl.idl";
import "OtherInterface.idl";
[
uuid(072C0C51-426B-1ED2-B2DF-0060085FAE21),
dual,
helpstring ("IMyInterface Interface"),
pointer_default (unique)
]
interface IMyInterface: IDispatch
{
[id(0), propget] HRESULT EventID
([out, retval] IOtherInterface** pvKey);
}
======================
End of MyInterface.idl
======================
===========================
Start of OtherInterface.idl
===========================
import "oaidl.idl";
import "MyInterface.idl";
[
uuid(073D0C21-466A-11D2-A2DF-0050485CFE7B),
dual,
helpstring ("IOtherInterface Interface"),
pointer_default (unique)
]
interface IOtherInterface: IDispatch
{
[id(0), propget] HRESULT EventID
([out, retval] IMyInterface** pipSeg);
}
=========================
End of OtherInterface.idl
=========================
Now, you people may know my problem, that both files are needing the other file. This has become a dead-lock. To compile any of the both files I will need to compile the imported file. I hope you understood. Now, can anyone help me out? :'(
Ahsan
|
|
|
|
|
Add forward declarations:
interface IMyInterface; <- to OtherInterface.idl
interface IOtherInterface <- to MyInterface.idl
|
|
|
|
|
I think, I have understood the original problem now. I gave the forward declarations in one of the .idl files. On compiling it gave the error:
========================================================
error MIDL2011 : unresolved type declaration : IOtherInterface [ Parameter 'pipSegment' of Procedure 'get_CSegment' ( Interface 'IMyInterface' ) ]
========================================================
When I double-clicked over the error, to see where exactly it occured. VC++ gave a message box with the text as below:
=======================================================
"C:\MyWorspace\Infrastructure\MyUtils\IMyInterface.idl"
Cannot open file.
File not found.
=======================================================
While this interface file is actually at:
C:\MyWorspace\Business Tier\Objects\IMyInterface.idl
Now, VC is not picking the path correctly. Even I have opened the file in the editor, which is even showing correct directory on clicking "Save As" from File menu).
Now, PLEASE tell me, where do I may correct this path, so that file file may work correctly.
Regards,
Ahsan
Ahsan
|
|
|
|
|
Hi folks,
I have a scenario where in i need to hide the popup that has been already invoked on a list control after a period of sleep. Can anyone guide me as on how to achieve the same?
ciao
Aravindan Premkumar
|
|
|
|
|
You might try sending WM_CANCELMODE to the window that "owns" the popup menu.
Iain.
|
|
|
|
|
Hi all
can someone tell me how a funciton call itself and give me a example?
Thanks
|
|
|
|
|
Are you talking about recursive functions?
Not quite sure what you're on about but here goes:
<br />
void foo(int n)<br />
{<br />
if( n < 0 )<br />
return;<br />
<br />
std::cout<<n<<std::endl;
foo(n-1);
}
|
|
|
|
|
I have a bunch of projects, which I've linked together in a superficial solution. What I'd like to do when all projects have been built, is to perform some actions (mostly copying files). I do not want to pollute the individual projects with these actions, only the top level solution. Got a tip to spare?
--
Tune your mind, reach inside, peel away
Touch, Taste, Feel, Saturation
|
|
|
|
|
Add a post build step to the compilation that runs a batch file with all the copy commands in it.
I do this for my sub projects, but no reason why not for just the main project.
Roger Allen
Sonork 100.10016
Were you different as a kid? Did you ever say "Ooohhh, shiny red" even once? - Paul Watson 11-February-2003
|
|
|
|
|
Roger Allen wrote:
I do this for my sub projects
The thing is though the build steps are parts of the individual projects, not the solution. I can't find anything remotely close to build steps for the solutions. I think I may have to reiterate and put the actions in the post build step after all.
--
Tune your mind, reach inside, peel away
Touch, Taste, Feel, Saturation
|
|
|
|
|
Hi.
I've subclassed the CListCtrl.
You can edit a subitem, and type some text into it. But if you resize the column (making it larger for example) then the editbox need to be redrawn to fill the whole (new) column space.
Mine stays the same, how can i achieve this?
Greetings
Jens
|
|
|
|
|
derive a Class from CEdit and overwite in ON_WM_WINDOWPOSCHANGING...
add a Variable for the Size of the Subitem e.g RECT m_Position;
In the Beginlabeledit-Handler of your ListCtrl SubClass the ListCtrl's EditCtrl with your derived class like this:
OnBeginlabeledit(NMHDR* pNMHDR, LRESULT* pResult)
{
// Pseudo Code
CREct Rect;
GetSubItemRect(nItem, nSubItem, LVIR_LABEL, Rect);
HWND hWnd=(HWND)SendMessage(LVM_GETEDITCONTROL);
m_DerivedEdit.SubclassWindow(hWnd);
m_DerivedEdit.SetPosition(Rect);
}
with SetPosition you should set the RECT m_Position of your derived Edit class...
in the ON_WM_WINDOWPOSCHANGING - Handler you can adjust the Position of
the ListCtrl's EditCtrl as follows:
CDerivedEdit::OnWindowPosChanging(WINDOWPOS FAR* lpwndpos)
{
lpwndpos->x = m_Position.left;
lpwndpos->y = m_Position.top;
lpwndpos->cx = m_Position.Width();
lpwndpos->cy = m_Position.Height();
}
Hope this helps...
|
|
|
|
|