|
This is an offer of encouragement. I had the same problem and worked for several weeks trying to find a good solution. I finally gave up. All the examples and info I could find seemed to assume you know the object at design time.
Runtime discoverable event sinks turned out to be pretty difficult for me. By using the TypeLib calls I was able to get the information for the sink, I could never get the Advise call to work, however.
Please let me know if you find a solution.
Good Luck.
Bill
|
|
|
|
|
Hi all,
Does any body have samples or explanations on how to do this :
A picture is shown in a scollview. When the picture is "bigger" than
the client area, scrollbars appear.
The user can drag a rectangle over the picture. When the rectangle reaches
the border of the client area, the view should scroll in order to allow the
rectangle to reach hidden parts of the picture.
I succeeded in doing this, but I still have a problem to solve :
when the view scrolls, the rectangle doesn't stay at the client
area border ; it scrolls with the picture...
Any idea about the origin of this problem ?
Thx in advance for your help,
Jeje
|
|
|
|
|
This is probably because you are using the client coordinates. In such cases I use the CScrollView::GetScrollPosition and then I'm calculating the rectangle. That is if your top/left corner of your rectangle is out of your client area it is clipped.
Hope this helps.
-widi
-
|
|
|
|
|
Can you please give me more details ?
Do you have any sample code for this ?
Anyway, thanx widi for this info.
I'll investigate this way.
Jeje.
|
|
|
|
|
I'm sending you some sourcecode via E-Mail.
Please stand by......
...
.....
....
...
uploading data....
....
....
-widi
-
|
|
|
|
|
Tanx a lot !
I'll check it asap to see how you proceed.
Nevertheless, I already almost succeed...
In fact I redraw the rectangle and the client area in the OnTimer() function
instead of in OnMouseMove(). SO now, the rectangle stays at the client area
border, but now the problem is that the redraw is not perfect : sometimes
you can see 2 rectangles instead of only one.
Maybe I'll find the solution in the samples you sent !
Thx again,
Jeje.
|
|
|
|
|
I guess I missunderstood your question, sorry.
If you don't want the Rectangle to scroll in your view you can do that:
// this is declared in your class header file
CRect m_rect; // this is the rect you draw
// this goes where you paint your rect
CRect rc(m_rect);
CPoint pnt;
pnt.x = GetScrollPosition(SB_HORZ);
pnt.y = GetScrollPosition(SB_VERT);
rc.OffsetRect(-pnt.x, -pnt.y);
// pDC is your device contect which you get here
pDC->Rectangle (rc);
I think that is what you wanted.
-widi
-
|
|
|
|
|
I have a modeless dialog that is created and popped by an SDI application.
The problem is that the dialog is always topmost. I would like the SDI app to be topmost when I click in its window, placing the popup behind it.
Should a modeless dialog behave like this?
Cheers,
/Fredrik
Sonork ID: 100.11430:PhatBoy
|
|
|
|
|
Try setting CWnd::GetDesktopWindow() as the parent of your modeless dialog, instead of your main window.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
What do you want? That the mainframe will be topmost, or the dialog?
Best Regards...
There is an old saying that if a million monkeys typed on a million keyboards for a million years, eventually all the works of Shakespeare would be produced. Now, thanks to Usenet, we know this is not true.
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|
I want the window I click in to be topmost.
Using CWnd::GetDesktopWindow(), as Joaquín wrote in his post, works fine.
Passing the this pointer to CDialog::Create() makes the dialog be always topmost.
Cheers,
/Fredrik
Sonork ID: 100.11430:PhatBoy
|
|
|
|
|
Hello everybody!
Help me in follo...
How I can runtime change values of margins of page to force to print from the edge of page?
Best regards,
Eugene Pustovoyt
Sonork ID 100.10002:Yaumen
|
|
|
|
|
When you OnPrint handler is called, the printable area of the page is in the CPrintInfo objects member var m_rectDraw. Your OnPrint should use the values in this to decide wher to print on the page. To give yourself margins, setup a dialog that lets you enter the margin values, and then configure m_rectDraw at the start of the OnPrint procedure to take the margins into account:
int xl = (int)(pDC->GetDeviceCaps(LOGPIXELSX) * g_LeftMargin) ;
int xr = (int)(pDC->GetDeviceCaps(LOGPIXELSX) * g_RightMargin) ;
int yt = (int)(pDC->GetDeviceCaps(LOGPIXELSY) * g_TopMargin) ;
int yb = (int)(pDC->GetDeviceCaps(LOGPIXELSY) * g_BottomMargin) ;
pInfo->m_rectDraw.left += xl ;
pInfo->m_rectDraw.right -= xr ;
pInfo->m_rectDraw.top += yt ;
pInfo->m_rectDraw.bottom -= yb ;
HTH
Roger Allen
Sonork 100.10016
If I'm not breathing, I'm either dead or holding my breath.
|
|
|
|
|
The given method reduces m_rectDraw ! And whether probably will increase m_rectDraw so to clean margins absolutely?
Best regards,
Eugene Pustovoyt
Sonork ID 100.10002:Yaumen
|
|
|
|
|
I think this is very Simple Question but I am new babie .
In the SDI application. I draw something on the client area. I want to save this as a BMP and some other formats(GIF, JPEG . . .). So that this image can be open in any other software.
My primary goal is to save it as BMP format.
I want to do this without using any other's library. And also without using MFC (If possible, I hope) .
Thanks in advance.
Some sample code will help alot.
|
|
|
|
|
Questions like this one are very difficult to give an answer to!
syedhassan4 wrote:
I want to do this without using any other's library. And also without using MFC (If possible, I hope) .
The answer is many many lines of code and if you want an answer I think you have to take a look at some classes or something that do what you want to do and then ask here if you'll get problems when trying to do something similarly!
------------------------------
©0d3 ©®4©k3® - That's me!
------------------------------
|
|
|
|
|
Actually it's damn easy. Just use GetWindowDC to get a handle to the windows device context and use GDI+ to save the image.
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Picture the daffodil. And while you do that, I'll be over here going through your stuff.
Picture a world without war, without hate. And I can picture us attacking that world, because they would never expect it.
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
My 'Doodle' article shows how to use GDI+ to save an image to disk in different formats, the CXImage class also on CP shows a way to do it which doesn't involve downloading the SDK or relying on a DLL. Use GetWindowDC to get a device context you can use to grab the contents of the window. Just remember to make the Image you create the same bit depth as the screen, you can use GetDeviceCaps(BITSPIXEL) on the DC you get back from GetWindowDC to figure out what you need.
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Picture the daffodil. And while you do that, I'll be over here going through your stuff.
Picture a world without war, without hate. And I can picture us attacking that world, because they would never expect it.
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
Hi,
Reading through the sea of documentation, I haven't been able to work this out...
I would just like to add a button to the Internet Explorer toolbar and possibly some other applications. Now what I want is that when you click this button my code should be executed (and that piece of code will probably interact with IE somehow).
Can any one point me in the right direction as to where I can find information on the topic? Or if any one is willing to share som brief info on how to go about it...?
Thx, all help is greatly appreciated,
/Tommy
|
|
|
|
|
Will implementing deskbands solve my problem?
/Tommy
|
|
|
|
|
Deskbands will allow you to add new toolbars to IE.
I suggest you also look at Browser Helper Objects too.
Michael
|
|
|
|
|
Ok, thx!
The search engine here on CodeProject seems to have gone down; are there any articles/tutorials on Browser Helper Objects that you know of?
/Tommy
|
|
|
|
|
Hi,
I'm trying to programmatically disable the hightlight that occurs
on a selected item in a CListCtrl(icon view) when focus is removed.
You know when you select an item, then set the focus elsewhere, a
selection box still appears only grayed out. It's this box I'm trying to
remove.
As an added extra, when I do want to keep the grayed box, I want to
display the full title of the file rather than chopping it as occurs
when the display text is too long.
Thanks for any help,
Wayne.
|
|
|
|
|
You should be able to do this my mapping the OnKillFocus handler for the list control in question. In that procedure, you need to de-select the item:
int sel = m_Ctrl.GetSelectionMark() ;
m_Ctrl.SetItemState(sel, 0, LVIS_SELECTED | LVIS_FOCUSED) ;
Roger Allen
Sonork 100.10016
If I'm not breathing, I'm either dead or holding my breath.
|
|
|
|
|
Can anybody tell me how to access a PC's serial port from a terminal server session. At the moment we access POS display units by talking directly to COM1. Is there a port name that the terminal server routes to the PC's local serial port or is there another way of doing it.
Thanks for any information you can provide.
Steve.
Systems AXIS Ltd - Software for Business ...
|
|
|
|