|
With
std::vector< double > v(10);
you create a vector of 10 elements with the value of 0.0
Later, with
v.push_back()
you add elements at the end of the vector.
When you display the first 10 items of the vector, you only show the zeros inserted at construction.
When you let your loop run to v.size() , (make i an unsigned int , or better still, std::vector< double >::size_type ) it should display all you did put into the vector.
Hope this did clear things up for you
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|
|
Thanks YaronNir
std::vector
cleared up a few stuff
? 0.1,......up until 999.1
push_back(?)(or i + 0.1)
display all contents in vector
bhangie
regards
|
|
|
|
|
Thanks oaks
got a better better understanding now!
bhangie
|
|
|
|
|
Just as an excercise -
Here is how to use iterators for the display:
#include "stdafx.h"
#include "vector"
#include "iostream"
#include "string"
int _tmain(int argc, _TCHAR* argv[])
{
std::vector< double > v(10);
for(int i = 0; i < 10; ++i)
v.push_back(i + 0.1);
std::vector< double >::iterator it = v.begin();
while (it != v.end())
{
std::cout << *it << "\n";
++it;
}
std::string s;
std::cin >> s;
}
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|
|
i have a dilaog, on it i've placed a picture (from the resource controls)
i set the properties to icon.
the icon i have in the resources is 16x16, but when the dilaog is shown i get an icon image of 32x32.....why is that?
can any1 help me here? i need to display the 16x16 image (and i do not want to use a bitmap)
thanks in advanced
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
In the properties of the picture frame.. Go to styles and check the real size image.. It will still look large inside the development environment but once you execute the program you will see that it does in fact show up as 16x16.
Rob
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
thanks man
that really helped me!
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
no problem..
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
CPaintDC dc(this);<br />
<br />
CRect r(0,0,10,10);<br />
CBrush brush(RGB(0,0,0));<br />
<br />
dc.FillRect(&r,&brush);<br />
This piece of code draws a filled rectangle at position 0,0.
How can I change the offset of the DC, that the rectangle will paint at, for instance, (x50,y50), without changing the CRect object itself?
I've tried some of the OffsetViewportOrg and SetWindowOrg methods, but I can't seem to make it work. It only changes the clip region.
I've tried SetBrushOrg too, together with Unrealize and SelectObject, but that doesn't change anything at all. If I read the msdn right, this is the function to use! But how?
How can I change the DC's offset?
using: [VISUAL STUDIO 6.0 sp5] [WIN98/2]
|
|
|
|
|
|
dwccgc wrote:
Did you try SetViewportOrg()?
Yes, it only moves the clip rectangle. The rectangle itself is still painted at 0,0.
dwccgc wrote:
Did you check your "Mapping Modes"?
Mapmode is 1 (==MM_TEXT).
I think I have to use the SetBrushOrg, but that doesn't seem to work.
using: [VISUAL STUDIO 6.0 sp5] [WIN98/2]
|
|
|
|
|
I found some old code where I draw a Polygon. I use CClientDC instead of CPaintDC.
CMyView::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct)
{
CClientDC dc(this);
..
..
CRect rcArea(lpDrawItemStruct->rcItem);
rcArea.DeflateRect(20, 20);
dc.SetViewportOrg(rcArea.left, rcArea.bottom);
..
..
dc.Polygon(PolyPoints.pt, PolyPoints.nCoord);
..
..
}
Did you have any luck with that MS Scribble Link I left on the previous message?
|
|
|
|
|
I'll try it.
No, I don't have the examples, and there's no download at that page.
using: [VISUAL STUDIO 6.0 sp5] [WIN98/2]
|
|
|
|
|
|
dwccgc wrote:
You can also find the samples on your MSDN Library Disks
I know, but I don't have the disks either...
But, meanwhile, I found a solution (workaround).
Instead of this:
CPaintDC dc(this)<br />
Use this:
PAINTSTRUCT ps;<br />
CDC* pDC=NULL;<br />
pDC=BeginPaint(&ps);<br />
<br />
...<br />
<br />
EndPaint(&ps);<br />
With the second code, the DC's offsets work the way they should. I don't know why they don't work with CPaintDC (nor CClientDC).
using: [VISUAL STUDIO 6.0 sp5] [WIN98/2]
|
|
|
|
|
Dear ALL,
I am developing an application for Windows 2000 in MFC VC++ Version 6.0.
My application runs as an interactive service.
I am using a dll in my program which is used to hide given key(s) from the registry. The program works fine and hides the given keys from registry. But when i log off my system and login, the following error occurs:
...............................
SAS Window: Winlogon.exe Application error.
The instruction at "0x01007f2d" refereced memory at "0x00006c". The memory could not be read. Click ok to close and cancel to debug.
...............................
On clicking ok the system restarts.
I think I need to free the dll before logging out. So I tried FreeLibrary in QueryEndSession, but it didnot helped.
Is there any other way to free the dll.
Or any other way out to solve the problem ?
The program is working fine when I restart and login (probably because at that time the dll is freed and loaded again,, but the same is not in case of log off and log in)
Thanks
Rohit
|
|
|
|
|
'Hide keys from the registry' - explain?
If you're dynamically hiding the ones that WinLogon relies on, this may well be causing this crash.
WinLogon is considered a critical service by Windows NT-based operating systems. The Session Manager subsystem, SMSS.EXE, which starts WinLogon, waits on WinLogon's process handle. If WinLogon (or CSRSS, also a critical service) terminates unexpectedly, SMSS crashes the system (which typically leads to an automatic reboot, if you haven't changed the defaults).
Have you perhaps installed a custom GINA?
|
|
|
|
|
Dear Mike,
I have not used custom GINA.
I have used the dll to hide the registry specified keys.
I got it from:
http://www.codeproject.com/system/hidereg.asp
This dll hides a registry string from regedit by hooking the RegEnumValueW API. I used this dll in my application to hide the password string from the registry.
I am loading this dll from my application which is running as an interactive service. As soon as the person opens registry editor , I load the dll and and this dll hides the password string. The program is working fine when i restart my system and login. This is becoz When i restart the system the dll is unloaded automatically , but when i logoff and login , the problem occurs (perhaps becoz the dll is not freed )
What do you suggest ??
Please let me know if my problem is clear or not.
|
|
|
|
|
|
I'm using MFC and VS6. I have a dialog with a list control on. My question is if there is a way to prevent the blue "Hi-light" rectangle from being drawn when I click on an item in the list control? I'm already using CustomDraw to colorize certain rows in it.
Can CustomDraw be used or do I have to use OwnerDraw? I'm a newbie in C++, so I have no experience from OwnerDraw yet.
Would be thankful if someone could point me out in the right direction!
|
|
|
|
|
My simple answer is don't do it. The user will want to know which item in the tree is selected, and is likely to be used to the convention used by Explorer.
If you propose using another form of feedback to indicate the selected item, remember that the user has configured colours in the operating system to indicate selected items - it is not necessarily blue (and may not be for a partially sighted user). To get the appropriate colour, use GetSysColor or GetSysColorBrush with the COLOR_HIGHLIGHT argument.
|
|
|
|
|
void CMyView::OnSelchangeMyListBox()
{
m_MyListCtrl.SetCurSel(-1);
}
|
|
|
|
|
I'm using item and subitem editing in all cells in the list control, so either an editbox, combobox or listbox is shown on top of the selected cell.
I'm using "SetItemState" after editing to prevent the blue rectangle from coming up, but every time you click on an item you see the rectangle flashing by. To perfect my app I would like to get rid of even this one, even if you just see it for some milliseconds.
Maybe I'm a pedant, but I'm never satisfied with something until I get it 100%.
|
|
|
|
|
Hi Experts,
I am using MICROSOFT HELP WORKSHOP to develop help for my VC ++ application.
It has gor 3 help files HELP.hlp HELP1.hlp and HELP2.hlp.
And a content file which describes these three files.
The three help files have links to three RTF documents which contain the information.
I donot know how to configure the OPTIONS and MAP.
I am getting error when i try to compile and execute the CONTENTS file and try opening any one of the three help files.
The error is " THE TOPIC DOES NOT EXIST. CONTACT YOUR APPLICATION VENDOR FOR UPDATED HELP FILE".
and even a note while compiling as:
HC1010: Note:
The following mapped Topic IDs were not used in any topic:
IDH_ID.
I am not being able to locate the LOG File.
I have given topic ids for the three help files as IDH_ID, IDH_ID1, IDH_ID2
Please let me know the modifications i need to make.
The Log file info. is as follows.
LOG FILE INFO HELP.hlp::
Microsoft (R) Help Compiler
HCRTF 4.03.0002
Copyright (c) Microsoft Corp 1990 - 1995. All rights reserved.
help.hpj
HC1010: Note:
The following mapped Topic IDs were not used in any topic:
IDH_ID
0 Topics
0 Jumps
0 Keywords
0 Bitmaps
Created D:\CREATE HELP\HELP WRK SHOP\Project\Help.hlp, 3,823 bytes
Compile time: 0 minutes, 0 seconds
1 note, 0 warnings
LOG FILE FOR CONTENTS.CNT::
Creating the help file Help.hlp.
Processing D:\CREATE HELP\HELP WRK SHOP\Project\TOPIC.rtf
HC1010: Note:
The following mapped Topic IDs were not used in any topic:
IDH_CATALOGUE
Resolving keywords...
Adding bitmaps...
0 Topics
0 Jumps
0 Keywords
0 Bitmaps
Created D:\CREATE HELP\HELP WRK SHOP\Project\Help.hlp, 3,823 bytes
Compile time: 0 minutes, 0 seconds
1 note, 0 warnings
KINDLY LET ME KNOW THE PROCEDURE AND FORMAT FOR SETTING THE TOPIC IDs.
Regards
Ram
|
|
|
|
|
The RTF files in your project can have many individual topics present in them. A typical one would look like:
${\footnote The title of the topic}
K{\footnote Topic keywords1; Topic keywords2; ...; ...}
#{\footnote HIDD_OF_DIALOG}
{\b Topic title}\line
\line
Topic text\line
\page
When you compile your help file, HelpWorkshop makes use of the YourAppName.hm file, which contains all the topics ID's. This is generated from your apps resource.h file by running the MakeHelp.Bat file, which can be found in your applications main source file directory.
To create a help topic, add a topic entry like above with the correct topic ID, typically HIDD_DIALOG_ID for example, to one of your .rtf files. Then once compiled, you can copy your .hlp file to the application directory and test it. Use helpworkshop to monitor which help messages are being requested. Use the option View\WinHelp messages<\b>
This is a brief overview. Hopefully, will be of some help.
Roger Allen
Sonork 100.10016
Were you different as a kid? Did you ever say "Ooohhh, shiny red" even once? - Paul Watson 11-February-2003
|
|
|
|