|
Hello,
I would like for my DialogBar class to update all it's values from my CDocument class. I've been told I need to add a new command ID and use WM_COMMAND. I know how to set up the DialogBar side of things, but I don't know how to send the command from the CDocument class. Any help or pointers to articles?
thanks!
JennyP
|
|
|
|
|
To send a WM_COMMAND message to your dialog bar object I think it would look something like:
// Somewhere inside CDocument
((CMainFrame*)AfxGetMainWnd())->m_MyDlgBar.SendMessage(WM_COMMAND);
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
JennyP wrote:
I've been told I need to add a new command ID and use WM_COMMAND
I don' think you need new command ID. Rather, you should provide ON_UPDATE_CMD_UI handlers for controls hosted in dialog bar using their control IDs.
Tomasz Sowinski -- http://www.shooltz.com
"Yields falsehood when preceded by its quotation" yields falsehood when preceded by its quotation.
|
|
|
|
|
How can i hook text , when i move mouse pointer over it ?
In IE , for example (HTML - text).
And more interesting - how i can to do it in any kind of applications (MSWord, etc.) ?
Thank You !
|
|
|
|
|
Actually i think this question gets asked enough that CG suggested Mike enter it in his C++ FAQ...you might wanna check it out...
Basically and easily you can't...however you can probably get away with text capture w/ HTML documents because IE (actually the IWebBrowser2 object) supports OnMouseOver & OnMouseOut events for all elements so you could probably take control of that object some how and use IE's innerHTML property and extract the text the mouse is currently over...for that matter you could then change it by setting the property...
I'm pretty sure other other programs like MS word wouldn't allow this becuase they probably use CRichEditCtrl which doesn't support the same events as IWebBrowser2 com object.
hooking text otherwise is almost impossible requiring character recognition or something like that...
Cheers
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Does anyone else pull their hair out trying to find what you're looking for using the MSDN search tool?
I usually enter a few key-words and the best 'hits' (by rank) are Q&A articles for FAQs which are 100 pages long and are ranked high because each of my key-words is used in separate sections of the FAQ---thus I don't find what I'm looking for after skimming the document--wasting 10 minutes in the process. Has anyone found a better method for quickly arriving at the spot you want?
thanks!
JennyP
|
|
|
|
|
Yup...google is your friend...
If i can't find it using the index I look to the CP or Google..
Cheers
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
JennyP wrote:
Has anyone found a better method for quickly arriving at the spot you want?
Using " and " ?
Tomasz Sowinski -- http://www.shooltz.com
"Yields falsehood when preceded by its quotation" yields falsehood when preceded by its quotation.
|
|
|
|
|
Would it be un-reasonable to have this error catching technique encapsulate(???) every function/method...???
Even if it were to make catching bugs in a distrubuted remote application a lot easier...???
Just curious...
Thanx!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
IMO, it's excessive; especially if you're talking about "catch(...)". unless every function is calling off to code you have no control over that has a high likelyhood of doing something stupid, you should be able to handle most possible error conditions on your own: test that pointer before using it, check your array bounds, etc.. at the very least, checking for possible error conditions will let you handle some situations gracefully. with catch(...), the error has already happened, and you don't really know what caused it, or what the state of the system is.
on the other hand, if your code actually uses specific exception objects as a form of code flow (ie. as C++ friendly goto's), then you might see a lot of try/catch blocks. but, even then, you wouldn't likely have them on every function.
-c
Though the cough, hough and hiccough so unsought would plough me through,
enough that I o'er life's dark lough my thorough course pursue.
--Stuart Kidd
|
|
|
|
|
Chris Losinger wrote:
IMO, it's excessive;
I would agree. However the reason I want to use try/catch is very un-conventional.
I always thought that under most circumstances you could get away with traditional if/then error handling techniques, instead of the more expensive try/catch.
Like u said so long as you initialize/check your pointers check the bounds of arrays etc...why bother using try/catch.
I look at try/catch as an alpha release technique to track down unrecognized bugs and fix them up with the faster more efficient if statements.
Anyways...thanx for the input
Cheers!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Hockey wrote:
I always thought that under most circumstances you could get away with traditional if/then error handling techniques, instead of the more expensive try/catch.
How much more expensive is try/catch when compared to dozens of if statements?
How much more readable is one exception handler than dozens of if statements?
Tomasz Sowinski -- http://www.shooltz.com
"Yields falsehood when preceded by its quotation" yields falsehood when preceded by its quotation.
|
|
|
|
|
Tomasz Sowinski wrote:
How much more expensive is try/catch when compared to dozens of if statements?
I would think quite a few more clocks are expended using try and catch. I suppose you could profile it and find out.
Tomasz Sowinski wrote:
How much more readable is one exception handler than dozens of if statements?
This is true, but it's harder or near impossible to determine what went wrong given the context of the situation. Where as i absolutely know what went wrong i use if's.
cheers
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Hockey wrote:
I would think quite a few more clocks are expended using try and catch. I suppose you could profile it and find out.
Sure. The real question is: do you need these clock ticks. 'Premature optimization is the root of programming evil' - do you know who said this?
Hockey wrote:
it's harder or near impossible to determine what went wrong given the context of the situation.
If you need different actions in different context, write different catch handlers.
Anyway, I'm not going to preach and convert you to try/catch. If you want to live in early 90s, it's OK with me.
Tomasz Sowinski -- http://www.shooltz.com
"Yields falsehood when preceded by its quotation" yields falsehood when preceded by its quotation.
|
|
|
|
|
I've always been facinated with code optimizations...I suppose it has a lot to do with the fact that I haven't had a new computer in like 5-8 years...
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Hockey wrote:
I've always been facinated with code optimizations
Nothing wrong with that... as long as fascination doesn't turn into obsession. If you want to optimize, profile first. I don't believe you'll find that using exceptions will slow your code down.
BTW: are you aware that calling new/malloc and delete/free is quite expensive?
Tomasz Sowinski -- http://www.shooltz.com
"Yields falsehood when preceded by its quotation" yields falsehood when preceded by its quotation.
|
|
|
|
|
Perhaps a slight obsession...
I seem to wanna go back in time rather than move forward with technology...honestly i'd rather code in assembler than anything...just cuz you have total control of everything. Sounds ridiculous, but i've never claimed to be the most productive programmer.
Actually I really enjoy OOP...the whole object concept is really cool too...i've always hated hi level procedural langs...like QBasic or Pascal...tho
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Hi
I have a dialog based application that uses many popup windows to display data. I changed the icon for these popups and it shows in the popup window and the task bar.
My prob is the new icon will not display (on the 'switch-to-program popup' window) when I press Atl-tab to swap between windows. What do I need to do for it to show up.
<br />
CMyWnd * mywnd = new CMyWnd (this);<br />
mywnd->Create(IDD_MYICON,GetDesktopWindow());<br />
HICON icon = AfxGetApp()->LoadIcon(IDI_MYICON);<br />
mywnd->SetIcon(icon);<br />
thanks
---
|
|
|
|
|
You need to change the large (32x32) icon also.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Hello all,
I am currently trying to develop an application using Visual C++. This application uses two different existing libraries, one of which (DirectShow) is compiled using the __stdcall naming convention, the other and SGI library is compiled using the __cdecl naming convention. The problem is that I need to use both these libraries in developing my filter, when I compile using __stdcall I get link errors in resolving the SGI library methods. When I compile using __cdecl I get errors in resolving the DirectShow methods.
Both libraries are C++ libraries, neither library is small enough to directly specify the function/class names, they require inclusion of numerous header files. The SGI library header are improperly declared (not specified as __cdecl in the headers).
Does anybody have any suggestions??
|
|
|
|
|
There's an easy way to force functions to be __cdecl. Just do this
extern "C" {
#include <sgi_headers.h>
}
Then just compile using __stdcall, and it should work.
|
|
|
|
|
Thanks for replying, I already tried that and it gives me loads of errors (102 of them) such as
C:\PROGRAM FILES\SILICON GRAPHICS\SDK\INCLUDE\ocs/ox/corba.h(699) : error C2733: second C linkage of overloaded function '_type_code' not allowed
C:\PROGRAM FILES\SILICON GRAPHICS\SDK\INCLUDE\ocs/ox/corba.h(699) : see declaration of '_type_code'
C:\PROGRAM FILES\SILICON GRAPHICS\SDK\INCLUDE\ocs/ox/corba.h(703) : error C2733: second C linkage of overloaded function '_type_code' not allowed
C:\PROGRAM FILES\SILICON GRAPHICS\SDK\INCLUDE\ocs/ox/corba.h(703) : see declaration of '_type_code'
C:\PROGRAM FILES\SILICON GRAPHICS\SDK\INCLUDE\ocs/ox/corba.h(707) : error C2733: second C linkage of overloaded function '_type_code' not allowed
C:\PROGRAM FILES\SILICON GRAPHICS\SDK\INCLUDE\ocs/ox/corba.h(707) : see declaration of '_type_code'
....
....
....
what else can I do, this is for my thesis at uni.... and the due date is approaching fast, and I cant even get it compiled!
|
|
|
|
|
'_type_code' is redefined , Use another function name!
Everyone is my teacher!
|
|
|
|
|
Hello, I was wondering what is required of a bitmap for it to displayed with a
transparent background when used as a toolbar button. I have two bitmaps, and when used in the same code, one yields transparent button backgrounds and the other doesn't. The bitmap that yields transparent backgrounds was used in a project I did three years ago, but I can't see anything special with it. Both got black background. I know the bitmap that will yield transparent background, but that is because that it was part of a larger toolbar bitmap in an unconventional size that I reduced to a size of 16*15 (using the resource editor).
I am putting the entire project on the following url if anyone wants to take a look.
http://www-und.ida.liu.se/~mikas493/code.zip
Please! This is driving me crazy!
|
|
|
|
|
CToolBarCtrl uses image lists so according to MSDN:
An image list may also include a monochrome bitmap that contains masks used to draw images transparently (icon style).
HTH
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|