|
Hi,
if made a MFC acticeX control and anything works fine. if got a event called myData that returns a string, no Prob (VC++ 6 wiz does the most stuff by click, nice)
but now, i need a event then will return a alt-class called clsData.
can someone help me out?
thanx a lot and please have partience, i'm new a programming vc++
yours thorsten
|
|
|
|
|
I want to access the data files in the same dir as DLL,so I need the pat name of the DLL. I use following:
GetModuleFileName(m_hInst,pszDLLpath_buffer,_MAX_DIR);
and it seems not work.
|
|
|
|
|
place the DLL in Winnt/system32 and use this path
|
|
|
|
|
Anyone has some doc/sample about this?
Thanks!
---------------
Tired of Spam? Introducing InboxShield® for Microsoft® Outlook®
http://www.edovia.com
|
|
|
|
|
|
I'm new to ATL and struggling. Forgive me if this is a really dumb question!
I've managed to put together a simple WTL/ATL app, hosting an ActiveX and picking up enents back from the ActiveX.
But now I want to write some text to the StatusBar. OK, I can do that (using a multi-pane status control as per Ed Gadziemski's excellent article), from within the Main Window.
But I want to write to it from the Child Window. Only I cannot find any method of the child window which will give me a pointer back to the main window and hence to the Status Control.
See, I said it was dumb! Thanks for any guidance.
Tony Hedge
|
|
|
|
|
This might not be the "correct" way of doing it, but this is how I have always done it. When I create an instance of my child windows, I pass a pointer of the main window to them. Then I just store that pointer for later use. It might not be "clean", but it gets the job done very simply and easy to understand.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Tim Smith wrote:
When I create an instance of my child windows, I pass a pointer of the main window to them.
Thanks - I was beginning to think along those lines, but thought there might be some 'intrinisic' way of doing it.
Regards
Tony
|
|
|
|
|
I'm pretty sure I'm missing something obvious, but can't CWindow::GetParent do the job?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Joaquin
That can certainly get me an HWND, but then I get lost. I cannot see how to then get a pointer to the window, or get access to the StatusBar via the HWND.
Thank
Tony
|
|
|
|
|
CStatusBar(hParent).SomeFunctionYouCannotLiveWithout();
|
|
|
|
|
In stdafx.h, replace
extern CAppModule _Module; with
template <typename TWnd>
class CMainWindowedAppModule : public CAppModule {
TWnd* m_pWnd;
public:
void SetMainWindow(TWnd* pWnd) {
m_pWnd = pWnd;
}
TWnd* GetMainWindow() {
return m_pWnd;
}
};
extern CMainWindowedAppModule <class CMainFrame> _Module;
And in <YourAppNameHere>.cpp, replace
CAppModule _Module; with
CMainWindowedAppModule <class CMainFrame> _Module;
and don't forget to call SetMainWindow() in Run() before entering the message loop.
Nice and simple if HWND isn't enough. Plus, you can stick other stuff into that class too if you want/need.
--
There's a new game we like to play you see. A game with added reality. You treat me like a dog, get me down on my knees.
We call it master and servant.
|
|
|
|
|
Hehe.. Or you can just make a global variable and be done with it.
(runs and hides)
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Tim Smith wrote:
Hehe.. Or you can just make a global variable and be done with it.
That would be too easy. Remember, I'm a programmer. I love complexity.
--
There's a new game we like to play you see. A game with added reality. You treat me like a dog, get me down on my knees.
We call it master and servant.
|
|
|
|
|
Tim Smith wrote:
Hehe.. Or you can just make a global variable and be done with it.
(runs and hides
It's all right Tim - I've got a colleague who suggested just the same thing. He ran away too, just before my copy of "ATL Internals" hit the wall where he had been standing!
Tony
|
|
|
|
|
*snicker*
Be careful though. You don't want to ruin your favorite books now do you?
--
Eventhough the forrest is full of trees, there's still no tree between the trees.
|
|
|
|
|
he he. Cool. I do something similar using the following class:
class CMainFrame;
class CParentFrame
{
private:
CMainFrame* m_pMainFrame;
public:
CParentFrame() : m_pMainFrame(NULL)
{
}
CMainFrame* GetMainFrame() const { ATLASSERT(m_pMainFrame != NULL); return m_pMainFrame; }
void SetMainFrame(CMainFrame* pFrame) { m_pMainFrame = pFrame; }
}
I then derive each view from CParentFrame, remembering to call the "SetMainFrame" function when I create the view. The view can then call GetMainFrame()->Blah() , etc.
When I am king, you will be first against the wall.
|
|
|
|
|
Here's one technique to update the status bar from a child window. It only supports the first pane, though.
HWND hWnd = ::GetDlgItem(GetParent(), ATL_IDW_STATUS_BAR);<br />
CStatusBarCtrl sb = hWnd;<br />
sb.SetWindowText(_T("My status bar text"));
Note that GetDlgItem obtains the handle of any child window as long as the child was created with a defined ID such as ATL_IDW_STATUS_BAR. Default WTL IDs are defined in atlres.h.
|
|
|
|
|
If I have a vector:
std::vector<CMyClass>m_vMyVector;
And in a function I do:
foo()
{
CMyClass obj;
m_vMyVector.push_back(obj);
}
When obj goes out of scope, will a copy still live in m_vMyVector?
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
Nitron wrote:
When obj goes out of scope, will a copy still live in m_vMyVector?
Yes
--Mike--
I'm bored... Episode I bored.
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
thanx!
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
|
When building some ATL projects that we're upgraded to version 7.0 of the Visual C++ compiler; the post build regsvr32 step always fails. I have tracked this down to the binary not being created before regsvr32 is called.
In the post build step we have
regsvr32 /s /c "$(TargetPath)"
Has anybody seen this? If so how did you fix it. Thanks in advance.
-chad
|
|
|
|
|
It's most likely something in the registration code within the DLL that is the error. Chances are that it's segfaulting.
--
There's a new game we like to play you see. A game with added reality. You treat me like a dog, get me down on my knees.
We call it master and servant.
|
|
|
|
|
Hi,
I can't get bitblit to work with WTL. It keeps printing a black square. But the size of the square is equal to the size of the image it should print so i think i'm forgetting something. I'm converting my Win32/SDK app to WTL and in Win32/SDK it works. This is the code i'm using:
<br />
CBitmap Image;<br />
Image.LoadBitmap(238);<br />
<br />
CPaintDC dc(m_hWnd);<br />
CDC hdc;<br />
hdc.CreateCompatibleDC(dc.m_hDC);<br />
<br />
BITMAP Temp;<br />
Image.GetBitmap(&Temp);<br />
SelectObject(hdc.m_hDC,&Temp);<br />
dc.BitBlt(50,50,Temp.bmWidth,Temp.bmHeight,hdc,0,0,0);<br />
I tried making a filledrect with the same DC object and it worked. Thanks for all help.
|
|
|
|