|
Will it be any chance that the standard library (std::map) is using *another* method to allocate memory, so the memory is invalid after passing through DLL - App boundary ?
|
|
|
|
|
I think my problem is this one :
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q172396
After studying, I'll tell how do I solve it. Thanks ^^
|
|
|
|
|
Hi,
I really want to know who worked with advanced scsi programming and VC++
in this disscuss list?
I have done some works in recent two weeks with the help of the disscussion board, including finding all the drivers, read/write datas from/to cd-rom, insert/eject cdroms and ...
by using aspi32scsi code. As a comparison, Would you please show me similar works or some
materials about this topic?
Thanks in advance!
chen
|
|
|
|
|
This one has me a bit stumped.
I used Erik T's excellent ATL object wizard and tutorial articles to make a toolbar (like the CP toolbar), and I have added a button to the Standard Buttons bar of Explorer which pops the toolbar on and off. Works fine...
...except for one sniggly little feature.
The docs tell you to create two icon files or resources - one with 16 (16c) and 20(256c) bit gray images, and one with like sized 'hot' or color images. Ok sure fine. When IE loads, it checks whether its set to display small or large icons and gets the right ones to use for the SB bar button.
The problem arises when the user selects 'Customize' and changes from small icons to large or vv. The gray icon gets selected ok, but the color one becomes a 'dithered' (for lack of a better term) version of the one currently being shown. This can really mess up the quality of the hot image, until the user either goes back to the icon size in force when IE loaded or reloads IE.
I've noticed another quirk that can happen when a control specifies a single icon resource/file, or the one loaded previous (listed prior in the reg settings) has only one or the wrong icons - the icon for one can appear in the standard button for the other! This leads me to suspect that there is some image list indexing going on, but haven't gotten far on that track.
Toolbars like Google and CP avoid this aspect of adding to the Standard Buttons bar. If I could find a sample that did this correctly, that would help - or even find the IE icons in .ico or resource form, though I'm not sure they exist as such.
Has anyone any insight here? I realize its not a show stopper, but its dang annoying.
Any hot leads, musings, or even sentences starting with 'ya know I think I once...' and/or ending with '...can't for the life of me remember where' will be muchly appreciated.
|
|
|
|
|
I doubt it'll help you much, but the normal IE icons are kept in browseui.dll. They're just bitmaps, all the hot buttons in one, all the gray in another, separate ones for 256 color, etc.
--------
You can change the extention so it reads ASP even though it is PHP which is kind of cool. - Martin Marvinski --Shog9 --
|
|
|
|
|
Thanks - that may help!
Will 'av a go...
|
|
|
|
|
I once discussed the "wrong size icon being shown" problem with Erik. (I had in mind a button for the Standard toolbar that would open the CP home page.) Neither of us could come up with a fix, though.
--Mike--
Just released - RightClick-Encrypt - Adds fast & easy file encryption to Explorer
Like the Google toolbar? Then check out UltraBar, with more features & customizable search engines!
My really out-of-date homepage
Sonork - 100.10414 AcidHelm
|
|
|
|
|
Thanks Mike
So... better minds than mine have failed... hmmm... what would Poirot do...
|
|
|
|
|
ok, this is my code:
char ID::SetID(char SID[11])
{
char *pID[11];
char SSID[11];
pID = &SSID;
*pID = SID;
strcpy(&M_ID, SSID);
return 0;
}
//i got my code to work with one character, now i want to make it work with more like 10
i have one problem "yet again" and it deals with the line:
pID = &SSID; //i dont understand my error.
this is the error:
error C2440: '=' : cannot convert from 'char (*)[11]' to 'char *[11]'
what does (*) mean, and: is there another way to declare a pointer to point to somthing?
Thanks for your help!
~SilverShalkin
|
|
|
|
|
if pSID is NUL terminated string then code is:
char ID::SetID(char *pSID)
{
strcpy(&M_ID, pSID);
return 0;
}
if pSID array of char then code is:
char ID::SetID(char *pSID, int isize = 10)
{
memcpy(&M_ID, pSID, isize);
return 0;
}
soptest
|
|
|
|
|
You would do better to use std::string instead of char arrays.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
And you don't spend much time with the opposite sex working day and night, unless the pizza delivery person happens to be young, cute, single and female. I can assure you, I've consumed more than a programmer's allotment of pizza, and these conditions have never aligned. - Christopher Duncan - 18/04/2002
|
|
|
|
|
Christian Graus wrote:
You would do better to use std::string instead of char arrays.
Is this an automated reply to any query on using char*s or CStrings?
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
char*, yes. CString or _bstr_t, no. std::string is not as complete as it could be, I use it where it does all I need, otherwise I reach for one of the other string classes, ( although we do not use MFC here ), but I would pretty much never use a char *.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
And you don't spend much time with the opposite sex working day and night, unless the pizza delivery person happens to be young, cute, single and female. I can assure you, I've consumed more than a programmer's allotment of pizza, and these conditions have never aligned. - Christopher Duncan - 18/04/2002
|
|
|
|
|
Christian Graus wrote:
I reach for one of the other string classes, ( although we do not use MFC here ),
non-MFC and non-STL string classes???
ATL?
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
_bstr_t wraps a BSTR and a char *, so they are interchangable. CComBSTR is a BSTR wrapper. Both are used in COM, but I don't think they are specific to ATL. We have a class derived from std::string called CString which does a lot of what the MFC one does. ( Yes, I know you should not derive from std::string, I was not here when they did it ).
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
And you don't spend much time with the opposite sex working day and night, unless the pizza delivery person happens to be young, cute, single and female. I can assure you, I've consumed more than a programmer's allotment of pizza, and these conditions have never aligned. - Christopher Duncan - 18/04/2002
|
|
|
|
|
Hi!
The char *pID[11] declare an array of 11 pointers to char
The char SSID[11] declare an array of 11 char
So I think you mean char (*pID)[11]
Anyway you can not do *pID=SID because *pID is not a l-value so you have to use a function like memcopy ... or strcopy if it is a string
Bye,
Orbital^
...the night is long ... but not long enought to do some real coding ...
|
|
|
|
|
Orbital^ wrote:
Anyway you can not do *pID=SID because *pID is not a l-value so you have to use a function like memcopy ... or strcopy if it is a string
that makes more sense! so everything dealing with arrays, do not set equal, yet, strcpy() and memcpy()?
i'll look through some more things, and try it again!
Thanks everybody!
i alos will check out std::string
~SilverShalkin
|
|
|
|
|
zenix2 (Visitor) May 29, 2002
Hi, I have this simple little program I need to complete for a course I am taking and am finding it impossible to organize my Grid.
The code I have so far is:
void CFGridDlg::LoadData()
{
//Get the grid row count
int liCount;
//Initialize the random number generator
srand((unsigned)time(NULL));
//Create and array
for (liCount = m_ctlFGrid.GetFixedRows();
liCount < m_ctlFGrid.GetRows(); liCount++)
{
//Generate the first Column (Jan) values
//m_ctlFGrid.SetTextArray(GenID(liCount, 0), StringValue(1));
//Generate the second column (Jan) values
m_ctlFGrid.SetTextArray(GenID(liCount, 1), StringValue(1));
//Generate the third column (Feb) values
m_ctlFGrid.SetTextArray(GenID(liCount, 2), StringValue(1));
//Generate the fourth column (Mar) values
m_ctlFGrid.SetTextArray(GenID(liCount, 3), StringValue(1));
//Generate the fifth column (Apr) values
m_ctlFGrid.SetTextArray(GenID(liCount, 4), StringValue(1));
//Generate the sixth column (May) values
m_ctlFGrid.SetTextArray(GenID(liCount, 5), StringValue(1));
//Generate the seventh colummn (Jun) values
m_ctlFGrid.SetTextArray(GenID(liCount, 6), StringValue(1));
DoSort();
}
}
int CFGridDlg::GenID(int m_iRow, int m_iCol)
{
//Get number of columns
int liCols = m_ctlFGrid.GetCols();
//Generate ID's. based on number of Rows, the current row, and the current column
return (m_iCol + liCols * m_iRow);
}
CString CFGridDlg::StringValue(int m_iColumn)
{
//The return Str.
CString reStr;
//Random Value ID
int raCase;
//Set the selection to column 1
//m_ctlFGrid.SetCol(1);
{
//Generate random val.
raCase = (rand() % 5);
//What val was generated?
switch (raCase)
{
case 0: //Rent
reStr = "$650.00";
break;
case 1: //Insurance
reStr = "$259.00";
break;
case 2: //Utilities
reStr = "$130.00";
break;
case 3: //Car payment
reStr = "$220.00";
break;
case 4: //Loans
reStr = "$60.00";
break;
default: //Credit cards
reStr = "$30.00";
break;
}
}
return reStr;
}
void CFGridDlg::DoSort()
{
//Set the current column to column 1
m_ctlFGrid.SetCol(1);
//Set the selection to all columns
m_ctlFGrid.SetColSel((m_ctlFGrid.GetCols() - 1));
//Ascending sort
m_ctlFGrid.SetSort(0);
}
I have experimented with all I could think of and have reached wits end I think. The top row is supposed to be Jan - June and column 0 is supposed to be "Rent/Mortg., Insurance, Utilites, Car Payment, Loans, and Credit cards." I've been able to set all this up, but the values in order for the columns by row are supposed to be 650.00, 259.00, 130.00, 220.00, 60.00, 30.00"
My code makes multiple entry of the same values and leaves some entries out.
Your assistance would be really appreciated.
Thanks,
Garry
|
|
|
|
|
Do you need to use Flexgrid ? Chris Maunders grid control canes it, you can get it here on CP.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
And you don't spend much time with the opposite sex working day and night, unless the pizza delivery person happens to be young, cute, single and female. I can assure you, I've consumed more than a programmer's allotment of pizza, and these conditions have never aligned. - Christopher Duncan - 18/04/2002
|
|
|
|
|
Yeah, the assignment calls for FlexGrid.
|
|
|
|
|
Hi All,
A Quick question. I am trying to create controls on a form at run time, in a CFormView derived class. I have got the following code, which is trying to create a static label on the form, that should display the word "Test". I got the styles and extended styles for the window from looking at another static labels properties in Spy++. This is in my CFormView derived class's OnInitialUpdate:
HWND hWndTest = CreateWindowEx(
WS_EX_LEFT | WS_EX_LTRREADING | WS_EX_RIGHTSCROLLBAR | WS_EX_NOPARENTNOTIFY, // extended window style
"Static", // registered class name
"Test", // window name
WS_VISIBLE | WS_CHILDWINDOW | WS_GROUP | SS_LEFT, // window style
30, // horizontal position of window
30, // vertical position of window
40, // window width
20, // window height
m_hWnd, // handle to parent or owner window
NULL, // menu handle or child identifier
NULL, // handle to application instance
NULL // window-creation data
);
The thing is, I get a static label on the form, that is in fact displaying the word "Test", but it looks different than the static labels that I put on the dialog template. The font is bold, or something.
Anybody ever done this before? Why would this produce a different lookin label than doing it the normal way?
Thanks,
Aaron
|
|
|
|
|
You need to set the font for the created control. When you design a form using the resource editor it sets a default font for you (you can change it). This is not the standard system font which is the default for controls to draw with. You need to GetFont() from your dialog and SetFont(GetFont()) for your created control.
|
|
|
|
|
Thanks! That worked like a charm.
|
|
|
|
|
Hi all, I just want wanted to know what the best way of loading a binary file was without using MFC (I can do it using CFile and CArchive). At the moment I want to load in a file format that composes of 7 integers into 7 different variables. I'm also a bit worried about the robustness of the procedure. At the moment I have:
#include fstream
ifstream fin(FilePath, ios::binary)
if (fin)
{
fin.read(var1, sizeof(int));
fin.read(var2, sizeof(int));
etc.
}
fin.close();
but this seems remarkably inefficient as opposed to using the (arrow, arrow)operator as with MFC. Is this the best way to do this kind of thing? I know there is a function fin.eof() which tests for the end of the file, but surely I can't add that before each variable extraction? Its more used for text files and character extraction isn't it? I just need the best way of going about loading the data in this format into the seven different variables WITHOUT MFC. Thanks to all who are thinking about a solution.
Alan.
"When I left you I was but the learner, now I am the master" - Darth Vader
|
|
|
|
|
If the numbers are stored in binary format, then your code is just fine, and probably is as efficient as any MFC method. iostreams also have operators << and >> , but these are meant to handle numbers expressed in text mode. The code can be refined a little with the use of exceptions:
ifstream fin;
fin.exceptions(ifstream::eofbit|ifstream::failbit|ifstream::badbit);
try{
fin.open(FilePath, ios::binary);
fin.read(var1, sizeof(int));
fin.read(var2, sizeof(int));
...
}
catch(ifstream::failure& e){
}
fin.close();
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|