|
There is a not so nice way of doing so and I am sure there are limitations.
Passing any text after the 'about:' protocol(?) in IE is diplayed in the browser. You can even put in links, font styles etc and IE will parse the text.
as a quick example you can type the following text in the start/run dialog.
about:<A href="http://www.codeproject.com">Code Project</a>
I'm pretty sure you'll be limited (eventually) by the size of the URL.
HTH
Jignesh
|
|
|
|
|
Brilliant! Simply brilliant! You just saved me from writing (and deleting) an ugly temp .htm file.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Thanks. But you should be aware of the max URL length that can be passed. I haven't tried this myself but if you look in wininet.h you see the following #defines
#define INTERNET_MAX_PATH_LENGTH 2048
#define INTERNET_MAX_SCHEME_LENGTH 32 // longest protocol name length
#define INTERNET_MAX_URL_LENGTH (INTERNET_MAX_SCHEME_LENGTH \
+ sizeof("://") \
+ INTERNET_MAX_PATH_LENGTH)
I guess as long as your html text doesn't go over the #define you'll be ok.
Jignesh
|
|
|
|
|
Good point. I guess it also pays to urlencode the text before checking its length.
Thanks for making TakeStock[^] less ugly.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Hello,
This can be a great solution, but I don't know how to launch the code to my HTMLCtrl...
I'm using Paul DiLascia's HTMLCtrl (is directly derived from HTMLView), but I need to show the HTML "file" in that control not in a normal IE window.
How do I launch that? Do I need to use a system("about:MyHTMLCode") call?
If I do it in this way I won't be able to redirect MyHTMLCode to my HTMLCtrl because this would fire another instance of IE.
Is there any better way to launch it?
I've tried to pass this to the navigate instruction, but it hasn't worked for me:
<br />
CString a = "";<br />
a.Format("about:%s",csCodiHTML);<br />
this->m_HTMLCtrl.Navigate(a);<br />
could you explain how to do it?
Thank you in advance!
|
|
|
|
|
I tried the above with some simple HTML on a CHTMLView and not the HTMLCtrl (which should work the same though) and it worked.
I can think of two things.
1) I used the Navigate2 method.
2) Is the URL VERY long? See the above threads on limitations.
or you can try what someone else suggested (the atricle on codeguru).
HTH
Jignesh
|
|
|
|
|
|
Hello all...
I am having a problem with the animation control on a dialog. In my
WM_INITDIALOG handler, I have the following code:
<br />
case WM_INITDIALOG:<br />
hAnim = CreateAnimationCtrl(hDlg, IDC_ANIMATE);<br />
Animate_Play(hAnim, 0, -1, -1); <br />
RedrawWindow(hDlg, NULL, NULL, RDW_INVALIDATE | RDW_ERASE |<br />
RDW_UPDATENOW | RDW_ALLCHILDREN);<br />
<br />
RECT rect;<br />
GetClientRect(hAnim, &rect); <br />
InvalidateRect(hAnim, &rect, FALSE);<br />
<br />
SetTimer(hDlg, 1, 350, NULL);<br />
<br />
etc...<br />
In the timer event, I have the following code:
<br />
case WM_TIMER:<br />
KillTimer(hDlg, 1);<br />
SetTimer(hDlg, 1, 20, NULL);<br />
theMain.m_nErrCode = theMain.m_lpDevice->Communicate(hDlg,<br />
&bPercent, &wPacketCount, szStatus);<br />
<br />
etc...<br />
As you can see, I am running a communcation routine that is sending
data through the USB port using an HID driver and standard WriteFile
calls. However, when the dialog first loads up, sometimes, not all the
time, the animation will not show up immediately. I'm trying to make a
dialog like the Windows Explorer dialog shown during a long copy
operation. Is there anything that I can do to make sure that the
animation is up before running the communication?
Brigg Thorp
Software Engineer
Timex Corporation
|
|
|
|
|
Using MFC in a MDI program.
The view has no background, so nothing is painted automatically.
I have this BitBlt on the OnDraw function of a view.
CRect r;<br />
pDC->GetClipBox(&r);<br />
<br />
pDC->BitBlt(r.left, r.top, r.Width(), r.Height(), &pDoc->m_map.m_canvas,<br />
r.left, r.top, SRCCOPY);
But it doesn't seem to do anything! Not a pixel gets painted.
I tried a FillSolidRect too here and that worked fine.
m_canvas is a DC created with CreateCompatibleDC(NULL)
the rect r seems to be correct and the m_canvas seems to be a valid canvas too.
Oh and the BitBlt returns 1, so it's not failing internally it seems...
|
|
|
|
|
What are the values in r ? Are they within the bounds of the dialog ? Of the canvas ? Try making the last parameter WHITENESS and see what you get. ( You should get a white box ).
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
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
The m_canvas should be exactly the size of the drawing area
The values in r seem the right ones needed
WHITENESS works fine
I didn't set the size of m_canvas in any way though. Should I have? And if yes, then with what function? I couldn't find anything that would do that
|
|
|
|
|
Do you have selected a bitmap object in your "m_canvas" memory DC ?
Ohé Partisans, Ouvriers et Paysans
C'est l'alarme!
Le Chant des Partisans
|
|
|
|
|
No. BitBlt doesn't require anything specific to be selected, does it?
|
|
|
|
|
Ok, it's here probably the problem, there's no data in you document's object. Memory DCs require a bitmap which is the one with stores the graphical info.
When you create your document DC, create also a compatible bitmap (look at CBitmap::CreateCompatibleBitmap), select it in your memory DC, draw on it then BitBlt on your "device" DC.
Here a sample of the mechanic to use, extracted from a drawing method, with
m_SelectionRect = rectangle used to draw "on memory"
DrawMyObject(CDC *pDC): method which actually draws through pDC
dc: the "device" DC
CDC TempMemDC;<br />
CBitmap *pTempBitmap = new CBitmap();<br />
VERIFY(TempMemDC.CreateCompatibleDC(NULL));<br />
VERIFY(pTempBitmap->CreateCompatibleBitmap(&dc, m_SelectionRect.Width(),<br />
m_SelectionRect.Height())); <br />
CBitmap *pOldBitmap = (CBitmap *) TempMemDC.SelectObject(pTempBitmap); <br />
TempMemDC.BitBlt(0, 0, m_SelectionRect.Width(), m_SelectionRect.Height(), BLACKNESS);<br />
DrawMyObject(&TempMemDC);<br />
dc.BitBlt(0, 0, m_SelectionRect.Width(), m_SelectionRect.Height(), &TempMemDC, 0, 0, SRCCOPY);<br />
TempMemDC.SelectObject(pOldBitmap);
HTH,
Ohé Partisans, Ouvriers et Paysans
C'est l'alarme!
Le Chant des Partisans
|
|
|
|
|
Thanks, I think I get it now
|
|
|
|
|
My pleasure if I may help. And welcome on CP
Ohé Partisans, Ouvriers et Paysans
C'est l'alarme!
Le Chant des Partisans
|
|
|
|
|
Hi,
I have written this to repaint the slider channel:
NMCUSTOMDRAW the_struct;
the_struct.hdr.hwndFrom =m_ProgressSlider.m_hWnd;
the_struct.hdr.idFrom = IDC_PROGRESSSLIDER;
the_struct.hdr.code=NM_CUSTOMDRAW;
the_struct.dwDrawStage = CDDS_ITEMPREPAINT;
the_struct.dwItemSpec =TBCD_CHANNEL;
the_struct.hdc =this->GetDC()->m_hDC;
m_ProgressSlider.GetChannelRect(&the_struct.rc);
SendMessage(WM_NOTIFY ,(WPARAM)IDC_PROGRESSSLIDER,(LPARAM)&the_struct);
But slider is not repainted.Can anyone help me..
Regards
|
|
|
|
|
|
i don´t know, if i understand you right, because my english is not so good.
if you have a listCtrl in MFC, for example: m_ctrlListBox, then you can add a string to the listbox: m_ctrlListBox.AddString("Hi");
if want to to select this entry you can do something like this:
<br />
m_ctrlList.AddString("Hi");<br />
m_ctrlList.SetCurSel(0);<br />
int place=m_ctrlList.GetCurSel();<br />
CString buffer;<br />
m_ctrlList.GetText(place, buffer);<br />
now the buffer includes the first entry of the listbox.
hope i could help you.
mfc
|
|
|
|
|
i want to enter my edit box text into a list box. how it can be done? can anyone help..
himanshu
|
|
|
|
|
Are you using MFC?
CString sString = "";<br />
<br />
m_edit.GetWindowText(sString);<br />
<br />
m_listbox.AddString(sString);
Michael
Fat bottomed girls
You make the rockin' world go round -- Queen
|
|
|
|
|
Try this:
<br />
CListBox a;<br />
CString b = "";<br />
<br />
yourEditBox.GetWindowText(&b);<br />
a.AddString(b);<br />
Of course you can change the CString and the GetWindowText(...) for a CString variable linked to your editbox... if you want to do it in this way you must call UpdateData();
hope this helps...
|
|
|
|
|
thanks a lot..
|
|
|
|
|
Hi,
i've a problem converting data from a format to another. the function
VARIANT SaveToMemory(const VARIANT& Format, const VARIANT& CurSelection);
returns a byte array (text data) casted like a VARIANT. I need to put this array in a CString variable. So I've used this:
COleVariant varBuffer;
COleVariant mode, cur;
mode = (long)5;
cur = (short)TRUE;
varBuffer = m_txctrl.SaveToMemory(mode, cur);
CString m_text = ((CByteArray &)(varBuffer.pbVal)).GetData();
But this will return an empty string. using CString m_text = (varBuffer.pbVal); return me a single byte.
It's wrong my code?
|
|
|
|
|
Gian wrote:
returns a byte array (text data) casted like a VARIANT
Where exactly is that byte array? It can't be pbVal because this one is about one single byte... (check MSDN)
rechi
|
|
|
|