|
Thanks for you help...because I took a look from a far, I can now read the entire body of the message. The way I did this was first of all, I "Read the ____ing Manual". MAPI says that if you have a large message to read, you should do the following (I felt you deserved how I got it to work!:
hr = pmsgRoute->OpenProperty(PR_BODY, STGM_READ, (LPUNKNOWN FAR *) &lpstreamBody);
if(S_OK != GetScode(hr))
{
DebugTraceResult(OpenProperty, hr);
goto err;
}
hr = lpstreamBody->Stat(&statstg, STATFLAG_NONAME);
if(S_OK != GetScode(hr))
{
DebugTrace("IStream::Stat failed");
goto err;
}
Assert(statstg.cbSize.HighPart == 0);
if(MAPIAllocateBuffer(statstg.cbSize.LowPart + 1, (LPVOID FAR *) &lpszNoteText))
{
goto err;
}
hr = lpstreamBody->Read(lpszNoteText, statstg.cbSize.LowPart, &cb);
if(S_OK != GetScode(hr))
{
DebugTrace("IStream::Read failed");
goto err;
}
lpszNoteText[statstg.cbSize.LowPart] = '\0';
SetDlgItemText(hDlg, IDC_RTNOTE, lpszNoteText);
MAPIFreeBuffer(lpszNoteText);
lpszNoteText = NULL;
lpstreamBody->Release();
lpstreamBody = NULL;
Thanks in advance,
Dan
|
|
|
|
|
I have declared a pointer to a function like this :
double (*pF)(double);
I have a function in a class CTest declared like this : double CTest::Compute(double);
the following code : pF =&Compute, doesn't work ????
The message error is :
"& : illegal operation on bound member function expression"
for compiler the function nammed Compute is Virtual...
So, How can I point a class member function ???
Leon
|
|
|
|
|
in general, you can't use member functions with function pointers unless the function is declared "static".
-c
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|
|
There is no need of assigning the address like pF = &Compute;
The right way is pF = Compute;
|
|
|
|
|
Because the type of the Compute function is double (CTest::*)(double) .
--Mike--
http://home.inreach.com/mdunn/
"Holding the away team at bay with a non-functioning phaser was an act of unmitigated gall. I admire gall."
-- Lt. Cmdr. Worf
|
|
|
|
|
Hi,
You need to write pF = Compute, and not pF =&Compute.
Lose the & .
I hope that helps
|
|
|
|
|
Member function are different from global / static functions because they have an implicit this pointer as argument.
You have to declare a pointer to a class member function like this:
double (CTest::*pF)(double);
Read pF is a ptr to a member of CTest with takes double and returns double.
To assign the member function to the pointer do this:
pF = CTest::Compute;
To call the member function you need an instance of the class (because of the needed this pointer):
CTest test;
CTest* pTest = &test;
The call looks like this:
(pTest->*pF)(42);
Oliver
|
|
|
|
|
I use a CStringList to store all my outputs and everytime I finish an operation, I save the output to this list and print the whole CStringList out to the screen. and I have a scrollbar to let user to scroll back to see some previous outputs.
I have a touchscreen and I use WindowProc in view.cpp to wait for the "touch" and extract the window message and get the touch coordinate. These coordinates will store in a CList and also save to the CStringList for output.
OK.....when I touch the screen, and my program keeps displaying the touch coordinate. But after awhile, something strange......sometimes...the screen scroll backward!!!!! sometimes, it cannot display any more touch(just hear the beep sound...but no more output...) Another example, I display some values from the touchscreen and using a loop to do it.....that means i can do it forever until I stop it. Sometimes.....after awhile, the output will "overlap"....and strange characters....
This situation is more worse and happen faster in Win9x...... WinNT is more stable...but this situation did happen too in WinNT.....
What's going on ?????
|
|
|
|
|
I am using a third-party product and I pass a device context to their function to print a bar code. The return value is the size of the bar code (height and width). There is no way for me to know the height and width of the bar code prior to this call. Is there some way to call this function to get the height and width and NOT actually draw the bar code? My current solution is to use CreateCompatibleDC, pass that handle to the function, and delete the DC once I have obtained the height and width. I would appreciate any better ideas.
|
|
|
|
|
That sounds like the right approach to me.
The only other thing you might try, and this might not work depending on what the function does, would be to set the clip region of the DC to something silly, so that the rendering would not be apparent - some thing like:
CRgn rgn;
rgn.CreateRectRgn(0,0,1,1);
DC.SelectObject(&rgn);
DC.SelectClipRgn(&rgn, RGN_COPY);
...
Thats the MFC version, assuming a CDC. Will be similar for straight GDI.
Your solution is safer, I think, but this might let you get by without creating another DC if the third party function doesn't mess with the clipping region.
|
|
|
|
|
Greetings,
I was wondering how can I have multiple fonts per line using DrawTextEX?
I am stuck using DrawTextEX instead of TextOut(which you can use the msdn example "Drawing text from diferent fonts on the same line) due to a proprietary set of sdk functions which I cannot change that are built on DrawtextEX.
An approach that I have taken is that I have divided each line into seperate segments of text based upon what each segment should have for a font. Any font changes, and I place it in a seperate segment (which is a string array for now).
I then loop through the array and change the font of the dc to what the segment requires, and then I do a "DrawTextExtentPoint32" on each segment(array position), and use that to create my rect size per line to output the text. Which I follow with a call that is similar to DrawtextEx for outputting my text.
The PROBLEM I am having is that the I can't seem to get each text segment to draw so that it blends seamlessly. So that some text's rects draw the text in a higher Ascent than others. The result gives a line of text that draws the text starting in the corner, so that if a segment of text is a smaller font size than the next the smaller font text will appear higher on the screen than the next one.
If anyone knows of a better way to do multiple fonts per line using DrawTextEX, or a way to fix my rect feel free to drop me a comment. I am stuck right now.
Thanks in advance for any help!
|
|
|
|
|
Try setting the DC's aligment mode with
SetTextAlign( dc, TA_BASELINE )
Hope this helps !
|
|
|
|
|
Thanks for the GREAT suggestion (I hadn't thought of that one), but unfortunately it causes the text to vanish if I have it anything but TA_TOP|TA_LEFT [The default from msdn]. Oh, well back to the drawing board.
|
|
|
|
|
Greetings all,
After many hours of sweat and tears I think I figured out a solution to my problem.
1.) First loop through all the fonts to find the largest font.
- Do a "GetTextExtent32()" to get the SIZE, and then do a "GetTextMetrics()".
SIZE MySize; TEXTMETRIC tm;
int nMaxAscent; int MaxLineHeight;
Now add the (MySize.cy + tm.tmDescent) together, and save them in a variable (MaxLineHeight).
Also save the tm.tmAscent in a variable (nMaxAscent).
2.) When you are drawing the font's segment, check to see if the size is less than the max font size.
- If it is smaller then figure out how much we need to offset the smaller font.
TEXTMETRIC CurrentAscent; // DO a "GetTextMetric" on your current font.
int nOffset = nMaxAscent - CurrentAscent;
Then use the offset with the rect's top.
Rect.top = Rect.top + nOffset;
3.) Finally add the descent the maxline height to the top of the rect to get the bottom.
rect.bottom = rect.top + nMaxLineHeight;
And now finally my text is lined up in a wonderful straight line!!!
It only took almost a whole day of work (and 4 mountain dews) to figure it out, SIGH!!!
Oh well, at least it works.
|
|
|
|
|
Lately my DS crashes consistently when I am closing the DS or randomly while working. The error messages are:
"The instruction at 0x77fca8ac referenced memory at 0x00000005. The memory could not be written."
After OK the above message the next one is :
"The instruction at 0x6c371351 referenced memory at 0x00000004. The memory could not be read."
I posted the addresses for example only. Anybody ran into this? I tried to reinstall VC++ (6.0) with no results, OS W2k.
Thanks
Mihail
|
|
|
|
|
Do you installed some new product lately?
I have the Visual Studio 6.0 working really fine in my W2K. I had no problems, never.....
I remember that I had these type of message in Visual Basic when I used the Formula one Grid....
Cheers!!!!
Carlos Antollini.
|
|
|
|
|
Just XML Spy, but I had this problem before. Don't use the the Formula One Grid, I am using the Stingray Objective grid.
|
|
|
|
|
i would like to know if anybody has created an application which use ado method to catch excel database.
i'm new in visual c++ programming, so if you could help me
gerald
|
|
|
|
|
The easiest way would be to setup an "ODBC Data Source" using the control panel ODBC Data Sources app. Then you can use it the same way as with any other ODBC data source.
To see your tables in excel from the ODBC interface, you have to select the rows that make up the table and then use "Insert | Name | Define" to give a name for the table. The text in the first row would be identified as column names.
I hope this helps you. Please let me know if you face further problems.
--Thomas
modified 29-Aug-18 21:01pm.
|
|
|
|
|
What Thomas says is certain, I want to add that the name of the sheet is the name of the table.
If in the sheet the first row have not the name of the field, you can reference this in yourt querys with numbers. "Select 0,4,5 From Sheet01" where 0 is the field 0....
Best Regards and Good Luck!!!
Carlos Antollini.
|
|
|
|
|
Are you sure that ADO isn't better and more flexible than ODBC? But it's just a proposition, it's the first time i have to do this kind of job, so....
gerald
|
|
|
|
|
Instead of using the ODBC driver for ADO, you can also use the -
Microsoft.Jet.OLEDB.4.0 provider and use Engine Type as "Excel 8.0". There are examples in MSDN that does that, but they are mostly VB examples.
But, with ODBC driver, your code will be much easier as you can use "DSN=DataSource;" as the connect string for the ADO Recordset open.
Note: I have never used Excel through the Jet ADO driver. So I am not sure of the syntax.
Personally, I prefer using OLEDB over ADO in VC++. I use the OLEDB consumer templates. If you want to check this out you can look in MSDN for
CDataSource
CSession
CDynamicAccessor
classes.
-- Thomas
modified 29-Aug-18 21:01pm.
|
|
|
|
|
try this:
http://support.microsoft.com/support/kb/articles/Q278/9/73.ASP
|
|
|
|
|
Hi All,
I have a CMyListCtrl (derived from) CListCtrl on a CMyPropertyPage (derived from CPropertyPage).
In CMyListCtrl I try to handle several header control notifications:
ON_NOTIFY(HDN_BEGINTRACK, 0, OnHeaderBeginTrack)
ON_NOTIFY(HDN_ENDTRACK, 0, OnHeaderEndTrack)
ON_NOTIFY(HDN_BEGINDRAG, 0, OnHeaderBeginDrag)
ON_NOTIFY(HDN_ENDDRAG, 0, OnHeaderEndDrag)
ON_NOTIFY(HDN_DIVIDERDBLCLK, 0, OnHeaderDividerDoubleClick)
ON_NOTIFY(HDN_ITEMCHANGING, 0, OnHeaderItemChanging)
ON_NOTIFY(HDN_ITEMCLICK, 0, OnHeaderItemClick)
The problem is I get some of the notifications, but not others.
I get the BEGIN/END TRACK/DRAG notifications, but I do NOT get the DIVIDERDBLCLK, ITEMCHANGING, or ITEMCLICK notifications?
I can use ON_NOTIFY_REFLECT(LVN_COLUMNCLICK, OnListColumnClick) in place of the HDN_ITEMCLICK notification, but I don't understand why I'm not getting the header notifications.
If I handle the HDN_DIVIDERDBLCLICK notification in CMyPropertyPage, I do get the notification, so it looks like the header control sends some of its notifications to the CListCtrl, and others to the CPropertyPage?
It also seems like by the time the HDN_DIVIDERDBLCLICK notification is received, the header (or listctrl) has already done the default resizing of the header columns, but that's what I wanted to customize.
Any ideas or suggestions?
Thanks - Sean McKinnon
mailto:sean.mckinnon@kvs.com
|
|
|
|
|
I've checked this with Spy++ on Win2000. My app wasn't UNICODE, but when I clicked on header, list control received HDN_ITEMCLICKW (not HDN_ITEMCLICKA mapped via #define to HDN_ITEMCLICK). It seems that this is the case with other notifications as well.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|