|
In visual basic it is online code and but i have no idea how to do it in visual c++ 6. could u show me how ?Thanks
|
|
|
|
|
method007 wrote: ...i have no idea how to do it in visual c++ 6. could u show me how ?
See here. Once you have a file, you can then open the file using any number of methods (e.g., CFile , FILE* , CreateFile() ).
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
HTML from where ? if it's from the web, David gave you a good starting point.
else, if it's simple html text, just do a SetWindowText of the HTML code to the CEditBox; but it will not be formatted.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Maximilien . i want first get html code of a specified url then use that to extract specific data from it. i want to load that html in textbox first then maniuplate it!!
|
|
|
|
|
Hi,
I am using Visual C++ 6.0 MFC and I created a dialog based app that has several different dialog classes. I decided that I wanted to put each of my dialogs onto a tab control page. This I can do, but now when I click on my dialog command buttons nothing happens. I went into the dialog properties and changed them from popup to child and also the visible style check box and the four different combinations of them. I used the class wizard to define functions for OnNotify and OnChildNotify but these only fire when I click on the tab itself not the command buttons in the tab page. There is no WM_NOTIFY available through the class wizard. I have found information on how to create the tab control and how to get the dialog boxes to appear in the contorl but I can't find any good information about recognizing the event when a button on the tab page (dialog) is clicked. If anyone that can point me in the right direction it would be greatly appreaciated.
Buck
Buck
|
|
|
|
|
|
Hello
I'm currently interested in putting a 3D control (OGRE -a 3D engine-, namely) in a dialog box with other elements. So, you would insert that control in a dialog box, together with other things (buttons or even CHtmlView-derived classes) and it actually does work.
I have a problem, thought: I would like the control to be aware of the keyboard focus. Let me explain: in an edit box, for example, when the user clicks the edit box is selected and all keyboard actions go to the edit box. The same with for example CHtmlView.
My class currently inherits from CStatic, and I'm having real trouble making it capture the keyboard (interestingly, capturing the mouse has been easy!).
How could I solve this problem, so make my class act like, say, the CEdit class?
Thank you
S. Ali Tokmen
http://ali.tokmen.com
|
|
|
|
|
Can't you change your class to inherit from CEdit, instead of CStatic?
Best,
Jun
|
|
|
|
|
Hello
Sure I can inherit from anything, but unfortunately it doesn't seem to help: taking CEdit as base class still doesn't make the static get the keyboard focus... Annoying!
I've found a workaround: instead of creating the control in a static, I create it in an EDITTEXT ... so, it does capture the keyboard when clicked, but has the normal behaviour of an edit text: it changes the cursor into a "I", it blinks, it has a border and worse it types in text when you press buttons!
Do you have any other ideas?
Thank you
S. Ali Tokmen
http://ali.tokmen.com/
|
|
|
|
|
Derive your class directly from Cwnd. That will give you the most flexibility.
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
alitokmen wrote: 've found a workaround: instead of creating the control in a static, I create it in an EDITTEXT ... so, it does capture the keyboard when clicked, but has the normal behaviour of an edit text: it changes the cursor into a "I", it blinks, it has a border and worse it types in text when you press buttons!
Subclass it!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
alitokmen wrote: This is a direct email response to your message on the page 'Visual C++ / MFC':
This message has not appeared on the discussion board for that page.
DO NOT HIT 'REPLY' TO THIS EMAIL: To reply, visit the URL below or
send an email to the email address below.
URL : http://www.codeproject.com/script/comments/forums.asp?msg=1572159&forumid=1647#xx1572159xx
From: alitokmen <#######################>
Hello
I'm poting you this message and sure you don't need to reply or help me, I would just be glad if you can
As I told in the forum post, my aim is to develop an MFC-based object which would act like, for instance, CHtmlView: on the programmer side, the only action that would need to be done would be to call CMyClass::Create(dwStyle, rect, parentDialog, staticCtrlID) and this would create the control, in any kind of control (static text, edit box, ...). Also, the control would take over the default keyboard and mouse actions on the dialog and therefore, for example, clicking on the class "window" and then pressing the arrow buttons on the keyboard would only make the class take an action.
This is the point where I'm stuck: how can I make this class get created on any kind of static control and second (more importantly) how do I make it capture all actions once clicked on (and release it back once the user clicks somewhere else)?
Thank you
S. Ali Tokmen
http://ali.tokmen.com
---------------------------------------------------------------
NOTE: This message has been sent from an unattended email box.
Daily news delivered: The Code Project Insider
Sign up at http://www.codeproject.com/Redir.aspx?id=1648
alitokmen wrote: This is a direct email response to your message on the page 'Visual C++ / MFC':
This message has not appeared on the discussion board for that page.
DO NOT HIT 'REPLY' TO THIS EMAIL: To reply, visit the URL below or
send an email to the email address below.
URL : http://www.codeproject.com/script/comments/forums.asp?msg=1572159&forumid=1647#xx1572159xx
From: alitokmen <#######################>
Hello
It's just to tell you that I've solved the issue... Here's how it goes:
Problem: when there's a control in a dialog box replacing a STATIC resource, it will lose focus as soon as a key is pressed (things move in the dialog box) and it will never receive the OnKeyDown call.
Reason: STATIC is not supposed to be doing input/output, as a result it cannot receive keyboard events. As a result, you won't receive the OnKeyDown call (even if you do put it in the message map) and any pressed key, since not captured by the STATIC, will get dispatched to the parent (the dialog box) and this will make it take the default action -changing the selected button.
Solution: in the class that wants to go into a STATIC, overload the PreTranslateMessage, OnLButtonDown and OnRButtonDown methods (you also need to specify the mouse actions in the message map). PreTranslateMessage shall check if( pMsg->message == WM_KEYDOWN ), and in this case call OnKeyDown followed by CWnd::PreTranslateMessage and return TRUE (so the message doesn't get dispatched). If not, it shall return whatever CWnd::PreTranslateMessage returns. In the mouse handling methods, call SetFocus to get the focus when clicked.
New problem: the call you do to OnKeyDown is ignored (in classes that inherit from our base class, at least).
Reason: Don't know why...
Solution: Create a new virtual OnKeyDown method which would have a different signature from the original method (for example, one that only takes the nChar argument) and call that one. Now, put the key handling stuff in that new OnKeyDown method.
The solution therefore doesn't require you to overload CDialog::PreTranslateMessage or do other things like that. Note that the modification done to PreTranslateMessage is also very small, which makes that the overall behaviour of the control as well as the dialog box remains the same...
S. Ali Tokmen
http://ali.tokmen.com
---------------------------------------------------------------
NOTE: This message has been sent from an unattended email box.
Daily news delivered: The Code Project Insider
Sign up at http://www.codeproject.com/Redir.aspx?id=1648
Why are you sending this to my personal in box. How does doing that help anyone? Please keep all messages in this forum so that others with the same problem can learn from it.
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
Hello
I had sent you as an e-mail as well since I had sent a message saying "please help me" ... to say that you don't need to help anymore
Sorry for the noise
Cheers
S. Ali Tokmen
http://ali.tokmen.com/
|
|
|
|
|
OK, I've solved the issue... Here's how it goes:
Problem: when there's a control in a dialog box replacing a STATIC resource, it will lose focus as soon as a key is pressed (things move in the dialog box) and it will never receive the OnKeyDown call.
Reason: STATIC is not supposed to be doing input/output, as a result it cannot receive keyboard events. As a result, you won't receive the OnKeyDown call (even if you do put it in the message map) and any pressed key, since not captured by the STATIC, will get dispatched to the parent (the dialog box) and this will make it take the default action -changing the selected button.
Solution: in the class that wants to go into a STATIC, overload the PreTranslateMessage, OnLButtonDown and OnRButtonDown methods (you also need to specify the mouse actions in the message map). PreTranslateMessage shall check if( pMsg->message == WM_KEYDOWN ), and in this case call OnKeyDown followed by CWnd::PreTranslateMessage and return TRUE (so the message doesn't get dispatched). If not, it shall return whatever CWnd::PreTranslateMessage returns. In the mouse handling methods, call SetFocus to get the focus when clicked.
New problem: the call you do to OnKeyDown is ignored (in classes that inherit from our base class, at least).
Reason: Don't know why...
Solution: Create a new virtual OnKeyDown method which would have a different signature from the original method (for example, one that only takes the nChar argument) and call that one. Now, put the key handling stuff in that new OnKeyDown method.
The solution therefore doesn't require you to overload CDialog::PreTranslateMessage or do other things like that. Note that the modification done to PreTranslateMessage is also very small, which makes that the overall behaviour of the control as well as the dialog box remains the same...
S. Ali Tokmen
http://ali.tokmen.com
|
|
|
|
|
Hi all, I'm currently performing the following sequence of actions:
- My prog creates a directory
- It opens an OLE link to an external program, which creates files in that directory
- the OLE link releases the dispatch driver
- The external program may quit
- My prog deletes the files from the directory
At this point, my prog tries to delete the directory, but it fails with the error message that another process is still using the directory.
Any ideas, please?
Cheers,
Steve.
Asynes yw brassa ages kwilkynyow.
|
|
|
|
|
Hi all.
I am using MFC, and I want to display a bitmap on a button. I created the resource and it appeared in the bitmap resources as IDB_BITMAP1. Now I added a button named m_opaque and added the followin code to the OnPaint function:
void HelloDlg::OnPaint()<br />
{<br />
if (IsIconic())<br />
{<br />
CPaintDC dc(this);
<br />
SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);<br />
<br />
int cxIcon = GetSystemMetrics(SM_CXICON);<br />
int cyIcon = GetSystemMetrics(SM_CYICON);<br />
CRect rect;<br />
GetClientRect(&rect);<br />
int x = (rect.Width() - cxIcon + 1) / 2;<br />
int y = (rect.Height() - cyIcon + 1) / 2;<br />
<br />
dc.DrawIcon(x, y, m_hIcon);<br />
m_opaque.ModifyStyle(0, WS_CHILD|WS_VISIBLE|BS_BITMAP);<br />
m_opaque.SetBitmap( ::LoadBitmap(NULL, MAKEINTRESOURCE(IDB_BITMAP1)) );<br />
}<br />
else<br />
{<br />
CDialog::OnPaint();<br />
}<br />
}<br />
The code compiles but the image doesnt appear. what is the reason?
-- modified at 11:27 Tuesday 11th July, 2006
|
|
|
|
|
safigh wrote: if (IsIconic())
You are painting only when the window is minimized!
Also setting the bitmap is not a "painting" function. That should be done during initialization not painting.
Last modified: Tuesday, July 11, 2006 10:26:23 AM --
|
|
|
|
|
Adding these two line to the init dialog also doesnt show the picture????
m_opaque.ModifyStyle(0, WS_CHILD|WS_VISIBLE|BS_BITMAP);
m_opaque.SetBitmap( ::LoadBitmap(NULL, MAKEINTRESOURCE(IDB_BITMAP1)) );
|
|
|
|
|
You are painting in the OnPaint message of the dialog when the dialog is minimized.
If you want to draw the bitmap on a button that is child control of the dialog, you are not painting at the right place.
To draw a bitmap on a button, you can use the CBitmapButton class.
Louis
* google is your friend *
|
|
|
|
|
See here.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi all. could any one tell me how i can add webbrowser controle to my visual c++ 6 MFC project? I already have project made byMFC AppWizard which has a few conroles such as buttons an textbox/editbox and i want to add to it a webbrowser controle.Thanks
|
|
|
|
|
Examples exist on MSDN and likely here on CodeProject as well. Did you search at all?
http://www.codeproject.com/cpp/htmleditvc6.asp[^]
"Just about every question you've asked over the last 3-4 days has been "urgent". Perhaps a little planning would be helpful?" Colin Angus Mackay in the C# forum
led mike
|
|
|
|
|
man i am using MFC with dialog and just want to display a webpage in part of a form. But that example never talkes bout url!!
All i want to dispaly a site such www.cnn.com inside the form just like visual basic webbrowser controle.
|
|
|
|
|
method007 wrote: But that example never talkes bout url!!
Then do a freakin search and find one that does, there are hundereds of them including on the MSDN site!
"Just about every question you've asked over the last 3-4 days has been "urgent". Perhaps a little planning would be helpful?" Colin Angus Mackay in the C# forum
led mike
|
|
|
|
|
If u do not want to help some one do not try to flame. i am new to visual c++ world so if u do not want to help just do not reply!! very simple. do not think every one is in same level!!
|
|
|
|
|