|
the program control will run MyFun()
then it will call FunSendingMessage(), since it is using SendMessage, the main function MyFun will not regain control until the function MessageHandleFun() will finish and return....
so basically you don't have to do anything
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Hi!
In my project, I am importing a class which contains a STL map as a member from a DLL (not written by me). My goal is to inherit a class and then add function that needs to access the map directly, i.e. there are no functions that return reference to this map so I could avoid map's protected scope. Class already contains similar functions that work properly.
(To demistify things a bit, the class is used for communication and uses TCP protocol via its own functions. I would like to inherit from the class and override some of the functions to make them use UDP protocol).
The problem is when my function is trying to access the map (at run-time), the whole thing crashes. Using VS2005 debugger, I have detected that in my function, the map object seems to be invalid (it still appears to be of map type but its size and content do not make any sense). If I try to log the content of the map (instead of accessing it) using functions which are already in the class, everything passes OK.
What puzzles me is that I managed to achieve the same thing a few months ago in another project, but I can't retrace my steps or reproduce the same result. I never changed and/or recompiled the library.
TIA for your help (and I apologize for the length)
Marko
P.S. Class header file looks in short like this:
#include ...
class OriginalClass {
public:
...
_declspec(dllimport) Function();
...
protected:
map<string, unsigned="" int=""> myMap;
};
|
|
|
|
|
mbudisic wrote: P.S. Class header file looks in short like this:
#include ...
class OriginalClass {
public:
...
_declspec(dllimport) Function();
...
protected:
map myMap;
};
You should export/import the whole class with the usual macros.
|
|
|
|
|
Yes, but as I stated, I didn't write the library and yet managed to somehow work around it (by some magic, apparently, since I can not reproduce it). What good is having protected members in such a class, anyway?
Thank you for your reply.
Marko Budisic
|
|
|
|
|
Hi!
I'm using SetViewportExt, SetWindowExt to zoom a CImage picture. My problem is with zoom out. Let's say I want to zoom out to 50%. The image resulted is full of noises. I also used StrechBlt and got a better result but I would like to implement zoom features using SetViewportExt and SetWindowExt, and have the same result for zoom out like StrechBlt.
Can anyone help me?
Thnks.
Bogdan C
|
|
|
|
|
Hi all,
I need to repaint a child window in my MDI application, which need not be active. If use MDIGetActive and MDINext to traverse the children, I am able to see a flickering. When the desired child is getting repainted, I am calling MDIActivate(pFirstChild) to reset the active child.
I'd like to do this using CDocument's GetFirstViewPosition and GetNextView. Kindly check the following code snippet: The problem is, the while loop executes exactly once, even though I open three child windows.
pos = pDocument->GetFirstViewPosition() ;<br />
<br />
while(pos)<br />
{<br />
CMyView *pView = (CMyView *) pDocument->GetNextView(pos) ;<br />
<br />
if(pView->m_childNum == m_usChildNo)<br />
{<br />
pView->SetDisplayData() ;<br />
pView->Invalidate() ;<br />
break ;<br />
}<br />
}
Where am I wrong?
Thanks in advance,
Sarvan AL
-- modified at 7:13 Monday 17th April, 2006
|
|
|
|
|
I can see a break in the if condition.maybe that is why the loop occurs once?
try to debug it
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Hi Sarvan AL,
Why you use break in your code?
|
|
|
|
|
Hi WhiteSky,
Let me explain the scenario in detail.
I have one CScrollView derived class (Type-1) and Four CFormView derived classes (Type-2). I open three objects of Type-1. From the menu, I am changing the font and like to repaint all three windows. I have only one document. The GetNextView in the while loop makes the -pos- parameter NULL when I trace.
I open the child windows using the following function, with document name "MyView".
void CProj5App::OpenForm(CString strDocName)<br />
{<br />
CString strDoc ;<br />
POSITION pos = GetFirstDocTemplatePosition() ;<br />
<br />
while(pos)<br />
{<br />
CDocTemplate *pDoc = GetNextDocTemplate(pos) ;<br />
pDoc->GetDocString(strDoc, CDocTemplate::docName) ;<br />
<br />
if(strDocName.CompareNoCase(strDoc) == 0)<br />
{<br />
pDoc->OpenDocumentFile(NULL) ;<br />
break ;<br />
}<br />
}<br />
}
Where I am wrong?
Thanks in advance,
Sarvan AL
|
|
|
|
|
Where's the class wizard in VC7.1 ? How can I handle events for my Dialog ? when I right click on the dialog, I dont find "add Event Handler" , I know I'm quite late to notice it. But please help me , is there any round about way to reach the wizard ?
NULL
|
|
|
|
|
|
Hi,
i want draw graph which has got time in sec on X-axis and on Y axis i have different parameter Say A,B,C..Say A in temprature B is VOlts etc..i.e for A,B,c X-axis is same Y-Axis varies , Is there example which will meet my requirement..If any thing is not clear pls let me know so that i will clarify,i am in urgent need of it.
Its very similar to diagram in below URL pls check the URL
http://www.memorytesters.com/sim2/s2_ap11.htm
James rocky
-- modified at 6:31 Monday 17th April, 2006
|
|
|
|
|
I think you are going to plot something... then you have some readings with constant time intervals, right?
Then take these values in an array (or arrays for A, B, C, etc.).
Can you do these things?
- NS -
|
|
|
|
|
Is there any sample application to implement the timing diagram concept?
|
|
|
|
|
I'm sorry. I don't have any sample with me.
- NS -
|
|
|
|
|
My problem is that when i rotate my multiline text 180 degrees , the text is rotated but the ordering of lines in the text is wrong as the first line comes as last and last line comes as first(for eg. if i have two lines line1 & line2 then after rotation line2 is displayed and below it line1 is diaplayed).I have passed the DT_WORDBREAK as parameter to the CDC drawtext function to handle word wrapping.
Is ther any other way to handle rotation of multiline text?
Kindly let me know
|
|
|
|
|
The following example shows how to rotate text at any angle (doesn't work on 95/98/ME). It renders text at (50, 50) rotated 30 degress clockwise.
--------------------------------------
CPaintDC dc(this);
int OldMode = SetGraphicsMode(dc.m_hDC, GM_ADVANCED);
static const double pi = 4.0*atan(1.0);
static const double angle = 30.0*(pi/180.0);
static const XFORM xf = {cos(angle), sin(angle),
-sin(angle), cos(angle),
0, 0};
SetWorldTransform(dc.m_hDC, &xf);
CRect rcClient;
GetClientRect(&rcClient);
rcClient += CPoint(50, 50);
dc.DrawText(_T("Hello\nThere"), -1, &rcClient, 0);
SetGraphicsMode(dc.m_hDC, OldMode);
--------------------------------------
Steve
|
|
|
|
|
hi all,
plz tell me how to draw colored button in mfc
thanks in advanced
Rahul here
|
|
|
|
|
You have to use ownerdraw...
- NS -
|
|
|
|
|
|
Hi rahul.shendurnikar,
You can use derived CButton and use WM_DRAWITEM in class
|
|
|
|
|
Hi all,
I have a CTreeCtrl as a child of a docking window (CMyBar). In my docking window class I set a handle just like this:
(
CMyBar.cpp)<br />
ON_NOTIFY(TVN_SELCHANGED, ID_TREE, OnTreeChange) ...<br />
The declaration of the function is
(CMyBar.h)<br />
afx_msg void CMyBar::OnTreeChange(NMHDR *hdr, LRESULT *NotUsed)<br />
I had to explicity add the ON_NOTIFY handler because the Visual Studio6 ClassWizard doesn't show the ON_NOTIFY event for my docking class (CMyBar), (don't know why?).
As far as I know CTreeCtrl does send ON_NOTIFY notifications to it's parent (CMyBar). Spying++ CMyBar window class shows CMyBar gets WM_NOTIFY messages...
Now all this crap doesn't work (OnTreeChange never gets called), and I'm to figure out what's going on and what's wrong with it.
Would be really happy if someone can answer this question...
Thank you!
|
|
|
|
|
try to look with spy on the Tree Control properties, perhaps it has a flag indicating not sending a parent notify (WM_PARENTNOTIFY).....in my code the selchange does call the parent notification and the method OnTreeChange does get called....
hope this helps
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Hi Yaron,
Thanks for the reply... But the problem is my parent window (CMyBar) does get WM_NOTIFY and VM_PARENTNOTIFY messages(I've checked it with Spy), but my method OnTreeChange never gets called...
I'm new to MFC and I'm sure I'm missing something here.
Jim Jim
|
|
|
|
|
well, if you have checked it with spy and the Bar does get the WM_NOTIFY message, then check the id of the tree control (IDC_TREE) check the name of the function.....other than that it suppose to work....
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|