|
I'm having difficulty using this method, specifically...
lResult = reg.QueryStringValue("PathOut", regtext, sizeof(regtext));
It would be nice to see some examples using this CRegKey method or something. I can't seem to nail down the third parameter...
"The size, in TCHARs, of the buffer pointed to by pszValue. When the method returns, pnChars contains the size, in TCHARs, of the string retrieved, including a terminating null character."
TIA
Ryan
|
|
|
|
|
TCHAR szBuffer[128];
DWORD dwSize = sizeof(szBuffer) / sizeof(TCHAR);
lResult = reg.QueryStringValue ( _T("PathOut"), szBuffer, &dwSize );
--Mike--
When 900 years old you reach, look as good you will not. Hmm.
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
|
Can somebody help me showing me how do I create two differente types of view.
My project is using ATL/WTL and is a MDI.
What I need is to be able to show two Childwindows with different content. One of them has to show my sales and the other my clients catalog.
|
|
|
|
|
Hi
I wrote the code to parse xml.I used smart pointers.i want to know wheather my code is correct.As i used smart pointers, i think no need to call release.But iam not sure about that wheni go through loop.Any suggestions would help me to do better.
IXMLDOMDocumentPtr docPtr;
IXMLDOMNodeListPtr NodeListPtr,NodeListPtr1;
IXMLDOMNodePtr DOMNodePtr,NextItemPtr,NextItemPtr1;
IXMLDOMNamedNodeMapPtr NamedNodeMapPtr;
docPtr.CreateInstance(_T("msxml2.domdocument"));
for(int i=0;i < NodeListPtr->length;i++)
{
NodeListPtr->get_item(i,&NextItemPtr);
NodeListPtr1=NextItemPtr->childNodes;
for(int k=0;k<nodelistptr1->length;k++)
{
NodeListPtr1->get_item(k,&NextItemPtr1);
if(strcmp(NextItemPtr1->nodeName,"IMAGE")==0 || strcmp(NextItemPtr1->nodeName,"HOTIMAGE")==0)
{
strcat(destpath,"\\");
strcpy(fullpath,NextItemPtr1->text);
ReturnFileName(fullpath,XmlFileAppPath);
strcat(destpath,XmlFileAppPath);
//MessageBox(NULL,destpath,"Value",MB_OK);
DownloadFile(NextItemPtr1->text,destpath);
strcpy(destpath,"");
}
}
}
NodeListPtr=NULL;
DOMNodePtr=NULL;
docPtr=NULL;
NextItemPtr1=NULL;
NextItemPtr=NULL;
NodeListPtr1=NULL
|
|
|
|
|
Seems OK. Do you have memory leaks?
AlexO
P.S. For performance the following might be an improvement
for(int i=0;i < NodeListPtr->length;i++)
should be
for(int i=0, count = NodeListPtr->length;i < count;++i)
|
|
|
|
|
Your code looks fine, but you dont need the following:
NodeListPtr=NULL;
DOMNodePtr=NULL;
docPtr=NULL;
NextItemPtr1=NULL;
NextItemPtr=NULL;
NodeListPtr1=NULL
Your smartpointers are automatically deleted when they goes out of scope
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
hi there,
I have a dialog and in it i have a button on which I want to send mail to a particular person. It just has the email address like someone@someone.com. when i click on it I want this E-mail to be entered into outlook's To address field. How can i do so. My guess was that there should be some function or methind doing so but could not find any. Can Anyone please help..
Himanshu
|
|
|
|
|
something like ShellExecute(NULL, "Open", "mailto:someone@someone.com", NULL, NULL, SW_SHOWNORMAL);
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
I design a COM object by ATL, which has two IDispath. Default dispatch is IPlot2D, and the second is IMIDraw.
IMIDraw has a method Plot(), how do I launch Plot() method?
|
|
|
|
|
You can not. There is a rule(standard) of COM which states that you can only have one dispatch interface in the COM object. The reason for that is that late binding clients(VBS) use QueryInterface(IDispatch)/Invoke(methodID) for everything.
1. You can try to implement IMIDraw as separate object and expose it through a method of IPlot2D.
2. If they are polymorphic you can try to derive IMIDraw from IPlot2D, this way you can expose both interfaces and not violate the rule.
|
|
|
|
|
In addition to the previous reply, you can choose to implement your own IDispatch which will take care of all the methods for both interfaces. However, it is not the best solution, and you will have to take care to name clashes.
|
|
|
|
|
Thank you very much, solon.
I put a new method Plot0() in IPlot2D, and Plot() is launch there. It's OK.
Thanks again.
|
|
|
|
|
this is not exactly what I meant – I was talking about a custom implementation of IDispatch, where you redirect the Invoke call to the appropriate IDispatch implementation.
|
|
|
|
|
Hi again,
I am interested in writing a com/alt/ole object/server. Oh hell, I don't know what I want to write.
What I want is an object that you can insert into word or Autocad, that displays information with a customizable view. The object is to be created by a seperate desktop app, that embeds the data. I have played around with VC++ MFC AppWizard to create an ActiveX full server. This is kind of what I want. The UI that I envisioned was just a simple dialog box, not the inplace frame thingy that you get with MFC. Also, it is possible that this object will eventually wind up on the web so I was hoping to avoid MFC.
I have played around a little with an ATL full control. Can I register the control somehow so that it is avalible from the insert object menu in word? If not a control, ATL must have a template to serve my needs.
Maybe someone could point me in the right direction as far as what technology I should be studying for the desired outcome. COM is such a big topic !!!
Thanks,
Paul
ps. Think I need some
|
|
|
|
|
The task your planning is very interesting, but could be very difficult. One item on your list is easy, use ATL wizard to create full control, and make sure insertable is checked. As for the rest, you might want to go ALT/WTL, however only ATL part is well documented (check out MSDN samples/tutorials). The only decent resource for WTL I know of is ... this site. Check out the collection of the samples & libraries at http://www.codeproject.com/wtl. I am guessing your are new to COM (forgive me if I am wrong), so check out "http://www.amazon.com/exec/obidos/tg/detail/-/0201634465/qid=1041259989/sr=8-2/ref=sr_8_2/104-4316939-3607113?v=glance&s=books&n=507846" - it might help you.
|
|
|
|
|
Paul Silvernail wrote:
Can I register the control somehow so that it is avalible from the insert object menu in word?
There's a checkbox for this in the ATL wizard IIRC.
--
Only in a world this sh*tty could you even try to say these were innocent people and keep a straight face.
|
|
|
|
|
I'm using a COM Object that have a ConnectionPoint (event) that looks like this:
void RecognitionStoppedEvent(
RecognitionType RType,
ReasonType Reason,
IKVSet* RecResult);
Then I use a class that inherits from IDispatchImpl to receive the event.
Everything works fine, except I cant use the IKVSet*, I get an exception and the function just exists
An IKVset's IDL looks like this: interface IKVSet : IDispatch {code....}
I use this "definition" in my implementation of the event, but I'm not exactly sure about the VT_DISPATCH , is this the right varenum?
static _ATL_FUNC_INFO OnRecognitionStoppedEventInfo = {CC_STDCALL, VT_EMPTY, 3, {VT_I4, VT_I4, VT_DISPATCH}} ;
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
VT_DISPATCH corresponds to IDispatch* so that is correct. The event probably sends an IDispatch* , not an IKVSet* , so I'd first suggest QI'ing the pointer for IKVSet
--Mike--
If it doesn't move and it should: WD-40. If it moves and it shouldn't: duct tape.
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Thanks a lot Mike, it did the trick
Why did'nt I think of that my self
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Don't worry! There are only VT_DISPATCH and VT_UNKNOWN to mark interfaces. VT_DISPATCH is used for interfaces which derived from IDispatch prior to IUnknown.
Try to QueryInterface of IID_IKVSet on your pointer and check the HRESULT returned.
Or check __stdcall keyword which must be presented for "RecognitionStoppedEvent" function.
With best wishes,
Vita
|
|
|
|
|
Sould this work in the ATL class CAxDialogImpl?
LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
// IDC_NAME is a textbox
::SetDlgItemText(::GetActiveWindow(), IDC_NAME, _T("Wahoo!!!");
return 1; // Let the system set the focus
}
or should it be done differently?
Thanks,
Paul
|
|
|
|
|
Use CWindow::SetDlgItemText() instead:
SetDlgItemText ( IDC_NAME, _T("Wahoo!!") );
--Mike--
If it doesn't move and it should: WD-40. If it moves and it shouldn't: duct tape.
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Hello All,
In VS.NET General project property page, there is this property
"Use of ATL".
What really is the meaning of this? Even in WTL project generated
with the wizard, this property is set to "Not Using ATL".
This is what the documentation/help has to say:
Use of ATL
Specifies whether the ATL project will statically or dynamically link to the ATL .DLL.
If you specify anything other than Not Using ATL, a define of some kind will be added
to the compiler's Command Line property page.
What is the "define of some kind" that the documentation is refering to here?
Best regards,
Paul.
Jesus Christ is LOVE! Please tell somebody.
|
|
|
|
|
_ATL_DLL - is one of them. The second I do not know.
|
|
|
|