|
I've created an ATL service which offers an interface. In a test program i successfuly get a pointer to the interface but i can't see the service among the listed ones in the "Services" application.
Do you know how could i bring the service in the list as i can manually start and stop it? What exactly means the post-build registering step?
rechi
|
|
|
|
|
You need to register the service.
<servicename> -service
By default ATL registers it as a local server using servicename /RegServer
|
|
|
|
|
Thanx!
One more question: i saw in ServiceMain this call: LogEvent(_T("Service stopped")); . Is it about a loggin' system? If true, where is the log file?
rechi
|
|
|
|
|
You can see these events in the Event Viewer under Administrative Tools on Window NT systems.
Michael
"Eureka" is Greek for "This bath is too hot"
|
|
|
|
|
Hi all, I'm using DirectX and am trying to see whether my graphics card can use the IID_IDirect3DTnLHalDevice ref before committing my application to it (where a nasty fail would happen if it couldn't). I have used the EnumDevices Callback function to obtain a D3DEVICEDESC7 pointer containing information about my Graphics card and am trying to check the dwDevCaps variable for the D3DDEVCAPS_HWTRANSFORMANDLIGHT cap by using:
if (!(lpdEnumDevice->dwDevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT))
return Error;
lpdEnumDevice is the correct structure, but this test always returns false! I have tried using the IID_IDirect3DTnLHalDevice id at CreateDevice time and it works! so I know it must support it. What am I doing wrong? I have a nVidia GeForce 2 Ultra (Gainward spec) graphics card.
Oh and thanks for the response Mike but the D3DDEVCAPS_HWTRANSFORMANDLIGHT was introduced in version 7 of the DirectX SDK (according to Microsofts instructions), it has a DWORD value of 65536 whilst my dwDevCaps member variable has a value of 1361, which is obviously why it is returning false. But why is this value so low? Do I hav to call a GetCaps() function or something? or re-inialise the D3DEVICEDESC7 structure in the callback function somehow? The Microsoft SDK articles seem to suggest I'm doing it the right way (don't they???), but it still fails to succeed.
How do I even know if its trying to access my nVidia card?
Ta all,
Alan.
|
|
|
|
|
Well call me stupid! What I did was working all along! The thing is the EnumDevices callback function CYCLES through all the compatible devices on the system, one by one and applies each function test to each device. I had only debugged the initial function application which enumerates the RGB Software compatibility (hence the test failing). Upon pressing ctrl + F10 the callback tests the next device available, the HAL, and by pressing ctrl + F10 again it tests the TnLHAL, which is the device I wish to use. If the system graphics card does not cater for transforms and lighting, the EnumDevices function will never enumerate this device and so never return true to the test I mentioned earlier. Hope this helps anyone out there with the same problem.
Alan.
"When I left you I was but the learner, now I am the master" - Darth Vader
|
|
|
|
|
Is there a function similar to BitBlt which can be used to take a DIB Bitmap in memory and draw it to device context flipped horizontally or vertically?
|
|
|
|
|
no, i don't think there is.
-c
Cheap oil. It's worth it!
|
|
|
|
|
No, but if you pass reversed co-ordinates to BitBlt, you'll get the result you are after.
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
Half the reason people switch away from VB is to find out what actually goes on.. and then like me they find out that they weren't quite as good as they thought - they've been nannied. - Alex, 13 June 2002
|
|
|
|
|
example please
edit
ahh... not BitBlt like you said, but StretchBlt, like he said. it all makes sense now.
-c
Cheap oil. It's worth it!
|
|
|
|
|
Ah! I see. By using StretchBlt, right? Thank you. It seems to work perfectly.
|
|
|
|
|
I have a tree control, m_treeItem, and I'm trying to set and get data to only one item in the control. CItemInfo is the class that I'm storing my data in. Heres my code:
void CMyView::AddItem()
{
HTREEITEM hMainItem;
HTREEITEM hSubItem;
CItemInfo *itemInfo = new CItemInfo;
itemInfo->m_strName = "A Name";
itemInfo->m_strAge = "An Age";
itemInfo->m_strSex = "A Sex";
hMainItem = m_treeItem.InsertItem( "First Item" );
hSubItem = m_treeItem.InsertItem( "Second Item", hMainItem, TVI_SORT );
m_treeItem.SetItemData( hSubItem, (DWORD)itemInfo );
delete itemInfo;
}
void CMyView::OnSelChange( some variables I dont use )
{
if( m_treeItem.GetChildItem(m_treeItem.GetSelectedItem())==NULL )
{
DWORD dwData = m_treeItem.GetItemData( m_treeItem.GetSelectedItem() );
CItemInformation *itemInfo = (CItemInformation *)dwData;
MessageBox( itemInfo->m_strName );
MessageBox( itemInfo->m_strAge );
MessageBox( itemInfo->m_strSex );
}
}
The problem is that all of the MessageBox's display the same thing and its always about 3 lines of garbage. What am I doing wrong? Thanks in advanced.
-Raffi
|
|
|
|
|
Ok, after some screwing around, I found that if I comment out the line "delete itemInfo" it works. However I get memory leaks, so my new question is, do I have to store each CItemInfo object that I make in a list or something before deleting it?
-Raffi
|
|
|
|
|
SetItemData takes a pointer to the allocated memory, so that when you called delete the pointer was no longer valid.
You need to keep the pointer active until you've finished. You could just loop through all your items and delete the pointer returned from GetItemData before you destroy the control. Or like you suggest you could have a list which gets deleted later. I tend to keep a vector of pointers and then free up the memory in the destructor.
Michael
"Eureka" is Greek for "This bath is too hot"
|
|
|
|
|
Thanks a lot
-Raffi
|
|
|
|
|
Can you really do this?
<bold>CItemInfo *itemInfo = new CItemInfo*;
Should it not be
<bold>CItemInfo *itemInfo = new CItemInfo;
Otherwise you would allocate a new pointer.
...at least that's what i think.
/Magnus
|
|
|
|
|
I had it correct in my code, just a mistake when writing the question.
-Raffi
|
|
|
|
|
I'm controlling excel from another app: create sheets, set ranges, modify properties and so on.
Now, I've implemented an eventlistener like described as on the msdn-website, automation, creating our own IDispatch for catching events.
The strange thing is that it handles pretty well events like WINDOW_ACTIVATE, SHEET_CALCULATE, ... if those things are modified from the outside-application. BUT if we select a range or double click on the sheet, excel blocks. Our app doesn't block, but it doesn't receive anymore events. We still can close excel though.
Is this a common problem? Anybody solved it yet? Or where to look?
initialising:
CEventsDispatch g_XLEventDispatch;
IConnectionPoint *m_pConnectionPoint;
DWORD m_adviseCookie;
static const GUID IID_IExcel8AppEvents =
{0x00024413,0x000,0x0000,{0xc0,0x00,0x0,0x00,0x00,0x00,0x00,0x46 } };
HRESULT hr;
IConnectionPointContainer *pConnPtContainer;
hr = m_pXlApp->QueryInterface(IID_IConnectionPointContainer,(void **)&pConnPtContainer);
if(hr!=0)
return;
hr = pConnPtContainer->FindConnectionPoint(IID_IExcel8AppEvents,&m_pConnectionPoint);
if(hr!=0)
return;
hr = m_pConnectionPoint->Advise(&g_XLEventDispatch, &m_adviseCookie);
if(hr!=0)
return;
pConnPtContainer->Release();
our idispatch:
class CEventsDispatch : public IDispatch
{
public:
ULONG refCount;
CEventsDispatch::CEventsDispatch()
{
refCount=1;
}
CEventsDispatch::~CEventsDispatch()
{
}
virtual HRESULT __stdcall QueryInterface(REFIID riid, void **ppvObject)
{
if(IsEqualGUID(riid, IID_IDispatch) || IsEqualGUID(riid, IID_IUnknown))
{
this->AddRef();
*ppvObject = this;
return S_OK;
}
*ppvObject = NULL;
return E_NOINTERFACE;
}
virtual ULONG _stdcall AddRef(void)
{
return ++refCount;
}
virtual ULONG _stdcall Release(void)
{
if(--refCount <= 0)
{
return 0;
}
return refCount;
}
virtual HRESULT _stdcall GetTypeInfoCount(UINT *pctinfo)
{
if(pctinfo) *pctinfo = 0;
return E_NOTIMPL;
}
virtual HRESULT _stdcall GetTypeInfo(UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
{
return E_NOTIMPL;
}
virtual HRESULT _stdcall GetIDsOfNames(REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid,DISPID *rgDispId)
{
return E_NOTIMPL;
}
virtual HRESULT _stdcall Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags,DISPPARAMS *pDispParams, VARIANT *pVarResult,EXCEPINFO *pExcepInfo, UINT *puArgErr)
{
return S_OK;
}
};
[VISUAL STUDIO 6.0] [MFC] [WIN98/2]
Bluute tette!
|
|
|
|
|
After a few minutes, a messagebox comes up saying: "Microsoft excel is waiting for another application to complete an OLE action."
I've implemented everything I've found on the msdn example (automating excel using vc++), so they must have forgotten something?
[VISUAL STUDIO 6.0] [MFC] [WIN98/2]
Bluute tette!
|
|
|
|
|
Hi,
I start an Embedded Ms Word instance from my application, all goes ok but the Ms Word window is shown in the bottom of the Z-Order, I would like to bring it top, how can I make that using the App, Doc and that Ms Word stuff ?
Thanks in advance, greetings
Braulio
|
|
|
|
|
I have just started "playing" around with VS.NET. I have created a new project - added an Icon resource. The 32x32 icon is displayed but could somebody please tell me how I create the 16x16 icon - the "Device" field in the properties is disabled and I cannot for the life of me work out where the 16x16 Device has gone or how to add it.
I am certain that it is right there under my nose and that a visit to the optician may be coming up - but i would sure appreciate theh loan of a white stick right now!
TIA
|
|
|
|
|
Doh! - I found out how to do it - must learn to RTFM before making a complete fool of myself
|
|
|
|
|
After using the following command
_crtBreakAlloc = 1884; (this was a tip given by Chris in a previous thread), I discovered that this piece of code causes a memory leak :
if(Map!=NULL) delete[] Map;
Map=NULL;
Map=new I_int[Cor_Node->Parents.Nb_Elems()];
Exact position is the Map=new ... line (of course).Cor_Node->Parents.Nb_Elems() is equl to 4.
Any idea about what happened ? Is there a better way to do this ?
~RaGE();
|
|
|
|
|
hi,
It does not mean that the piece of code is causing the memory leak,
but rather that the memory allocated at this point has not been freed.
Also you should be careful abt tracking the leaks with this
method because the number only indicates that the n-th allocation is
leaked-->this may change if you change the sequence of the actions when
testing or debugging.
|
|
|
|
|
Thanks for the help ...
Prem Kumar wrote:
this may change if you change the sequence of the actions when
testing or debugging.
Is that meaning I have to do exactly the same operations when Debbugging (press same buttons in same order in my app ?) ...
~RaGE();
|
|
|
|