|
I've got a CHtmlView from which I need to detect when a user clicks on a link and what the URL is. Overriding CHtmlView::OnBeforeNavigate2() gives me this information most of the time, except when the user opens the link in a new window.
CHtmlView::OnNewWindow2() gives me an IDispatch for the new window but I'm not sure how to get the URL from this.
Can anyone help me out here...?
|
|
|
|
|
I would like to ask if anyone knows a better way to send an e-mail than my current situation. I have a static control on an About Dialog which has my e-mail address which if of style NOTIFY so I can process the message. In the message I have WinExec("explorer mailto:georgiek50@yahoo.com", SW_MAXIMIZED) because that's how HTML does it...which worked fine, hotmail opened up and everything but it also opened up another window (explorer) with a title "No Page to display". Is there a more straightforward way of doing this?
|
|
|
|
|
Easy. change it to WinExec("mailto:georgiek50@yahoo.com", SW_MAXIMIZED) (i.e. take out the call to explorer - that's why you're getting the empty window. If you just exec a url, such as a mailto, or a http addr, then windows will handle it automatically)
--
Help me! I'm turning into a grapefruit!
|
|
|
|
|
benjymous wrote:
WinExec("mailto:georgiek50@yahoo.com", SW_MAXIMIZED)
Just a point: Use ShellExecute instead of WinExec. WinExec is a Win16 API.
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
|
Has anyone ever used AssociateColorProfileWithDevice to set the default color profile for a display adapter?
The action should result the same as setting the profile manually with the DisplayProperties->AdvancedSetings->ColorProfiles.
I used the following code, but nothing happens:
if(InstallColorProfile(NULL, alColorProfile))<br />
{<br />
SetOutputText("Color Profile " + alColorProfile + " installed");<br />
}<br />
else<br />
{<br />
ShowLastError("InstallColorProfile");<br />
}<br />
<br />
CString alMessage;<br />
alMessage.Format("Try AssociateColorProfileWithDevice(NULL, \"%s\", \"%s\")", alColorProfile, amPrimaryDevice);<br />
SetOutputText(alMessage);<br />
if(AssociateColorProfileWithDevice(NULL, alColorProfile, amPrimaryDevice))<br />
{<br />
SetOutputText("Color Profile " + alColorProfile + " associated with device " + amPrimaryDevice);<br />
}<br />
else<br />
{<br />
ShowLastError("AssociateColorProfileWithDevice");<br />
}
ThankYou for any answer
Richard Boesiger
|
|
|
|
|
Hi,
I have a following code
rgnCaption.CreateRectRgnIndirect(&m_rcBtns[2]);
brush.CreatePatternBrush(the_bitmaps.FromHandle(the_bitmap));
dc.SelectObject(brush);
dc.PaintRgn(&rgnCaption);
This code works fine if m_rcBtns[2]=CRect(0,0,20,20);;
if m_rcBtns[2]=CRect(5,5,25,25);; it doesn't display properly.
Bitmap which i am trying paint has the width=height=20;
Can anyone help me?
Regards
Neha
|
|
|
|
|
This code make absolutely now sense at all - please clarify!
|
|
|
|
|
Hello,
can anyone tell me how to turn on and set content(picture, webpage)of ActiveDesktop? I tried IActiveDesktop::SetWallpaper but it did nothing. Thanks in advice.
Grep
|
|
|
|
|
Hi i have a single file object opened with read|write but two threads running, one which reads waiting forever the other writes occasionally, the problem is the writes are blocked by the read until the read completes.
Is there anyhting i can do? i.e. using overlapped with an offset of 0 bytes or as i believe will this make no difference!
Help, i am gonna cry in a minute!
Thanks Kev
|
|
|
|
|
search for serial communication class on this site, "Ramon" suchabody has written one that does just the job.
|
|
|
|
|
if you search the msdn by the following keywords:
Bitmap::SetPixel(x, y, color)
Graphics::FromImage(image)
you can find two gdi+ examples:
(1)
VOID Example_SetPixel(HDC hdc)
{
Graphics graphics(hdc);
// Create a Bitmap object from a JPEG file.
Bitmap myBitmap(L"Climber.jpg");
// Draw the bitmap.
graphics.DrawImage(&myBitmap, 0, 0);
// Create a checkered pattern with black pixels.
for (UINT row = 0; row < myBitmap.GetWidth(); row += 2)
{
for (UINT col = 0; col < myBitmap.GetHeight(); col += 2)
{
Status stat=myBitmap.SetPixel(row, col, Color(255, 0, 0, 0));
ASSERT(stat==Ok)//!!!!!!!!!!!!!!!!!!!!!!!!!! FAIL!!!!!!!!!!!!!!!!!!!
}
}
// Draw the altered bitmap.
graphics.DrawImage(&myBitmap, 200, 0);
}
(2)
VOID Example_FromImage(HDC hdc)
{
Graphics graphics(hdc);
// Create an Image object from a PNG file.
Image image(L"Mosaic.png");
// Create a Graphics object that is associated with the image.
Graphics* imageGraphics = Graphics::FromImage(&image);
// Alter the image.
SolidBrush brush(Color(255, 0, 0, 255));
Status stat=imageGraphics->FillEllipse(&brush, 10, 40, 100, 50);
ASSERT(stat==Ok)//!!!!!!!!!!!!!!!!!!!!!!!!!! FAIL!!!!!!!!!!!!!!!!!!!!!
// Draw the altered image.
graphics.DrawImage(&image, 30, 20);
delete imageGraphics;
}
As I pointed out above the two of the examples don't work due to SetPixel and FillEllipse failures....
Generally some functions in gdi+ work fine, and other functions don't...
I testes my app on other machines and the result is the same....I can't make SetPixel function work at all !!
Thank you in advance...
|
|
|
|
|
This i know is gonna be simple but it is foxing me.
I have a dialog based application. On the main form it minimizes and maximises correctly, if i open a pop-up dialog from the main dialog then minimize the pop-up box it minimizes to the corner of the desktop not the taskbar, leaving the parent window showing (disabled) on the desktop.
I have tried <popupdialog>->SetParent(this) before calling DoModal but this creates an exception. Has anybody any ideas what i am doing wrong.
Thanks
Matt
Matt G
|
|
|
|
|
You should pass 'this' into the dialog when you create it, thus making your main dialog the parent.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
Let's say that I've developed a COM-inprocess STA server.
QUESTION 1:
A c++ client can specify STA client thread by:
CoInitialize(NULL, COINIT_APARTMENTTHREADED);
How can you do this from an ASP application? For instance, you cant specify client threading model with CreateObject:
<% Set Session("ad") = Server.CreateObject("MSWC.AdRotator")%>
This will store the com server in session scope. But threading model?
QUESTION 2:
I am writing a backend server component that generate a SQL "statement" based based on input ASP. What's the best threading model for this situation? Note that this component is NOT responsible for database access. It simply get input from ASP and pass back a string to ASP
Thanks
norm
|
|
|
|
|
norm wrote:
How can you do this from an ASP application?
You can't. The thread model will follow that of the server component.
norm wrote:
<% Set Session("ad") = Server.CreateObject("MSWC.AdRotator")%>
This will store the com server in session scope.
Try not to do this. I don't know for this specific component, but storing an STA component on the Session or Application objects will impact your server performance and scalability very soon. The ASP engine has only one STA thread for creating and executing components. This means it will create a bottleneck for your pages and can hang your entire server.
My latest article:
SQL Server DO's and DONT's[^]
|
|
|
|
|
Thanks, reading up on MSDN. They suggest Both or Apartment. And recommended NoEntry and Free.
So, look like MTA-Both-inprocess server will be the solution.
QUOTE: "The thread model will follow that of the server component."
Thanks, that's very helpful. Didnt see this in any doc yet...
norm
|
|
|
|
|
Hello,
i have an MDIChildWnd with StatusBar and Sizegripper.
I now want to change this resizable window into a non-resiable one, and vice versa. I removed WS_THICKFRAME from frame window. The window size is now fixed but the Statusbar don't get updated and the sizegipper is still shown. I tried a lot (e.g. invalidate, setwindowpos with SWP_FRAMECHANGE) to get it repainted correctly but it only works if i call the function twice (from menu or button).
Has anyone an idea how to change this dynamically.
Any help would be great
|
|
|
|
|
Hi all, I've been sent messages about my question, I did everything they told me but there's still something I'm doing wrong.I'll tell you with details...: I'm doing a Win32 program. My program is Dialog based and i've put some controls on it. The problem is that i've put a notified picture control and I can't change the mouse pointer, everytime is moving over that control, from Arrow to Hand???....HEEELLLPPP!!!
|
|
|
|
|
Did you try subclassing the window like I told you. That should definitely work. Also try chaning the cursor to a cross for example IDC_CROSS. The hand does not work with all windows version. VC 6.0 doesn't even recognize IDC_HAND when I try to compile it so I had to download a cursor from the internet that looks like a hand and load it in as a resource. If you are still stuck you can e-mail me your code, I'll put in the necessary code, comment it, and mail it back to you.
|
|
|
|
|
i sent you an email but i forgot to tell you that i didn't subclass it... Oopsss Sorry!!!
|
|
|
|
|
Hi!
I have created a simple SDI application with with a CommandBand on top of my application window.
I have created the CommandBand like in the tutorial Using Windows CE CommandBands in an MFC based Application
by Bruce Hearder.
The problem is that when I am opening a dialog, like the "Open File..." dialog and invoke some of the SIP elements, like the Keyboard Input and press ENTER to close the dialog, after the dialog has closed, the CommandBand will be not visible! It looks like the view does resized to the whole area and the CommandBand will be moved outside the screen. It is only when I am opening a dialog and invoke a SIP element and close the dialog (during the dialog is closing the SIP Keyboard is visible).
How can I fix that? Please help!
Daniel
---------------------------
Never change a running system!
|
|
|
|
|
void CMainFrame::OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized)
{
CFrameWnd::OnActivate(nState, pWndOther, bMinimized);
ResizeView();
}
void CMainFrame::OnSettingChange(UINT uFlags, LPCTSTR lpszSection)
{
CFrameWnd::OnSettingChange(uFlags, lpszSection);
ResizeView();
}
Daniel
---------------------------
Never change a running system!
|
|
|
|
|
I have written an application that sticks to a target application, I've done this by writing a dll that implements a windows hook (so it gets put into the target app's process space), then i've subclassed the windows proc. In my new windows proc i send the winodows move messages to my application.
Anyway all this works fine on windows XP, 2000, NT but i'm having problems on windows 98.
The move messages get passed fine, but when i minimize the application, it crashes. If I rerun the application it all works fine, I can't really put my finger on what the problem could be ?
Has anyone else out there had any experiance in this field ?
|
|
|
|
|
btw... I know you a few years, thx, what is the connection to 'codeguru'?
|
|
|
|