|
"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.
|
|
|
|
|
Hi all, well I am trying to catch any keystroke (not system strokes) with the ON_CLICK_DOWN in the class wizard. It doesn't seem to be working for me though? Any suggestions on another way to do it? Or sample code?
Thanks.
p.s. I have a whole bunch of edit boxes on the CFormView that I am try to capture the text and convert it as it is typed.
|
|
|
|
|
I think it will be better to subclass an edit control and
give it the custom formatting capabilities you want. You can
handle the "WM_CHAR" message to control the edit's input.
Then use the subclassed control instead of the regular edit control in your formview.
Regards
Holger Persch
|
|
|
|
|
Guys
I don't have a toolbar image in my application. What I have is a resource file which has list of
bitmaps. These bitmaps are to be referred using their names and NOT IDs. I don't have any ids
available.
I looked at CToolBarCtrl()s AddBitmap() function. It only accepts bitmap id as an argument.
I don't know why there is no facility to specify bitmap names, especially since CBitmap's
LoadBitmap accepts image name as an argument.
Has anybody found a way out yet?
In my application, details about the toolbar button are read from a text file. One of the attributes
of button is the name of the bitmap which it uses. So there are no IDs available. While I can
write a utility to map these strings to ids, it is a huge pain. Also, I have bitmaps in excess of
2000 which need to be read in. So one can imagine.
Am I missing something here or is it just common control limitation.
Thanks
Regards
Shailesh
|
|
|
|
|
Hi,
I found that old projects containing windows or dialogs with small caption (WS_EX_TOOLWINDOW) don't display as expected on Win2000.
That is, windows with the WS_EX_TOOLWINDOW style have a small caption under Win95, but not under Win2k (the same executable, not recompiled).
At least, this is what I could see with some testing.
Does anyone know how to have small captions on Win2k?
Or is it by design?
Paolo.
|
|
|
|
|
Hi there,
I am using standard drawing routines for drawing. The same I use for printing. But each time it
comes to printing a bitmap the printer ignores it with no comment.
On standard printers there is no problem only with PostScript printers.
Thanks for help.
|
|
|
|
|
I need to be able to tell whether DHCP is enabled.
This needs to work on 95,98,NT4 and 2000.
I figured there must be registry settings for this and after digging around I've found what they are for 95 & 98.
However for NT and 2000 it's slightly different.
I believe that the registry key for NT is:
HKLM\System\CurrentControlSet\Services\"AdapterNameHere"\
Parameters\Tcpip
and the key value is "EnableDHCP".
The Adapter name is stored under
"HKLM\System\CurrentControlSet\Services\NetBT\Adapters"
so by using this I should be able to get the setting.
What I want to know is can anyone confirm this to be correct or is there an easier way?
Finally for 2000 it should be easier since I can use the "GetAdaptersInfo" function which returns information on each adapter and the information contains whether DHCP is enabled.
MSDN online says to use Iphlpapi.lib and Iphlpapi.h, does anyone know where these files come from, I presume there available within an SDK.
Thanks.
|
|
|
|
|
I need to create a UDP Packet to send to about 50 (anti-virus) Servers
simultaneously. The UDP Packet will basically act as if it is sending a
virus, which will trigger the anti-virus Server to Alarm us (at HQs). By
the notifications we receive from the servers, we will be able to determine
which Servers need immediate attention (basically the ones that didn't alert
us of the virus). This is currently being done with a batch file (sending a
dummy virus to the Servers), which takes entirely too long to run and get
the Stats! I am new at Socket programming (obviously), but do other
programming (data/file en(de)cryption, etc...).
Can anyone help me???
Dan
|
|
|
|
|
There anybody know anti-aliasing algorithm??
I want to make free-drawing application program.
and want to adopt there anti-aliasing algorithm..
to avoid jagged
How do am I??
|
|
|
|
|