|
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.
|
|
|
|
|
markiemooster wrote: Sorry for all the questions but I've never written a Windows service like this before.
Then I strongly urge you to find, read and understand materials that explain what services are. You do not seem to be on the correct track with services at this time.
Introduction to Windows Services[^]
led mike
|
|
|
|
|
Thanks Mike. But I've written about half a dozen or so services in my time. Perhaps you weren't aware that you can create an ATL COM service using the VS2008 project wizard?
You choose the ATL Project template. In the Applications Settings dialog box, select the "Service" radio button. Now add an ATL class in the usual manner: "Add", "Class", "ATL Simple Object".
All that aside, could someone please shed some light on my queries.
Thanks.
|
|
|
|
|
markiemooster wrote: 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?
1. Depends on what you mean by "safe"...
Your service may be accessed from different applications which means that you have to make it thread safe.
2(a). I suppose that you are limited to automation compatible interfaces when using scripting languages, but that's fine.
2(b). I don't think so, but that may depend more on what you're trying to do from your service than the fact that you're exposing COM objects from it. You also have to call ::CoInitializeSecurity() in your wizard generated class derived from CAtlServiceModuleT . At least
CoInitializeSecurity( NULL, -1, NULL, NULL, RPC_C_AUTHN_LEVEL_NONE,
RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE, NULL );
3. No, the service doesn't have to be started, but it must be installed as a service. The service is started when the client tries to create an instance of an object that the service exposes.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Hello everyone,
When writing an ATL COM server, MIDL compiler will automatically generated file _i.c and _i.h from IDL definition.
My question is whether my below usage for the two files are correct when writing a COM client (consumer)?
1. I put _i.h file into the "Header files" of the client project, and using it to make the build for client project;
2. I put the _i.c into the "Source files" of the client project, and using it to make the build for client project.
thanks in advance,
George
|
|
|
|
|
I don't think you need the .c file for COM, just the .h file. If you look at this page[^], it says that the C stub file is only needed when IDL is used to define RPC interfaces.
IIRC, the C stub contains code to serialize parameters for RPC calls into an interchangeable form.
|
|
|
|
|
Hi Stuart,
If I do not include the .c file, there will be link error. Any ideas?
1>d:\visual studio 2008\projects\testatl2\teststruct1\main.cpp(14) : error C2275: 'TestStrcut1' : illegal use of this type as an expression
1> d:\visual studio 2008\projects\testatl2\teststruct1\testatl2_i.h(58) : see declaration of 'TestStrcut1'
1>d:\visual studio 2008\projects\testatl2\teststruct1\main.cpp(17) : error C2275: 'ITestStrcut1' : illegal use of this type as an expression
1> d:\visual studio 2008\projects\testatl2\teststruct1\testatl2_i.h(99) : see declaration of 'ITestStrcut1'
#include "TestATL2_i.h"
int main()
{
HRESULT hr;
ITestStrcut1* pITS;
CoInitialize (NULL);
MyValue data;
data.x = 5;
hr = CoCreateInstance ( TestStrcut1,
NULL,
CLSCTX_INPROC_SERVER,
ITestStrcut1,
(void**) &pITS );
if ( SUCCEEDED ( hr ) )
{
hr = pITS->SetMyStruct (&data);
pITS->Release();
}
else
{
}
CoUninitialize();
return 0;
}
regards,
George
|
|
|
|
|
It's been a while since I've done ATL, but it's coming back now I was wrong about the .c file not being needed - that's a *different* .c file!
The .c file defines the CLSID and IID for the ATL object and interfaces. You can compile the .c file and incorporate the .obj file into a .lib file - that's what Microsoft do in the Windows SDK (look for uuid.lib) - or just #include the .c file into your client. I usually use the second approach, so if I have generated interface files called a_i.c and a_i.h , I'd use something like the code below in the .cpp file containing my main or WinMain :
#include "a_i.h"
#define INITGUID
#include "a_i.c"
The #define INITGUID causes the code in the .c file to define variables that contain the IID and CLSID.
HTH!!!
|
|
|
|
|
Thanks Stuart,
I am confused about your two solutions.
1. The first solution is to include _i.c file into the COM consumer project, I agree and understand. Is it what you mean?
2. The second solution is to use uuid.lib?? Could this lib file contains all customer defined CLSID/IID, since this lib file is shipped before you write any customized code? I doubt it will have the same effect as solution 1.
regards,
George
|
|
|
|
|
George_George wrote: 1. The first solution is to include _i.c file into the COM consumer project, I agree and understand. Is it what you mean?
Yes
George_George wrote: 2. The second solution is to use uuid.lib?? Could this lib file contains all customer defined CLSID/IID, since this lib file is shipped before you write any customized code? I doubt it will have the same effect as solution 1.
No - I used uuid.lib as an example of how CLSID and IIDs can be packaged - in fact, how Microsoft package up CLSIDs and IIDs for COM objects defined within Windows.
I meant that you could compile your _i.c file and put the .obj file into a .lib file, then get consumers to link against the .lib file you've produced. This way of doing things could be easier if you have several COM components to distribute.
|
|
|
|
|
Thanks Stuart,
Good idea -- "compile your _i.c file and put the .obj file into a .lib file"! You mean a static lib file, and not import lib file, correct?
regards,
George
|
|
|
|
|
George_George wrote: You mean a static lib file, and not import lib file, correct?
Yep, that's right. Create a static library project in VS and add the _i.c file as a source.
|
|
|
|
|
Thanks Stuart,
I like your alternative solution.
regards,
George
|
|
|
|