|
Any one have any ideas on this problem that I sent off to msdn ?
http://msdn.microsoft.com/library/devprods/vs6/visualc/vclang/_iostream_a_streambuf_derivation_example.htm
C++ Visual Studio 6 with SP4 on Windows NT 4.0
There are contradictory examples of filebuf using the sync method and the fd accessor method(s). The C++ standard documents the methods and so does Microsoft, however MS's library doc's are full of examples of using features that they don't support and they do not show workarounds in fact the class filebuf is total unusable in buffered IO situations and has no way of working without manually changing your include files.
If this was a support question I could word it as ...
When using buffered IO with the filebuf class how does someone within the sync method pysically get the output to the disk as a buffer, usually this could be done by calling the base filebuf class sync but it does not implement buffering properly and only calls a flush function rather than checking for unbuffered == false then calling write then calling flush. Also I cannot compensate by getting the file descriptor and manually doing the write because the filebuf::fd is not supported!!!
Karl Mutch
|
|
|
|
|
Hello,
I'm currently trying to get a grip of the STL. All I could find so far is one (fairly poor) tutorial in the MSDN.
Does anybody know where to get some good tutorial for STL?
Thanks,
Matthias
|
|
|
|
|
Hi,
check this link:
http://www.sgi.com/Technology/STL/other_resources.html
The best solution is of course to buy a book with good examples.
Andreas
|
|
|
|
|
i began loving STL after reading:
"Thinking in C++ 2nd edition"
by Bruce Eckel
i think two or three of the chapters are dedicated to STL... and are full of examples...
hope this helps
warjo
|
|
|
|
|
Dear Sam.
With the Help of ur WFC Lib. we tried to interact with Tape Drive for Getting Header Info., Catalogging, and BackupRead....
but we failed in the first phase itself...(Getting Header Info..)
The method OPEN in CMIRCOSOFTTAPE fails to read the info.
Could u help us to overcome this problem.???
Any ideas and Suggestions would be welcome...
|
|
|
|
|
Hi all,
can anybody tell me how i can format source code in
discussion board messages?
Thanks in advance
Holger Persch
|
|
|
|
|
"can anybody tell me how i can format source code in
discussion board messages?"
Let's test. The following code is inside a < pre >...< /pre > block:
void CMyClass::OnSomeEvent()
{
}
|
|
|
|
|
I want to trigger a started NT service on some event. i.e a service should activate on that event and perform its funtionality.
The invoking event should be passed from another VC application.
Can anybody tell me how can I do it.
(I want something like as Message Passing within different applications)
Please guide.
Thanks in advance
Aasher
|
|
|
|
|
"I want to trigger a started NT service on some event. i.e a service should activate on that event and perform its funtionality.
The invoking event should be passed from another VC application.
Can anybody tell me how can I do it.
(I want something like as Message Passing within different applications)"
You might try having a look at my DCOM programming tutorial, which shows you, step-by-step, how to do this with DCOM, where the server program (which has the events and the functionality) is a Windows NT Service.
The tutorial starts with Step 1, and then Back and Next links are provided to help you move through the steps.
Hope this helps
|
|
|
|
|
If you get the book "RPC for Windows NT" and read and understand it, then you can code your own special interface into the NT service as the RPC server and into your VC app as the RPC client. I do this a lot using the Local RPC and it works great.
|
|
|
|
|
Hi,
COM object is a binary file, and dll also binary file.
what is difference between them (internally)?
thanks
koteswara
|
|
|
|
|
Think of things this way...
You know how, in a C++ program, you have all sorts of objects, like CWinApp, CMyView, CMainFrame, etc.?
These are all called "code-level" objects; that is, the only thing that knows about them is the program's source code.
COM takes objects to the next level, that is, the "binary level." Think again of a class, but this time another executeable program instantiates it in memory and calls its methods and properties. Although this time, the object is not in your code, it's in the binary.
DLLs are simply libraries of functions that are like the .LIB files we use for linking things statically, only this time, the linking happens "dynamically", or during run time
Cheers,
Brian Hart
|
|
|
|
|
Hi,
COM object can be stored in the DLL or EXE file. When a COM object is stored in the DLL the only difference with the usual DLL file, is that the COM DLL must have several COM related methods:
DllGetClassObject
DllRegisterServer
DllUnregisterServer
DllCanUnloadNow
See description of these functions in MSDN for more details...
Regards,
Alex Gorev,
Dundas Software.
|
|
|
|
|
Hello Everybody,
I know this is COM/DCOM but since Visual C++ is used so much to do this, I thought I would post here too
I have written a comprehensive, seven-step tutorial which is easy enough for beginners to use, and posted it on The Code Project to help you get started on DCOM programming.
It's as yet an "unedited reader contribution" but I want to invite you to look at it anyway and let me know what you think. Feedback is so very needed on this kind of a project.
The tutorial starts with Step 1, and is at (for the moment) http://www.codeproject.com/useritems/HelloTutorial1.asp
Cheers,
Brian
|
|
|
|
|
Ok, I have two classes, eg, CView1 and CView2. I want to call a function in one view to get some text, then call a function in the second view to set the text to what I just got. Following so far? I need to do this in a function in my CWinApp derived class.
The program is set up to be MDI, and both views are attached to the same CMDIChildWnd frame, switched between with tabs. I am need to do this so I can update one document based on the other when the views are switched.
For example, when the tab is clicked to switch the view to view1 from view2, I call "theApp.SetVew1_from_View2()", which needs to be like:
void CMyApp::SetVew1_from_View2()
{
CString strView2 = CView2::GetText();
CView1::SetText(strView2);
}
Except that I obviously need to get valid pointers to each view. This is my question (finally ), how do I get pointers to each view (attached to the same child frame)?
I have tried getting the CMDIFrameWnd, then the active child frame, but I can't get pointers to each view from here.
Any light you could shed on this would be greatly appreciated.
Thanks in advance,
David Wulff
Battleaxe Software
|
|
|
|
|
An approach is, instead of the app getting pointers to the views, how about the views giving the app pointers back to themselves?
Add two public member variables to CMyApp, and #include lines, like this:
#include "View1.h"
#include "View2.h"
class CMyApp : public CWinApp
{
...
public:
CView1* m_pView1;
CView2* m_pView2;
}
// IN MYAPP.CPP
CMyApp::CMyApp()
{
// Initialize view pointers to NULL
m_pView1 = NULL;
m_pView2 = NULL;
}
void CMyApp::SetView1FromView2()
{
if (m_pView1 == NULL || m_pView2 == NULL)
return;
m_pView1->SetText(m_pView2->GetText());
}
// NOW IN View1.cpp
CView1::~CView1()
{
theApp.m_pView1 = NULL;
}
void CView1::OnInitialUpdate()
{
CView::OnInitialUpdate();
...
theApp.m_pView1 = this;
}
// AND IN View2.cpp
CView2::~CView2()
{
theApp.m_pView2 = NULL;
}
...
void CView2::OnInitialUpdate()
{
CView::OnInitialUpdate();
...
theApp.m_pView2 = this;
}
And voila!
Cheers,
Brian
|
|
|
|
|
Thanks. I'll play around with this idea, but just one question:
If I have more than child frame open, wont the pointer 'point' to the most recently created one.
Actually forget this, I have just thought of adding the 'theApp.m_pViewX = this;' each time the child frame is selected. After all, only one can be shown at a time.
Thanks again,
David
|
|
|
|
|
I'm looking for API-functions to modify windows icons (like the startmenu icons or drives icons, ...). I'm also looking for function(s) to rebuild shell icons cache.
Please answer asap ! Help !
|
|
|
|
|
Hi,
SplitterWnd problem (Size of views !!!)
SplitterWnd-Problem in MFC-SDI-App in VC++.
What I want :
+-------------+------------+
| | |
| CTReeView ^ CFormView |
| | |
+----<---[Splitter]-->-----+
| |
| CLIstView |
| |
+--------------------------+
What I get :
The two upper views get very small. All splitters
are there, I just have to pull the middle splitter
downwards to get the View I want.
+-------------+------------+
+----<---[Splitter]-->-----+
| |
| CLIstView |
| |
+--------------------------+
This is the code I use. I have changed the size-parameter of CreateView serveral times but it did not help.
I even tried to change the size after the create. Nothing seemed to work.
Whats going wrong ?
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT , CCreateContext* pContext)
{
CRect rect;
GetClientRect(rect);
CSize sizeListView(rect.right,rect.bottom/2);
CSize sizeTreeView(rect.right/2,rect.bottom/2);
CSize sizeFormView(rect.right/2,rect.bottom/2);
if (!m_wndSplitterTopBottom.CreateStatic(this, 2, 1))
return FALSE;
if (m_wndSplitterTopBottom.CreateView( 1,
0,
RUNTIME_CLASS(CListView1),
sizeListView,
pContext)) {
if (m_wndSplitterLeftRight.CreateStatic(
&m_wndSplitterTopBottom,
1,
2,
WS_CHILD | WS_VISIBLE,
m_wndSplitterTopBottom.
IdFromRowCol(0, 0)))
{
if (m_wndSplitterLeftRight.CreateView(
0,
0,
RUNTIME_CLASS(CMyTreeView),
sizeTreeView,
pContext)
&&
m_wndSplitterLeftRight.CreateView(
0,
1,
RUNTIME_CLASS(CMyFormView),
sizeFormView,
pContext)
)
{
}
else {
m_wndSplitterLeftRight.DestroyWindow();
return FALSE;
}
}
else {
return FALSE;
}
}
else {
m_wndSplitterTopBottom.DestroyWindow();
return FALSE;
}
return TRUE;
}
Thanks
|
|
|
|
|
Hi Everyone,
I'm using Visual C++6 and have this problem and hope you can help me out!
What I'm trying to do is to read data from a TEXT FILE and plug the values into a CString, which will be used as a SQL statement.
For example, let's say I have the follwing data in a TEXT FILE:
CustomerName, ID, INTEGER, FirstName, STRING, LastName, STRING, etc...
How can I read the values from the TEXT FILE one by one so at the end, I'll come up with a statement such as:
SQL="CREATE TABLE CustomerName(ID INTEGER, FirstName STRING, LastName STRING, etc...)"
I would like to put the reading of the values from the TEXT FILE into a loop so that no matter how many FIELDS the text files contain, the loop will be able to handle it and put all the values into a SQL statment.
For example, if I have the following int the TEXT FILE:
(3 FILEDS and 3 VALUES OF THE FIELD)
CustomerName, ID, INTEGER, FirstName, STRING, LastName, STRING
I would like:
SQL="CREATE TABLE CustomerName(ID INTEGER, FirstName STRING, LastName STRING)"
BUT if I only have 1 FIELD AND VALUES:
CustomerName, ID, INTEGER
The reading of the TEXT FILE will be dynamic and the SQL would be:
SQL="CREATE TABLE CustomerName(ID INTEGER)"
Hope you can understand what I'm trying to do.
I've tried to do it in a loop myself but I had some trouble, so If anyone has any solutions, PLMK! Thanks!
Steve
|
|
|
|
|
Hi,
try this:
CString BuildSQL( const CString& sStringFromFile )
{
CString sSQL, sTemp1, sTemp2;
sSQL = _T("CREATE TABLE ");
if( AfxExtractSubString( sTemp1, sStringFromFile, 0, ',' ) )
{
sSQL += sTemp1;
sSQL += "( ";
for( int i = 1; ; i +=2 )
{
if( AfxExtractSubString( sTemp1, sStringFromFile, i, ',' ) &&
AfxExtractSubString( sTemp2, sStringFromFile, i + 1, ',' ) )
{
sSQL += sTemp1;
sSQL += sTemp2;
sSQL += _T(", ");
}
else
{
break;
}
}
sSQL.ReleaseBuffer( sSQL.GetLength() - 2 );
sSQL += _T(" )");
}
return sSQL;
}
Regards
Holger Persch
|
|
|
|
|
I want to call a windows NT service from a VC program.
Can any body tell me how can I do so?
Please guide
Thanks
Aasher
|
|
|
|
|
If "to call" means to start a service, just use
PJ Naughter's great "CNTService" classes (located in the
"System -> Services" section) to get access to NT services.
These classes will allow you to control (e.g. start, stop,
install, uninstall,...) services in any way you want.
Regards
Holger Persch
|
|
|
|
|
Hello all,
I'm using a CMacButton that I got from http://codeguru.earthweb.com/controls/macbuttons.shtml The class doesn't automatically support transparency. However, I'm sure it can really easily because another programmer told me it could be done by commenting out the code that clears the area and draws the background. However, I couldn't figure out what to comment out. I'm new to owner drawn controls and I was wondering if someone could help. Thanks in advance.
|
|
|
|
|
Hi Trey,
I don't know the CMacButton class, but I think it's the same for all controls.
You can get a transparent control by:
- overriding OnEraseBackgnd (just return TRUE, without calling the base class implementation)
- if you have other controls below the button, adding WS_EX_TRANSPARENT to the extended style of the button (so that it is the last to be repainted)
Hope this is right, I used it with a CStatic with no problems.
Cheers,
Paolo.
|
|
|
|
|