|
I can not, because I am using a derived class to embed my dialog class into the tab control, so I need to reflect the messages.
Thanks.
|
|
|
|
|
Define a message ID in the WM_APP range, like this:
#define UWM_SHOW_HIDE_MAIN_WINDOW WM_APP Then in your child dialog:
GetTopLevelParent().SendMessage(WM_APP, show_or_hide_flag); Or you could break it into two messages, one for showing and one for hiding. Handle UWM_SHOW_HIDE_MAIN_WINDOW in your main dialog's message map and show/hide the window accordingly.
|
|
|
|
|
Thanks Mike,
you are as helpful as always. I ran through all of your articles about WTL, but couldn't figure this GetTopLevelParent() out. Thank again.
|
|
|
|
|
I'm using VC 2005, and WTL 7.5. And I cannot for the life of me get intellisense to work with the WTL classes. Has anyone had any luck with this?
Cheers,
- Dan
|
|
|
|
|
It's rather a glib answer - but use Visual Assist[^] - it's a bit pricey, but to be honest, I don't use Visual Studio without it.
|
|
|
|
|
Hi, I'm writing a C++ ATL/COM service on visual studio 20005, my client is written in vb.net also on visual studio 2005.
When I'm trying to call a dcom (on local machine) function the client gets an AccessViolationException.
I have two functions with the same parameters on my interface ,when I call the first function everything is ok and I get the exception only when calling the second function.
I used the attributed flag when I've created the atl class, and I've used custom interface and apartment threading model.
Here are some code lines from my h file:
[helpstring("method Read")] HRESULT Read([in] ULONG address, [in] USHORT dataSize, [in] USHORT stride, [in] USHORT partialDataCount, [in,out, satype("BYTE")] SAFEARRAY **dataBuff, [out,retval] LONG *result);
[helpstring("method Write")] HRESULT Write([in] ULONG address, [in] USHORT dataSize, [in] USHORT stride, [in] USHORT partialDataCount, [in,out, satype("BYTE")] SAFEARRAY **dataBuff, [out,retval] LONG *result);
STDMETHOD(Read)(ULONG address, USHORT dataSize, USHORT stride, USHORT partialDataCount, SAFEARRAY **dataBuff, LONG *result);
STDMETHOD(Write)(ULONG address, USHORT dataSize, USHORT stride, USHORT partialDataCount, SAFEARRAY **dataBuff, LONG *result);
Can any one help me? Please?
Thanks,
Orit
|
|
|
|
|
wrote: Here are some code lines from my h file:
These doesn't help. You need to show, function implemention giving these access violations, and code how you are using it.
|
|
|
|
|
Thanks, I solved the problem by using dual interface instead of custom interface.
My recommendation: use dual interfaces (unless you have a good reason not to), especially if your functions use arrays, I've wasted a lot of time on this.
see:
http://www.codeproject.com/dotnet/opcdotnet.asp?df=100&forumid=2198&exp=0&select=1391649
for more details.
|
|
|
|
|
Good
|
|
|
|
|
hi,
I created two ATL COM projects (Project1 and Project2). If I want to use a enum created in idl file of project1, in the idl file of project2, what are the steps that have to be followed. Please enlighten me.
Thanks in advance.
|
|
|
|
|
First off, I'm running Visual C++ 6.0. With the MFC CDialog class, if you want to provide context-sensitive help for your app, you just define a COMMAND_ID handler in the message map for the ID_HELP message ID. That way, when the user presses F1, the method pointed to in the COMMAND_ID entry in the message map is called and you can display your help app. Is there something similar in an CAxDialogImpl derived class?
|
|
|
|
|
The dialog gets a WM_HELP message when you hit F1.
|
|
|
|
|
Thanks, I'll check this out tomorrow.
|
|
|
|
|
This worked. Thanks again.
|
|
|
|
|
Hi,
I need some tutorial on ATL/WTL/STL to deep understanding, so please suggest me.
Thanks & Regards
Pankaj Jain
|
|
|
|
|
How about CodeProject? ATL[^] WTL[^] STL[^]
"It's supposed to be hard, otherwise anybody could do it!" - selfquote
|
|
|
|
|
For ATL and WTL, start here[^]
|
|
|
|
|
PK Jain wrote: I need some tutorial on ATL/WTL/STL to deep understanding, so please suggest me.
ATL, WTL and STL are unrelated to each other. They just heavily use templates. I would not invest too much into these outdated libraries.
|
|
|
|
|
er, WTL is a set of classes built on the ATL windowing classes.
STL is not outdated.
|
|
|
|
|
|
i have made the plugin in VC for outlook so when i send mail the micorsoft word page remain open i want to close that page so any1 can help me in this regard.
the code for initilizing the word is as follow
if(EditorType==olEditorWord)
{
HWND hwnd;
hwnd = ::GetForegroundWindow();
HRESULT hr = EnumChildWindows(hwnd, &EnumWindowsProc, NULL);
CComPtr<idispatch>Dispatch;
spInspect->get_WordEditor((IDispatch**)&Dispatch);
DISPID dispp;
OLECHAR FAR* szMemberpName;
EXCEPINFO pexcep;
UINT uArgErr;
DISPPARAMS disparams={NULL,NULL,0,0};
szMemberpName = L"Close";
VARIANTARG ApResult;
Dispatch->GetIDsOfNames (IID_NULL, &szMemberpName, 1, LOCALE_SYSTEM_DEFAULT, &dispp);
hr = Dispatch->Invoke(dispp, IID_NULL, LOCALE_SYSTEM_DEFAULT,DISPATCH_METHOD, &disparams, &ApResult, &pexcep, &uArgErr);
if(FAILED(hr))
{
_bstr_t des;
char * ii;
des = pexcep.bstrDescription;
ii = (char*) des;
}
else
{}
|
|
|
|
|
Hi,
I have to post a message froma thread that I have created and I cant seem to find the DefWindowProc that is usually in a MFC program, so how does one actually perform an action when a message is triggered.
I am completely new at ATL, any help would be greatly appreciated.
Thanks
|
|
|
|
|
This[^] article should help you.
|
|
|
|
|
|
IMO, it can be done differently. No need to create a server B. Just call your COM object like in the snippet below.
try
{
long lResult = DoIt();
}
catch(...)
{
// Just in case
LogError(_T("Unhandled exception occured.");
}
long DoIt()
{
long lResult = 0;
try
{
ComLibrary::IComLibraryPtr ipExt("Prog_ID");
lResult = ipExt->Main("SomeParam");
if (lResult < 0)
{
LogError("ComLibrary has requested a stop by returning a negative value %d.", lResult);
}
}
catch( _com_error& Err)
{
if (0x800401f3 == Err.Error())
{
LogError("Error creating ComLibrary. Invalid ProgID.");
}
else if(0x8007000e == Err.Error())
{
LogError("Error invoking Main. It is likely that the ComLibrary crashed.");
}
else
{
LogError("Error invoking ComLibrary.");
}
}
catch(...)
{
LogError("Error invoking ComLibrary. Received an unhandled & unknown exception.");
}
return lResult;
}
|
|
|
|
|