|
Here is my Resource.h:
<small>
#define IDM_ABOUTBOX 0x0010<br />
#define IDD_ABOUTBOX 100<br />
#define IDS_ABOUTBOX 101<br />
#define IDD_WINSS_DIALOG 102<br />
#define IDR_MAINFRAME 128<br />
#define IDI_POOKA_LOGO 130<br />
<br />
#define IDC_A1 1000<br />
#define IDC_A2 1001<br />
#define IDC_A3 1002<br />
#define IDC_A4 1003<br />
#define IDC_A5 1004<br />
#define IDC_A6 1005<br />
#define IDC_A7 1006<br />
#define IDC_A8 1007<br />
#define IDC_A9 1008<br />
<br />
#define IDC_B1 1010<br />
#define IDC_B2 1011<br />
#define IDC_B3 1012<br />
#define IDC_B4 1013<br />
#define IDC_B5 1014<br />
#define IDC_B6 1015<br />
#define IDC_B7 1016<br />
#define IDC_B8 1017<br />
#define IDC_B9 1018<br />
<br />
#define IDC_C1 1020<br />
#define IDC_C2 1021<br />
#define IDC_C3 1022<br />
#define IDC_C4 1023<br />
#define IDC_C5 1024<br />
#define IDC_C6 1025<br />
#define IDC_C7 1026<br />
#define IDC_C8 1027<br />
#define IDC_C9 1028<br />
<br />
#define IDC_D1 1030<br />
#define IDC_D2 1031<br />
#define IDC_D3 1032<br />
#define IDC_D4 1033<br />
#define IDC_D5 1034<br />
#define IDC_D6 1035<br />
#define IDC_D7 1036<br />
#define IDC_D8 1037<br />
#define IDC_D9 1038<br />
<br />
#define IDC_E1 1040<br />
#define IDC_E2 1041<br />
#define IDC_E3 1042<br />
#define IDC_E4 1043<br />
#define IDC_E5 1044<br />
#define IDC_E6 1045<br />
#define IDC_E7 1046<br />
#define IDC_E8 1047<br />
#define IDC_E9 1048<br />
<br />
#define IDC_F1 1050<br />
#define IDC_F2 1051<br />
#define IDC_F3 1052<br />
#define IDC_F4 1053<br />
#define IDC_F5 1054<br />
#define IDC_F6 1055<br />
#define IDC_F7 1056<br />
#define IDC_F8 1057<br />
#define IDC_F9 1058<br />
<br />
#define IDC_G1 1060<br />
#define IDC_G2 1061<br />
#define IDC_G3 1062<br />
#define IDC_G4 1063<br />
#define IDC_G5 1064<br />
#define IDC_G6 1065<br />
#define IDC_G7 1066<br />
#define IDC_G8 1067<br />
#define IDC_G9 1068<br />
<br />
#define IDC_H1 1070<br />
#define IDC_H2 1071<br />
#define IDC_H3 1072<br />
#define IDC_H4 1073<br />
#define IDC_H5 1074<br />
#define IDC_H6 1075<br />
#define IDC_H7 1076<br />
#define IDC_H8 1077<br />
#define IDC_H9 1078<br />
<br />
#define IDC_I1 1080<br />
#define IDC_I2 1081<br />
#define IDC_I3 1082<br />
#define IDC_I4 1083<br />
#define IDC_I5 1084<br />
#define IDC_I6 1085<br />
#define IDC_I7 1086<br />
#define IDC_I8 1087<br />
#define IDC_I9 1088<br />
<br />
#define IDC_ABOUT_BUTTON 2000<br />
#define IDC_CONSOLE_BUTTON 2001<br />
#define IDCLEAR 2002<br />
#define ID_CLEAR_BUTTON 2002<br />
#define IDSOLVE 2003<br />
#define ID_SOLVE_BUTTON 2003<br />
#define IDC_POOKA_BYLINE 2004<br />
#define IDC_POOKA_LOGO 2005<br />
<br />
#ifdef APSTUDIO_INVOKED<br />
#ifndef APSTUDIO_READONLY_SYMBOLS<br />
#define _APS_NEXT_RESOURCE_VALUE 134<br />
#define _APS_NEXT_COMMAND_VALUE 32771<br />
#define _APS_NEXT_CONTROL_VALUE 2000<br />
#define _APS_NEXT_SYMED_VALUE 101<br />
#endif<br />
#endif</small>
Here is the code from the ProjectNameDlg.cpp file meant to retreive the data from the 9x9 array of combo box controls:
<small> CString CSarray[9][9];<br />
<br />
int i,j;
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
int a= 6;<br />
int b= 6;<br />
<br />
for (i=0; i<9; i++) {<br />
for (j=0; j<9; j++)<br />
{<br />
DDX_Text(pDX, (1000+(10*j)+i), CSarray[i][j]);<br />
}<br />
}<br />
}<br />
<br />
</small>
I am getting a "Debug Assertion Failure! (File:dlgdata.cpp line 43 - which doesn't exist)" for the 8 combo boxes commented above. I cannot find a logical reason why these controls cause this failure when none of the others do. Is there some limitation of Visual c++ v6.0 on the number of control boxes allowed?
|
|
|
|
|
The Problem eventually solved itself. Turns out, when modifying one of the control's label and re-saving the dialog editor window, the problem just went away. Must be some feature of Visual c++ that has a copy of the information somewhere else that needs to be updated.
Very strange (and annoying) behavior. But case closed.
|
|
|
|
|
This one has left me scracthing my head. I want to define a constant array in an implementation file. I'd like to treat it as a read only table. So in my implementation file I have this:
const unsigned char Sawtooth[] =
{
};
In my header file, I have this:
extern const unsigned char Sawtooth[];
When I try to build the solution, I get an unresolved external symbol error. If I remove const from both the declaration and the definition, it compiles fine. It's as though the const modifier is making the definition private to the implementation file, like the static modifier does.
I don't remember having this problem using C. Is this a C++ or Visual Studio "gotcha" that I've not been aware of before? Or is there something else I'm overlooking?
|
|
|
|
|
It works for me on VS 2005.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote: It works for me on VS 2005.
It seems to have a problem when I assign the const array to a member variable in one of my classes. So in one of my classes, I have this:
private:
const unsigned char *wavetable;
And I have a setter method in the same class:
void Oscillator::SetWavetable(const unsigned char *wavetable)
{
assert(wavetable != 0);
this->wavetable = wavetable;
}
If I remove the assignment, the compiler error goes away. I don't understand what the problem is. I'm declaring/defining a const unsigned char array in an implementation file. I pass it to the above method and for some reason the compiler is treating it as a "unsigned char const * const", according to the compiler error message.
|
|
|
|
|
Leslie Sanford wrote: seems to have a problem when I assign the const array to a member variable
I don't see any code assigning an array to a member variable.
Your code shown built fine for me as well
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Leslie Sanford wrote: I'm declaring/defining a const unsigned char array in an implementation file. I pass it to the above method
Pass it how?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote: Pass it how?
It's passed to the setter from the constructor. So in the Sawtooth.cpp file, I have the const array defined:
const unsigned char Sawtooth[] =
{
};
In my Wavetable.h file, I have the declaration:
extern const unsigned char Sawtooth[];
In my Oscillator class, I have an const unsigned char pointer member:
class Oscillator
{
private:
const unsigned char *wavetable;
public:
void SetWavetable(const unsigned char *wavetable);
};
In my constructor I do this:
#include "Wavetable.h"
Oscillator::Oscillator()
{
SetWavetable(Sawtooth);
}
In other words, I want the wavetable member to point to the Sawtooth array when an Oscillator is created.
[EDIT]
Oscillator.obj : error LNK2019: unresolved external symbol "unsigned char const * const Sawtooth"
That's part of the error message. It's as if the compiler wants to treat my Sawtooth array as an unsigned char const * const.
[/EDIT]
|
|
|
|
|
Again, this compiles and links for me
Leslie Sanford wrote: error LNK2019: unresolved external symbol "unsigned char const * const Sawtooth"
Are you sure you are linking Sawtooth.cpp?? The problem's in linking.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote: Again, this compiles and links for me
I should have paid more attention when you said this before instead of continuing to assume there was a problem with const.
If I include the header file in the implementation file that has the const array, everything works correctly; no more linking errors:
Wavetable.h:
extern const unsigned char Sawtooth[];
Sawtooth.cpp:
#include "Wavetable.h"
const unsigned char Sawtooth[] =
{
};
I'm not sure why, but including the header file in my Sawtooth.cpp file solved the problem. I can keep the const modifier.
|
|
|
|
|
Leslie Sanford wrote: I'm not sure why, but including the header file in my Sawtooth.cpp file solved the problem.
Cool.
Here's what the docs state:
"Declaration of const variables with the extern storage class forces the variable to have
external linkage. An initialization of an extern const variable is allowed in the defining
translation unit. Initializations in translation units other than the defining translation unit
produce undefined results."
I guess the definition needs the extern declaration as well on static const variables (?)
Cheers!
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I think I've figured out the problem. Arrays are const by default. That is the array variable is const, not its contents. This is illegal:
unsigned char a[100];
unsigned char b[100];
a = b;
So declaring an array as const...
const unsigned char a[100];
...seems to be interpretted by the compiler as unsigned char const * const, whatever the heck that is. An unsigned char const pointer to const... something.
At any rate, it does not evaluate to const unsigned char *. So when I tried passing it to the setter method, the compiler seemed to have a problem with that. If I remove the const modifier on the array, it compiles and runs ok.
What I was intending was to make an arrays contents read only. I haven't figured out how to do that.
|
|
|
|
|
The probem is not the const.
const unsigned char Sawtooth[] = {0,1,2,3,4,5,6,7,8,9};
If you try ...
Sawtooth[0] = 1;
...you'll see the compiler won't let you.
Passing Sawtooth as a const unsigned char * will work as well.
The assignment shown above won't work as you've seen - you need to deep-
copy the array contents from one to the other. Note if the destination is const
you won't be able to unless you cast away the const.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Dear gurus/colleagues:
Anybody knows what Win32 API function I can use to verify if a user account is already a member of a local or domain group?
I am working on a Oracle OS Authentication project. The user account I am talking about is for example: <domain_name>\<user_name> or <machine_name>\<user_name>.
The group I am talking about is for example: ORA_SEND_ALMUSER
I want to be able to use a Win32 API function to call and pass in the GROUP NAME as well as USERNAME to see if the username is a member of the groupname?
Any help would be greatly appreciated.
|
|
|
|
|
Hi,
I am designing a series of MFC controls for inputting basic information into a DirectX Modeling program. I would like to make those controls widely available by publishing them on this (or some similar) site. This is my first time doing this, so before I put them out there for feedback and general use, I thought I'd get some input on what design patterns would be easiest or most conventional to use.
Basically I am working on a control that will allow a user to input parameters for the following basic DirectX meshes:
Polygon (2 params)
Box (3 params)
Sphere (3 params)
Cylinder (5 params)
Torus (4 params)
Text (3 params)
and it's materials (10 params, or one struct).
So as you can see this control will contain a lot of information. Should I allow the user to access this material through one giant struct or wrapper class containing all the data, or by memberwise retrieval? Should the user gain access to the data by references or by values?
Any references on MFC control design patterns appreciated.
Thanks - Jason
|
|
|
|
|
how do i open a CStdioFile for writing such that i dont loose my previous data that exists in this file??
CStdioFile file;
file.Open("Temp1.dat",CFile::mode????);
????-> i tried using modeNoTruncate, modeReadWrite , but may be thats not the solution!!
|
|
|
|
|
OK i tried using the following and it worked. If any body has a better solution then please suggest:
CString line_feed='\x00A';<br />
CStioFile file;<br />
file.Open("Temp1.dat",CFile::modeReadWrite);<br />
file.SeekToEnd();file.WriteString(line_feed);<br />
CString str="watever u want to put";<br />
file.WriteString(str);<br />
file.Close();
|
|
|
|
|
Hello,
I have setting a background image into a ListCtrl with SetBkImage() method.
But the image is showed with a scroll, like the texts in the rows.
How could I disable the scroll of the background image? I hope to put the image fixed in the background of ListCtrl.
Any idea?
Thanks,
Cris.
|
|
|
|
|
|
I am working on an application that has the ability to open files using MFC and Visual Studio .Net 2003. I need give the user the option not to continue opening the file for special cases or scenarios. The determination is based on a keyword setting in an XML tag. Using the Serialize method, I was able to modify the software to not continue loading the file. However, it loaded it anyways but not completely. Do you know how I can prevent it from loading a file completely?
|
|
|
|
|
Have your Serialize method throw a CArchiveException. This will cause CDocument to totally cleanup the partially loaded file.
AfxThrowArchiveException(CArchiveException::none);
You may be right
I may be crazy
-- Billy Joel --
Within you lies the power for good - Use it!
|
|
|
|
|
Well, i need to execute a function at the change of day(or possibly a time defined by user). I have used CWnd::SetTimer()at one place for 5 secs trigerring. How can i do it to trigger every day(or hour)...i dont think it would be advisable to plainly convert a day's value into milliseconds and pass it to SetTimer()!!! What way can i achieve this??
|
|
|
|
|
It looks like SetTimer has a maximum interval of 24.85 days (if I did the math correctly).
Hours or a day shouldn't be a problem.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Just think of how many milliseconds are lost each day, I would go for QueryPerformanceCounter but then some say the MM timers are better :p
|
|
|
|
|