|
can anybody tell me how i would retrieve the cursor position (the text cursor in an edit control....)
thanks in advance!
|
|
|
|
|
Take a look at the EM_* messages, I think you can do what you want with EM_LINEFROMCHAR and EM_GETSEL
BTW,
In an edit control it's not called a cursor, but a caret...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Where can I find a C++/MFC source code example about how to add the OLE Drag Drop events (OLEStartDrag, ...) to an ActiveX control.
|
|
|
|
|
Anyone know how to read the page count from a multipage tif image.
|
|
|
|
|
I would also be interested in tips on how to access this information - I am often asked to provide an index of a directory including the file name and number of pages for group 4 fax encoded TIFFs. Any info or tips would be appreciated
|
|
|
|
|
Hi,
My app uses a context menu in one of its views, which works fine on its own!
The problem comes when i try to add other functionality to the WM_RBUTTONDBLCLK.
The context menu appears on the double click!
Is it posible, or even worth it, to get them working together?
|
|
|
|
|
You need to use a timer.
1) In WM_RBUTTONDOWN handler, create the timer with a timeout period of 2 * ::GetDoubleClickTime(). Do not display popup menu here - you don't know if this is a double-click or single-click.
2) Insert KillTimer in WM_RBUTTONDBLCLK.
3) Add WM_TIMER handler - you'll get this message if somebody right-clicks once and second click doesn't come. The code with popup menu should reside here.
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
Hi!
I've posted this question in the "Suggestion" board, because there is no API discussion, and was advised to post it to C++ board. Sorry for long story.
I've created the NT service that in the case of error not only register event in the Application EventLog, but also may send this event by mail to the predefined SMTP address. In the configuration applet for this service I'd like to let the user to select, what events he/she wants to receive in mail. So I'd like to extract the list of events from the event source, registered in HKLM\SYSTEM\CurrentControlSet\Services\Eventlog\Application\EventMessageFile.
I can extract the single event with FormatMessage, if I know the ID. But if I don't? The question is: How I can enumerate the events in the EventMessageFile? Sure I can do it "manualy" analyzing the message file structure. But I prefer something more safe in the case, they in MS will change the message file structure. And using API (if there is any) will save me from unskilled labour. I don't afraid to do such a work, but if I can avoid it ...
Thanks in advance.
Regards,
Gennady
|
|
|
|
|
Message table is normal Win32 resource, so you need to load message file using LoadLibraryEx() with LOAD_LIBRARY_AS_DATAFILE flag. Then, use EnumResourceXXX/FindResource/LoadResource functions to retrieve MESSAGE_RESOURCE_XXX structures.
Hope that helps.
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
Thanks ! EnumResourceNames is exactly what I looked for. Don't know why I couldn't find it myself - may be search expression was wrong.
Thank you once more.
Regards,
Gennady
|
|
|
|
|
In the below given program, 'cout' in the destructor doesn't work. But if the iostream is replaced with iostream.h and the statement using namespace std; is commented then, it works fine and displays - "Hello how are you?"
Can anyone explain why is it so?
#include iostream
using namespace std;
struct A
{
A(){cout<<"Hello";}
~A(){cout<<" you?";}
}a;
void main( void )
{
cout<<" how are";
}
//"void (*p[10]) (void (*)());"
|
|
|
|
|
In VC++ <iostream> and <iostream.h> use different implementations of the run-time library routines, so they work differently.
|
|
|
|
|
Thnx for ur reply. But I would like to know why is the STL cout is behaving like this? Is it a bug in STL?
"void (*p[10]) (void (*)());"
|
|
|
|
|
Don't have an answer for you but you may want to just debug the app to see why the last cout doesn't do anything. Have you tried appending an "endl" to the "you"?
Alvaro
|
|
|
|
|
You need to flush "cout" before exiting the application. std::endl takes care of this, as in
cout << "d'tor" << endl;
|
|
|
|
|
I wonder why this compiles without an error :
m_nScrollPos-=nPos,1.0,2,3
(IMHO this is obviousely nonense)
|
|
|
|
|
> (IMHO this is obviousely nonense)
Grab any C/C++ book and learn about 'sequential-evaluation operator' or 'comma operator'. If you don't have one, read this excerpt from C++ Language Reference included in MSDN:
"Consider the expression
e1 , e2
The type and value of the expression are the type and value of e2; the result of evaluating e1 is discarded. The result is an l-value if the right operand is an l-value."
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
enlightened
|
|
|
|
|
Hi,
I have a small app that runs autonomously. It's dialog based, and has a button on the dialog. I set this button to Disabled in resource editor, cos i don't want the user hitting it until certain events occur. I also want it nicely greyed out.
Here comes the silly part... how do i reenable it when i'm ready?
Thanks
|
|
|
|
|
Make a member variable for the button then go
m_Button.EnableWindow(true);
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
Hello,
I have written an app. that hooks the keyboard, I have used the AfxGetApp()->m_hInstance as a parameter in the HINSTANCE hMod parameter.
The effect of doing so is that I have locked all the keys choosen in all the OS. (perfect for me, that's what I wanted).
Now I'm trespassing that code into a Win2k service and what I've found is that i don't know the instance of it, how should I get it?
I've readed in the MSDN that if you want system scope, the code must be placed inside a DLL, if this is true, why it is working OK for me?
As you will have probably seen my english is not my best... sorry about that...
|
|
|
|
|
hi to all !
does anyone know how to save the dialog or any CDC device to bmp/jpg File?
pascal.
pascal
|
|
|
|
|
I answered this question about 5 questions down. If we ever get a FAQ, this has to be one of the top answers to put in it.
You can do it with GDI+ quite easily, my 'Doodle' tutorial shows you how. If you don't want to use GDI+, try paintlib ( www.paintlib.de ). They still haven't incorperated the code I submitted six months ago, but I have code to save Targa as well here if you get paintlib and want it. ( also lots of filters ).
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
I've just finished implementing a custom menu. When you open a menu, it goes modal. This means that the parent window appears inactive. While this doesn't affect how the menu works, it just doesn't look right.
So my question is, does anyone know how to parent make parent appear active, while a child window is modal?
Hygge
John
|
|
|
|
|