|
Christian Bayer wrote: Debug Assertion failed!
Program ...
File: C:\Programme\Microsoft Visual Studio 8\VC\atlmfc\include\atlbase.h
Line 2706
Expression _pAtlModule == 0
It's been a while since I did any ATL dev but that seems like a fundamental ATL error. Meaning you don't have your project configured or initialized properly for ATL use. Do you have any experience using ATL? If not, and you want to use it, I recommend you take the time to study the technology enough to understand the basics. There are plenty of resource on MSDN and I would imagin also here on Code Project that would help, IF you are a beginner.
led mike
|
|
|
|
|
Yes, I am a new to ATL. But I did not program the C++ Client app, it is a GPLed source done by someone who should know the basics well enough. Moreaover as the binary compiled from this source by the author works well, without errors. So I think you are right when you say this is an error due to a wrong inititalization of the project. Next thing is that this project is done with Visual C++ 6.0 or 7.0 and I had to convert it to VC 2005. Perhaps this conversion caused the error? Or could compiling with VC 8.0 can be the reason?
Unfortunately I cannot ask the author himself. Thatswhy I ask here.
You are right, I will have to read some more about ATL. But reading about ATL troubleshooting (what I did) did not solve my problems here.
|
|
|
|
|
Christian Bayer wrote: Moreaover as the binary compiled from this source by the author works well, without errors.
I don't know what "works well" means. If you mean it compiles without error, the problem being reported by the ASSERT only happens at runtime so there is no compile error that will report it.
Christian Bayer wrote: But reading about ATL troubleshooting (what I did) did not solve my problems here.
Yes because troubleshooting information is going to assume prerequisite knowledge of ATL fundamentals.
Christian Bayer wrote: Perhaps this conversion caused the error? Or could compiling with VC 8.0 can be the reason?
Yes it could be a problem, however of course ATL is still supported in all the newer Visual Studio versions. I am not aware of any specific changes to the structure of ATL at that level. AtlModule, if I remember correctly, is an aspect of getting the per Process or per Thread context set up correctly for the ATL libraries to function.
Also the client application must have some sort of configuration requirements to know about COM components it is being directed to use. It is possible you have not satisfied those configuration requirements.
led mike
|
|
|
|
|
led mike wrote: Christian Bayer wrote:
Moreaover as the binary compiled from this source by the author works well, without errors.
I don't know what "works well" means. If you mean it compiles without error, the problem being reported by the ASSERT only happens at runtime so there is no compile error that will report it.
I am not an english native speaker, so I don't know if my sentence was not clear enough: In the source package there was already compiled binary of the client. It was compiled by the author of it a year ago and not me. This binary does not produce the above ATL related error message, nor any other error.
So yes, this error happens only at runtime and is therefore not detected by the compiler (in which case I would not have been able to compile it and report runtime error messages here..)
My project is completely done, everything works as it should (I hope), the only known problem left is the nagging MessageBox popping up everytime the application is started.
led mike wrote: Also the client application must have some sort of configuration requirements to know about COM components it is being directed to use. It is possible you have not satisfied those configuration requirements.
I am not quite sure if there is something wrong with that. But from what I have read on the net about it (I know that you don't believe me if I say it was a lot) the COM init part should be ok. Above all because every COM related function, data structure and event works very well within the client.
If there is something left to connect all these COM structures to something like an "ATL environment", this could cause the error. But remember the above lines, the original binary of the client using the same source but another VC version and perhaps some other non-source code related preferences works without errors.
|
|
|
|
|
Christian Bayer wrote: My project is completely done, everything works as it should (I hope), the only known problem left is the nagging MessageBox popping up everytime the application is started.
Oh that sounds different than what I previously understood. So the application functions property once you dismiss the messagebox? An assert should only be triggered if the project is compiled in _DEBUG. If you can re-compile the binary in release mode it should stop displaying that message.
Again what I just said is ONLY if I now understand your situation correctly.
led mike
|
|
|
|
|
led mike wrote: Oh that sounds different than what I previously understood. So the application functions property once you dismiss the messagebox? An assert should only be triggered if the project is compiled in _DEBUG. If you can re-compile the binary in release mode it should stop displaying that message.
Again what I just said is ONLY if I now understand your situation correctly.
You do. The program runs just fine if you click ignore (which is strange enough for me).
Oh my... I did not think of that... In Release mode the Box is really gone, could have been thinking of that earlier..
But there is still the question why this assertion is triggered. Ok, I can release my app now when I know how this box vanishes but there should be a reason for that, though...
This is also the explanation why the shipped binary "works" - it simply has the same error.
But ok - my project is not the reason for that error and this helps a lot (because this client app is not my problem domain, only the COM-server is) and I do not have to fiddle around with that. Although it would be nice if the GPLed client app can be fixed. If you are still interested, you can download it here:
http://mirror.blenderbuilds.com/plugins/3DxBlender-Windows.zip[^]
|
|
|
|
|
Hi,
I would like to create a windows service which automatically starts on startup and calls my function.I dont want to use .NET support for this.
Using ATL I have taken a windows service project.I build it and registered the service using "/Service" which is then shown in Services with "Manual Startup type". I would want this to be automatic.
How should I go about it? For this while creating the service we need to specify "SERVICE_AUTO_START" flag. But this service creation is automatically done by the base class CAtlServiceModuleT.
SC_HANDLE hService = ::CreateService(
hSCM, m_szServiceName, m_szServiceName,
SERVICE_ALL_ACCESS, SERVICE_WIN32_OWN_PROCESS,
SERVICE_DEMAND_START, SERVICE_ERROR_NORMAL,
szFilePath, NULL, NULL, _T("RPCSS\0"), NULL, NULL);
Now How should I go about overriding the base class functions. I know I need to make use of _tWinMain() and override but Iam not sure of the approach.
Any suggestions or relevant links would be helpful
Thanks
Satya
Today is a gift, that's why it is called the present.
modified on Tuesday, October 7, 2008 4:17 AM
|
|
|
|
|
Override the base implementation via copying the code in your project and change it.
Or you can try to change the startup type of the service yourself (somehow).
Greetings from Germany
|
|
|
|
|
After the Install method of CAtlServiceModuleT is called, you could use OpenService to get a handle on the service and then ChangeServiceConfig to alter the service's start type to SERVICE_AUTO_START ?
Looking in the code, you could override RegisterAppId to do that, as RegisterAppId calls the Install method - you can't just override Install , because it's not virtual - RegisterAppId is the closest method called using a correctly typed object pointer (look for pT->RegisterAppId in AtlBase.h ). Something like the code below should work?
HRESULT RegisterAppId(bool bService = false) throw()
{
HRESULT hBaseRes = CAtlServiceModuleT< CbModule, IDS_SERVICENAME >::RegisterAppId(bService);
if (SUCCEEDED(hBaseRes) && bService)
{
HRESULT hRes = E_FAIL;
SC_HANDLE hSCM = ::OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
if (hSCM != NULL)
{
SC_HANDLE hService = ::OpenService(hSCM, m_szServiceName, SERVICE_CHANGE_CONFIG);
if (hService != NULL)
{
if (::ChangeServiceConfig(hService,
SERVICE_NO_CHANGE, SERVICE_AUTO_START, SERVICE_NO_CHANGE,
NULL, NULL, NULL, NULL, NULL, NULL, NULL))
{
hRes = hBaseRes;
}
::CloseServiceHandle(hService);
}
::CloseServiceHandle(hSCM);
}
hBaseRes = hRes;
}
return hBaseRes;
}
|
|
|
|
|
#define BEGIN_MSG_MAP(theClass) \
public: \
BOOL ProcessWindowMessage(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT& lResult, DWORD dwMsgMapID = 0) \
{ \
BOOL bHandled = TRUE; \
(hWnd); \
(uMsg); \
(wParam); \
(lParam); \
(lResult); \
(bHandled); \
switch(dwMsgMapID) \
{ \
case 0:
|
|
|
|
|
|
but
(hWnd); \
(uMsg); \
(wParam); \
(lParam); \
(lResult); \
(bHandled); \
are not parameters to the macro.
And, if the parenthsis is removed , nothing wrong happened.
|
|
|
|
|
It was probably just force of habit that made the author put parens around those variables. They're harmless.
|
|
|
|
|
to make the compiler silent about the unused values.
I make that BOOL ProcessWindowMessage(HWND /*hWnd*/,...
Greetings from Germany
|
|
|
|
|
Right, but you don't need parens for that.
|
|
|
|
|
"No doubt about it"
Greetings from Germany
|
|
|
|
|
Hi all,
I am trying to put data in a combobox via Properties->behavior->data, i key in like this (Every Sunday; Every Monday; Every Tuesday; Every Wednesday; ..... Every Saturday;), however those data dont appear. What should I do?
Thanks,
Jayjay
|
|
|
|
|
WTL dialogs don't read data for combo boxes from resources (which is where anything you enter via designer goes). You have to load the combo box in your OnInitDialog.
|
|
|
|
|
Hi,
I use CDialogImpl to create a Dialog class which works perfectly under WinXP, however, when I use DoModal to display the dialog box on win2000 it returns -1. Does anyone know what the cause of this could be?
Many thanks,
Alex
|
|
|
|
|
|
No I haven't. This might be the solution. Is there any example of how it's used that i can look at?
Thanks,
Alex
|
|
|
|
|
This page[^] looks like it tells you all about it.
|
|
|
|
|
i am working on an application where i want to schedule a task setting the time, date and day. All i know is that it is possible using thread... but how??? i just want to have an idea for approaching such application.
|
|
|
|
|
|
I've written a Windows service with the help of the VS2008 ATL project wizard. I've added a ATL simple object which I hope will allow external processes to interact with my service via its interface.
1. I assume I can use the _AtlModule global variable to achieve this. Is it safe to call _AtlModule methods from the ATL simple object, e.g. _AtlModule.MyMethod(x)?
2. I plan to write some ASP server side script and use Server.CreateObject("xxxx.yyyyy") to access the service using the ATL simple object I created. (a) Will this be possible? (b) Are there any special permissions that will need to be set in IIS or anywhere else (I'm using Windows Server 2003)?
3. Does the service need to be running for such a call to succeed or will it be started?
Sorry for all the questions but I've never written a Windows service like this before.
Thanks in advance.
|
|
|
|