|
I'm trying to build a library similar to the common dialog controls library. It works, mostly. I have a class CHostWindow:
class ATL_NO_VTABLE CHostWindow :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<CHostWindow, &CLSID_HostWindow>,
public IDispatchImpl<IHostWindow, &IID_IHostWindow, &LIBID_BTS_DLGHELPERLib>,
public CWindowImpl<CHostWindow>
In my Win32 application, I invoke HostWindow, pass to it an interface to the control I want to host, and the window works as you'd expect.
if (SUCCEEDED(Result = iHost.CreateInstance(CLSID_HostWindow)))
{
iHost->Host((PDWORD)&CLSID_DlgFieldProperties, (IUnknown**)&iFieldProps);
iHost->Show(SW_SHOW);
}
This is fine when the control contains basic window elements like pushbuttons and edit boxes but when the composite control contains another control (like the list control in the Resource Editor), the app crashes with an access violation, and according to the stack trace the program is recursively running through the composite control's property list until it runs out of stack space.
I've spent too much time trying to figure this out and now need help! I'm using CAxWindow (memory leak and all) to do the hosting. Can someone explain to me what I might be missing, or point me to some relevant, working, code?
Thanks
Matt
|
|
|
|
|
I'm a student and I'm doing my project:
Build a Certification Authority
Can you give me some informations, links, tutorials, email, which related to this problem ?
Thanks!
Hung Son
A Vietnamese student
i-g.hypermart.net
dlhson2001@yahoo.com
|
|
|
|
|
Windows.NET server has a CA module. I assume there is a similar thing in Win2K server. Try the Microsoft website. Remember that your Root certificate will not be recognised on other peoples PCs if you havent registered it with microsoft or the other CA list providers.
I'm not late, I'm just not as early as I could have been.
|
|
|
|
|
Sorry, but I'm not sure that I understand your idea clearly. Can you tell me some more about your idea.
Thanks
Hung Son
A Vietnamese student
i-g.hypermart.net
dlhson2001@yahoo.com
|
|
|
|
|
Sorry. How much do you know already about CAs, and what are to needing to do with them?
I'm not late, I'm just not as early as I could have been.
|
|
|
|
|
I use msflexgrid in a excel like program to display the app data, but when the data is huge, i mean about 400 items. the additem method will take about 30s to complete. what's wrong? I use vc60 and there is no other way then add each item a time. what can i do? thanks for help
|
|
|
|
|
Why doesnt ClassWizard allow u to override the defaults for non-client area messages?
|
|
|
|
|
Thanks in advanced!;P
|
|
|
|
|
Hello guys,
I'm quite new on COM and maybe what I'm asking it's stupid : in VC++ is there an automatic way to add another interface to an existing class which already has one or I have to do it by hand? If so, in which file I have to add it (idl, header file of the class)?
Thank you very much,
Thomas
|
|
|
|
|
Anonymous wrote:
add another interface to an existing class
Why do you want to add another interface,there are diferrent reason to add it.what do you want to do?
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
I want to add three more methods to the class and while the first interface was "published" already I need another interface (hope I'm right with this ; if not please give me an advice).
|
|
|
|
|
I've been working with binary behaviors for the last two weeks, but the resource in the net is very poor. Anyone of you already work with binary behaviors?
|
|
|
|
|
Hello everyone,
I've been playing around with Excel Automation for a while now, and I'm having a little problem.
I'm using some classes that VC++ automagically generated from the Excel type library. When I try and close the instance of excel I've created, it seems to work, and no errors or exceptions occur. But after my app terminates there is still an excel.exe shown in NT's Task Manager.
Here is the code I'm using to close Excel (It's probably got loads of unneccesary stuff in, I've been playing with it trying to fix the problem):
m_ExcelWorkbook.DetachDispatch();
m_ExcelWorkbooks.DetachDispatch();
m_ExcelWorksheet.DetachDispatch();
m_ExcelApp.SetVisible( false );
m_ExcelApp.Quit();
m_ExcelApp.DetachDispatch();
m_ExcelApp.ReleaseDispatch();
Hope someone can give me some pointers or a link to RTFM.
TIA,
Pete
|
|
|
|
|
Hello,
If I register my DCOM exe server as local server, it works fine.
If I register it as NT Service, the registration seems good but every call to CoCreateIntance failed with the error ERROR_SERVICE_DOES_NOT_EXIST.
If I try to configure with DCOMCNFG.EXE, it prompts the service is installed but it show the same error when I want to apply the modification.
When I go in the Service window, my service is present and I can run it/stop it via the Service Manager. In the EventViewer, I can see the info/warning/error message the server drops.
The DCOM server is developped under VC++ 6.0 with ATL.
Can you give me a hint on how to solve that problem?
I have read the Richard Grimes' book but found nothing. I read it again and again wo any success.
Thanks,
Bruno
|
|
|
|
|
|
I got it.
The name of the LocalService appid entry does not match the service name.
I have chnage the IDS_SERVICENAME and ATL use a hardcoded name one time and I miss to change it.
|
|
|
|
|
Dear All,
I was trying to deploy a application into COM+ which is working fine out of COM+. But it fails to pass an Object ref from one COM+ component to another.
Can somebody help me out/drop a hint ASAP?
The process goes like this.
SERVER-1, SERVER-2, OBJECT are three components deployed in COM+.
---------------------------------------------------------------------------
SERVER1 :
GetObjectContext(&objcon);
objcon->CreateInstance(OBJECT CLSID,.., &obj);
VARIANT vobj;
vobj.vt = VT_VT_DISPATCH; vobj.pdispVal = obj;
printf("%u", vobj.pdispVal ); // display valid address
objcon->CreateInstance(SERVER2 CLSID,...);
SERVER2->func2(vobj);
---------------------------------------------------------------------------
SERVER2 :
printf("%ld", vobj.vt ); // display 9 correct
printf("%u", vobj.pdispVal ); // display 0 i.e. NULL
Tools Used : VC++6, ATL3, Windows2000
Thanx in advance.
Regards,
Rohit Arora
www.dsrsolutions.com
Rohit Arora
|
|
|
|
|
How you define "SERVER2->func2(vobj);" in .IDL file?
soptest
|
|
|
|
|
Dear Soptest,
SERVER2.idl defines function as
[id(2), helpstring("method func2")] HRESULT func2(VARIANT vobj);
Regards
Rohit Arora
VC++ Team Member
rohita@dsrsolutions.com
|
|
|
|
|
You must provide [in] attribute of the argument. Try this:
[id(2), helpstring("method func2")] HRESULT func2([in]VARIANT vobj);
soptest
|
|
|
|
|
If I think right, [in] is the default IDL-method- attribute. Even then I tried, but as expected shows no change in results
Clearly the problem is "The COM+ object reference is valid in the apartment/context where object instance was created, but goes invalid once it is passed to another COM+ component by the originator."
So, being new to COM+, I guess the solution is to marhall the reference on my own, or possibly other solutions exist, hopefully you guys/gals can suggest.
It'll be kind if somebody can explain what Don Box tries to say under "Context Relativity" in this article :
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnmsj99/html/complusprog.asp
Regards
Rohit Arora
VC++ Team Member
rohita@dsrsolutions.com
|
|
|
|
|
If I have a component, that's not an activeX control, that implements connection points, how do I recieve the events from script? I'd like to do something like the following :
<script language="vbscript">
Dim obj
Set obj = CreateObject("XYZ.SomeObject")
Sub ISomeObject_OnSomethingHappened()
'Event was fired, handle it...
End Sub
</script>
Another example is MSXML. The MSXML DOM implements events that can be handled from script. How is this done?
<script>
var xmldoc;
function Load()
{
xmldoc = new ActiveXObject("MSXML2.DOMDocument.4.0");
xmldoc.onreadystatechange = CheckState; <<-- How do I implement this functionality in my component???
xmldoc.load(URL.value);
}
function CheckState()
{
}
</script>
Thanks....
|
|
|
|
|
This is a problem I'm having that is along similar lines to Gerald, I'm trying to use events that are implemented in a com server I created, using JavaScript. I have already implemented a Visual Basic application that works fine with it, and handles the events from the server, so I am confident that the server works fine.
I have also implemented HTML and JavaScript that connects to the sever throught the <object> tags, and it can call functions, and use properties from it, but I can't get it to handle the events from it using tags.
Does anyone know if there is there anything specific I have to implement in the Server, or the JavaScript to make this work?
Cheers,
Dave.
|
|
|
|
|
I have an ATL COM dll with MFC support and am trying get an File dialog to display, I can understand why a CFileDilog would not work, I guess. So I tried to use the GetOpenFileName() function. But whilst this compiles it doesn't display the dialog, it olny return the error code 2, which stands for file can't be found. The code segment I have used is below, if anybody has any ideas I would really like to hear them, Please....
long lErrMsg = 0;
OPENFILENAME ofn;
TCHAR sfile[MAX_PATH];
ZeroMemory(&ofn, sizeof(ofn));
ZeroMemory(sfile, sizeof(TCHAR)*MAX_PATH);
#ifndef NULL_TERMINATE
// Not NULL terminated.
{
int i;
for (i = 0; i < MAX_PATH; i++)
sfile[i] = ' ';
}
#else
// NULL terminated.
sfile[0] = '\0';
#endif
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = NULL;
ofn.lpstrFile = sfile;
ofn.nMaxFile = MAX_PATH;
ofn.lpstrFilter = NULL;
ofn.nFilterIndex = 1;
ofn.lpstrTitle = TEXT("Please Select a File");
ofn.lpstrInitialDir = NULL;
ofn.lpstrCustomFilter = NULL;
ofn.nMaxCustFilter = 0;
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0;
ofn.nFileOffset = 0;
ofn.nFileExtension = 0;
ofn.lpstrDefExt = NULL;
ofn.lCustData = 0;
ofn.lpfnHook = 0;
ofn.lpTemplateName = 0;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
// Call GetOpenFileName().
if (GetOpenFileName(&ofn))
{
MessageBox(TEXT("GetOpenFileName() Successful"), TEXT("OpenDialog"), MB_OK);
}
else
{
TCHAR sErrMsg[256];
lErrMsg = CommDlgExtendedError();
wsprintf(sErrMsg,TEXT("Error %d returned from GetOpenFileName()"), lErrMsg);
MessageBox(sErrMsg, TEXT("OpenDialog"), MB_OK);
}
Cheers
|
|
|
|
|
The Problem is here
{
int i;
for (i = 0; i < MAX_PATH; i++)
sfile[i] = ' ';
}
You generate file name as array of spaces.
get rid of it.
and use :sfile[0] = '\0';
soptest
|
|
|
|
|