|
Hi Richard. Nope, unfortunately it doesn't help. Did you try WS_BORDER with the code above? If you put that WS_BORDER style, the window will still have a title bar. There is not noticeable difference between WS_BORDER and WS_CAPTION.
Pf... totally weird. WS_POPUP | WS_BORDER creates something of a 2D window but I am definitely sure that I was able to create a window with caption, maximize, minimze buttons AND 2D ASPECT! And now I can't do it no more. Aarggggghh! I'm so pissed off! I gotta dug up from the grave some of my old code apparently.
-= E C H Y S T T A S =-
The Greater Mind Balance
Blending C++ with COM ^
|
|
|
|
|
I need a way of limiting the user to enter only integers. The code below goes in an endless loop if any character other than a digit is entered on the screen. I can not use the isdigit() or isalpha() functions as they can only be used for character types. How should I change my test condition to accommodate this? The data2 variable is of type int.
while ((data2 <= 0) || (data2 > 12))
{
cout << "Please subunit number: ";
cin >> data2;
cin.getline(buffer, 99, '\n');
}
-- modified at 16:52 Tuesday 11th July, 2006
|
|
|
|
|
Harold_Wishes wrote: while ((data2 <= 0) || (data2 > 12))
{
cout << "Please subunit number: ";
cin >> data2;
cin.getline(buffer, 99, '\n');
}
Do you mean to have your range of valid values to be (-inf, 0) U (13, inf)? I think you mean to do this:
while (data2 >= 0 && data2 < 12)
{
cout << "Please subunit number: ";
cin >> data2;
cin.getline(buffer, 99, '\n');
}
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
I want to allow integers greater than zero and less than 12. Initially I used the && operator. But when I type in a number out of this range, it jumps out of the while loop and never asks me to enter a valid number. Oddly enough, it worked with the || operator with the screen prompting me as appropriate for numbers out of range. But the program fails in both cases if I type in a non-numeric value.
|
|
|
|
|
Harold_Wishes wrote: I want to allow integers greater than zero and less than 12.
(data2 <= 0) || (data2 > 12)
That will allow all integers below or equal to 0 or greater than 12, but reject anything that is from 1 to 11. What you want is: (data2 >= 0 && data2 < 12) .
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Personally, I'd let the user enter whatever and not read anything until he or she hits enter. After he or she hit enter I'd try and decide if what they typed was a valid number; doing something like
<code>
char buff[1024]; //whatever the user entered
unsigned int value;
int charsRead;
bool validEntry = false;
while(!validEntry) {
//prompt the user
//get a line from the user via whatever method...
if (sscanf(buff, "%u%n", &value, &charsRead) == 1) {
//can further compare charsRead w/ strlen if you want, ie
//test strlen(buff) == charsRead
//
validEntry = true;
}
}
</code>
earl
-- modified at 19:14 Tuesday 11th July, 2006
|
|
|
|
|
earl wrote: Personally, I'd let the user enter whatever and not read anything until he or she hits enter.
That is what cin does ... with far less code.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Hi all could any one show me how to collect the bold part data from a webbrowser controle . I want to collect those data and place them in a listview and use the color code to color the name in listview. I be happy if some one show me how this can be done. The nubmer of rows in the table are dynamic.Thanks
Note: i want to extract the name and color1 and color2 data from webbrowsser controle as shown in pic
[IMG]http://i5.photobucket.com/albums/y180/method007/extractData.jpg[/IMG]
webbrowser html code:
<html><br />
<br />
<head><br />
<meta http-equiv="refresh" content="60"><br />
</head><br />
<br />
<br />
<p><ul><table border=1 cellpadding=4<br />
<br />
<tr><th>Name</th> <th> color </th> <th> color2 </th> </tr><br />
<tr><td><font color="0800">tony</font></td> <td>32768</td> <td>0800</td><br />
<br />
<tr><td><font color="FF0FF">cindy</font></td> <td>16711935</td> <td>FF0FF</td><br />
<br />
<tr><td><font color="800FF">sarah</font></td> <td>16711808</td> <td>800FF</td> <br />
<br />
</table><br />
</body><br />
</html>
|
|
|
|
|
See here. Use "TD" instead of "FONT" for pcVal .
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
david i am new to visual c++ 6 . i came from visual basic 6 and it is hard for me to use that code. could u tell me step by step how to use that code. I do not know how to implement it. i already have an mfc form with webbrowser on it that loads a specific webpage . I do not know how use your code to extract that data i want. could u tell me how to use u code ? where to place and how to feed it with my html ....
|
|
|
|
|
method007 wrote: could u tell me step by step how to use that code.
You'll need this in your CDialog -derived class:
BEGIN_EVENTSINK_MAP(CMyDialog, CDialog)
ON_EVENT(CMyDialog, IDC_EXPLORER, 259 , OnDocumentCompleteExplorer, VTS_DISPATCH VTS_PVARIANT)
END_EVENTSINK_MAP() Then put that other code into:
void CMyDialog::OnDocumentCompleteExplorer(LPDISPATCH pDisp, VARIANT FAR* URL); After the DocumentComplete event has been received, the OnDocumentCompleteExplorer() method can then be used to extract the data.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
david i am lost here. i do not know what class u are talking about !! I have no idea where to place u code!!! what does this code do. I even do know how to add a listview to my project so it place the extracted data into it!!
|
|
|
|
|
method007 wrote: i do not know what class u are talking about !! I have no idea where to place u code!!!
Isn't your project a dialog-based application? Put the code in your CDialog -derived class (i.e., CFindUserDlg ).
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
My project is MFC as u see in the pic . I have no idea where i have to put your code!!! what part should i put your code and what your does without listview !!!! see the pic and tell me wha should i do ? i am dong this in visual c++ 6.
unfortuney the way u explain is like i am 10 years experienced c++ prorammer which i am not ,i just started!!
[IMG]http://i5.photobucket.com/albums/y180/method007/project.jpg[/IMG]
could u just make a project and add a webbrowser with a html code that i gave u and show me hwo to extract that data and place it in listview.That way i do not have to explain over and over what i have in mind!!
-- modified at 17:05 Tuesday 11th July, 2006
|
|
|
|
|
method007 wrote: unfortuney the way u explain is like i am 10 years experienced c++ prorammer which i am not ,i just started!!
I think you need to get more experience in general C++/MFC before doing this, Adding and Extracting HTML from a web browser is not a really complex task, but it needs to have some more knowledge.
have a look at those articles :
http://www.codeproject.com/miscctrl/#HTML+Browser+Controls[^]
it should help you a lot.
M.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
method007 wrote: I have no idea where i have to put your code!!!
As I mentioned already, put the code in your CDialog -derived class (i.e., CFindUserDlg ). If this is troubling for you, perhaps you need to start with a less ambitious project. It makes no sense to dive into a project such as this when even the basics of VC++ are new to you. Start with something simple so that you can get comfortable with the IDE. Otherwise you'll just frustrate yourself (and others).
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
David i do not have CFindUserDlg !!! as u see in that pic i have FindUserDlg.h and FindUserDlg.cpp . Which one and what part ? Furthermore, i do not see any part of this code refrencing a url . How it will do the work if it does not access a url !!!
<br />
You'll need this in your CDialog-derived class:<br />
<br />
<br />
BEGIN_EVENTSINK_MAP(CMyDialog, CDialog) //{{AFX_EVENTSINK_MAP(CMyDialog) ON_EVENT(CMyDialog, IDC_EXPLORER, 259 /* DocumentComplete */, OnDocumentCompleteExplorer, VTS_DISPATCH VTS_PVARIANT) //}}AFX_EVENTSINK_MAPEND_EVENTSINK_MAP()<br />
Then put that other code into:<br />
<br />
<br />
void CMyDialog::OnDocumentCompleteExplorer(LPDISPATCH pDisp, VARIANT FAR* URL);<br />
After the DocumentComplete event has been received, the OnDocumentCompleteExplorer() method can then be used to extract the data.
-- modified at 9:38 Wednesday 12th July, 2006
|
|
|
|
|
method007 wrote: David i do not have CFindUserDlg !!! as u see in that pic i have FindUserDlg.h and FindUserDlg.cpp .
The files (FindUserDlg.h and FindUserDlg.cpp) contain the class (CFindUserDlg ). Open the files to verify.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
ok here is the content of FindUserDlg.cpp . What should i put there and where?
<br />
class CFindUserDlg : public CDialog<br />
{<br />
public:<br />
CFindUserDlg(CWnd* pParent = NULL);
<br />
enum { IDD = IDD_FINDUSER_DIALOG };<br />
CString m_nick;<br />
CWebBrowser2 m_wbrow;<br />
<br />
protected:<br />
virtual void DoDataExchange(CDataExchange* pDX);
<br />
protected:<br />
HICON m_hIcon;<br />
<br />
virtual BOOL OnInitDialog();<br />
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);<br />
afx_msg void OnPaint();<br />
afx_msg HCURSOR OnQueryDragIcon();<br />
afx_msg void OnButton1();<br />
DECLARE_MESSAGE_MAP()<br />
<br />
public: <br />
int GetPosByNick(CString szNick); <br />
<br />
};
|
|
|
|
|
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
afx_msg void OnButton1();
afx_msg void OnDocumentCompleteExplorer(LPDISPATCH pDisp, VARIANT FAR* URL);
DECLARE_EVENTSINK_MAP()
DECLARE_MESSAGE_MAP()
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
All
I have a situation where I want to use an environment variable in the path during linking with VC7.
A) is it possible to use environment variables in the path to your OutputFile in the linker options?
B) If so, what is the syntax to use an environment variable in the linkers OutputFile options.
Thanks for your time
Dave
|
|
|
|
|
Configuration Properties:
Output directory:$(PATH_OF_ENV_VAR)
Linker->$(OutDir)/$(ProjectName).exe
where PATH_OF_ENV_VAR is your env variable.
You may need to restart your machine.
similary you can use $(var) in other options also.
Hope these help.
Regards
Abhishake Lahare
|
|
|
|
|
Thanks Abhishake
I ended up finding it after some scowering of the documentation. The very important step is what you mentioned. The re-boot. You have to re-boot after setting a system environment variable. That held me up for about 20 mins too.
Thanks again
Dave
Programming is like cake, you start on one piece and you want eat the whole thing.
|
|
|
|
|
Greetings:
I have long been aware of how difficult working with property sheets can be, but whenever I get down to having to deal with one, it never fails to amaze me just how awful they truly are...
Anyway, I set out to make a property sheet where the pages can be re-ordered. Can't do that, I know, so I set out to make it so that if I wanted to insert a property page into the sheet that was NOT at the end, I would actually remove the pages AFTER the point where I wanted to insert the new page and then re-add the pages that were already there.
This worked fine until I tried to INSERT a new page at position ZERO. It seems that if I remove ALL of the pages from the sheet, the property sheet spontaneously commits suicide. Isn't that nice? Who at Microsoft thought that this would be a good idea? What is so wrong with a property sheet that is blank for a few microseconds before it is populated or repopulated?
Can anybody lend some advice here, if not sympathy would be accepted. I really need my property pages to be ordered in a certain way and I will have to insert new pages and also re-order existing ones.
Thanks in advance,
Mark, Toronto
|
|
|
|
|
Hi Again:
Shortly after sending off my rant, I realized that my delemma had a simple solution:
In any case of inserting a page, including in the ZERO position, add the new page first, then remove all of the pages that you want to have positioned AFTER the new page. Then just add them all back.
Adding the new page FIRST ensures that the property sheet is never naked.
That's my story.
Regards,
Mark
PS: I still think that property sheets are stupid...
|
|
|
|