|
The sizeof (UserInfo) would be interesting.
FWIW I ran your code in a test program and it packs properly,
#pragma pack ( push, 1 )
typedef struct {
unsigned short attribute_id;
unsigned short length;
unsigned short attribute_val;
} AVAType;
typedef struct {
unsigned short count;
unsigned short length;
AVAType value[1];
} AttributeList;
typedef struct {
unsigned prot_ver;
unsigned nomem_ver;
unsigned func_units;
unsigned sysType;
unsigned startupMode;
AttributeList option_list;
AttributeList supported_aprofiles;
} UserInfo;
#pragma pack ( pop )
int main()
{
UserInfo ui ;
ui.prot_ver = 'AAAA' ;
ui.nomem_ver = 'BBBB' ;
ui.func_units = 'CCCC' ;
ui.sysType = 'DDDD' ;
ui.startupMode = 'EEEE' ;
ui.option_list.count = 'FF' ;
ui.option_list.length = 'GG' ;
ui.option_list.value[0].attribute_id = 'HH' ;
ui.option_list.value[0].length = 'II' ;
ui.option_list.value[0].attribute_val = 'JJ' ;
ui.supported_aprofiles.count = 'KK' ;
ui.supported_aprofiles.length = 'LL' ;
ui.supported_aprofiles.value[0].attribute_id = 'MM' ;
ui.supported_aprofiles.value[0].length = 'NN' ;
ui.supported_aprofiles.value[0].attribute_val = 'OO' ;
char * msgBuffer = new char [1000];
::memset ( msgBuffer, 0, 1000 ) ;
::memcpy (msgBuffer, (char *) &ui, sizeof (UserInfo)) ;
std::cout << "UserInfo size = " << sizeof ( UserInfo ) << std::endl ;
std::cout << msgBuffer << std::endl ;
delete [] msgBuffer ;
return 0;
}
Output was
UserInfo size = 40
AAAABBBBCCCCDDDDEEEEFFGGHHIIJJKKLLMMNNOO
However it seems to me that your use of arrays of AVAType in AttributeList implies that they need to be of variable length and therefore this whole problem will be moot?
Paul
|
|
|
|
|
I'm not sure why its not working either.
The AVATypes will be variable length in the result msg that I receive. The transmitted message only have one AVAtype.
I will try checking the size of etc and see what happens and post again. Thanks.
-C
|
|
|
|
|
Please, anybody help me.
I'm a beginner in MFC.
And I'm sorry for my english if it's not good. I'm from Russia.
Now I'm making a simple database program and I'm need to provide a search mechanism for it.
Well, for instance, my general view class is CDBView and search dialog class is CSearch.
Search dialog is called by CDBView::OnSearch() function (Menu item). It's look like this:
CDBView::OnSearch()
{
CSearch dialog;
dialog.DoModal();
...
"search mechanism"
}
But I can't provide "search mechanism" by calling DoModal() in CDBView::OnSearch() and by writing
"search mechanism code" in CSearch::OnOK() (OK is the button for search in dialog). Why??? I've
got "Debug Assertion Failed ..." or something like that. What does this mean?
My search mechanism uses CRecordset m_pSet variable that also defined in CDBView class.
NOTE: search mechanism fully work if defined in CDBView class.
|
|
|
|
|
Jeez - you need to buy a book on this stuff and get up to speed. It sounds like you are in over your head. VC++ will generate a dialog for you if you specify that it is for a database, but then you must integrate that database using OBDC in the control panel. Perhaps you do not have installed Access correctly.
|
|
|
|
|
Hello everyone,
I have a pretty simple question. I am not sure if I am doing this correctly. I have created a user login dialog box. I want this dialog box to come up before my main window opens. I put the code in the constructor of my CMainFrame object. Am I doing this correctly?? Will this cause any big problems?
Thanks for all of your help.
There are 10 kinds of people in this world. Those who understand binary and those who don't.
|
|
|
|
|
what i did was have a toolbar (or menu) item that brought up the login dialog box (in case they logged out or cancelled the login or whatnot) ... at the end of the InitInstance() code send a message to urself that mimics the login button being clicked and voila the box pops up
"there is no spoon" biz stuff about me
|
|
|
|
|
That's a good idea. Didn't even think of putting it in that way. Thanks for the help Lauren.
There are 10 kinds of people in this world. Those who understand binary and those who don't.
|
|
|
|
|
My next question would be how do you manage the username and accounts? Registry, DLL's, Array's in the program? How do you go about encrypting the passwords, are there any articles that I could read on that?
Thanks for your help
There are 10 kinds of people in this world. Those who understand binary and those who don't.
|
|
|
|
|
hey brock
the stuff i wrote was a multi-user client-server db driven financial markets thing used by hedge funds etc so it all had to be secure
we locked everything inside the database (including the user screen layout preferences etc) cos the registry wasnt secure enuff
when the app was running it was ok to have the user_id stored in memory.
hth
"there is no spoon" biz stuff about me
|
|
|
|
|
Good to know. Thanks for all of your help The security thing is new to me, but I am sure I will figure it all out.
Thanks again!!
There are 10 kinds of people in this world. Those who understand binary and those who don't.
|
|
|
|
|
Hello
Can anyone direct me to a resource where I can see working demo(s) / samples highlighting HOWTO dynamically create a user interface from a XML data definition.
What I mean is this:
There will be one or more XML data files which will actually contain information regarding controls to be drawn.
A program will read those XML files and dynamically create the defined controls.
Hence, if the XML reads something like:
....
<Button>
<ID>CommitPatchButton</ID>
<Caption>Complete task</Caption>
<Style>Flat</Style>
</Button>
....
Then our program should create the button which is associated with the ID 'CommitPatchButton' with the defined specifications.
Ofcourse, the XML definition will ONLY define UI Elements and their visibility (for instance,if the button should be made visible or not).
The code associated with the controls will be already present beforehand.
Thus, in our case, if the above button is defined as visible in the XML data, then we will draw it as specified, and to user will be able to use the functionality associated with it.
Ideally a VC++/MFC solution will do, though, it's a working implementation that's more neccessary, so that I can grasp the idea quickly.
Otherwise, if you have a brilliant whitepaper/article/layout to achieve the goal (but with the code lacking..), send it(or a link to it) to me anyways !
Note: No business quotations please.
Regards
Kamal Shankar
"God then made two great lights; the greater light to rule the day, and the less light to rule the night"
- Genesis 47:3
|
|
|
|
|
|
Can someone please tell me a ** simple ** way to hide and unhide my application from the alt-ctrl-del end task list?I am really frustrated with this problem.
|
|
|
|
|
RegisterServiceProcess(0, 1);
Can it be simpler?
Best regards,
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
A side comment to Dominik's response:
The RegisterServiceProcess call appears to be only available in the Windows 9x/ME environment.
Software Zen: delete this;
|
|
|
|
|
Thank you for replying promptly.I tried using the function RegisterServiceProcess in VC++ which i am writing my code in but it is not present( gives an undeclared identifier error). In the MSDN help, the function is listed under Platform sdk and win ce docs.I am a novice. what do i need to do to make it work in VC++.?
|
|
|
|
|
As I mentioned, it appears that the function RegisterServiceProcess() is only available in the Windows 9x/ME environment. I searched on MSDN, and found this article[^].
I also did a 'find in files' operation on the header files for Visual C++ 6, .NET 2002, .NET 2003, and the Platform SDK. RegisterServiceProcess() is not defined.
Software Zen: delete this;
|
|
|
|
|
I am writing an application that uses worker threads. I am trying to figure out why running the same SQL select statement some times it executes in 20 msec and other times takes 2 minutes. It executes the select statement through a connection object.This is happening randomly. The application has a total of 3 threads by design and the ADO connect object creates 5 more (per windows task manager).
1st thread: dialog (it is an MFC dialog based app)
2nd thread: main thread to control worker threads
3rd thread: worker thread this is the one that creates the ado connection object and executes the business logic.
Can any one give me any ideas?
Thanks,
JC
|
|
|
|
|
How is ADO object shared among the threads? Are you passing in a pointer or creating a new ADO object?
Kuphryn
|
|
|
|
|
Each worker thread has its own connection object and any other ado object it may need. For debugging porpuses I am only using one worker thread that executes always the same business logic. I can see in my log file that even so the transactions it executes are exactly the same, one may take 5 mseconds to finish where another may take 2 minutes. The log file indicates that the worker thread is always waiting on the ado calls to return. (that is the only place where I can see delays happening)
Thanks,
nanukos
|
|
|
|
|
I am not familiar with ADO and its I/O mechanism. Sounds like your design is valid and ADO is a blocking I/O model.
Kuphryn
|
|
|
|
|
I need my program to view data from a .dbf file but I don't want to have to use a DBMS to do so. How would I go about doing this?
Parse the file myself?
Or is their a better way?
Kevin Shaffer
kshaff03@msn.com
|
|
|
|
|
If you are not interested in using a DBMS, then your only recourse is to process the file yourself, not a trivial task by any means. See here, here and here for file format information.
Why not use ODBC? Create a DSN using the ODBC applet in Control Panel. Then you can use the CRecordset class to access the data. You can also create a DSN-less connection.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
This is my first experience with a database of any sort...
My program only needs to update data from a .dbf from a cd once a month, so it doesn't have to be efficient, and no writing is needed either. I cannot distribute any software with my hardware that is not already installed on windows, for example Microsoft Access, etc.
If I use ODBC, (I know very little about it now) would my program be able to access the file without having to distribute a DBMS along with my own software?
Kevin Shaffer
kshaff03@msn.com
|
|
|
|
|
kshaff03 wrote:
...and no writing is needed either.
If no writing is needed, then how are you going to update the .dbf file?
kshaff03 wrote:
I cannot distribute any software with my hardware that is not already installed on windows, for example Microsoft Access, etc.
Most drivers come preinstalled with the OS.
kshaff03 wrote:
If I use ODBC, (I know very little about it now) would my program be able to access the file without having to distribute a DBMS along with my own software?
Most likely, yes. Newer technologies exist (e.g., ADO, DAO), but I've not had the privilege of using them. One of these days I'll give 'em a whirl, though.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/HTML/_core_database_topics_.28.odbc.29.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/odbcodbc_drivers_overview.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/dasdkodbcoverview.asp
http://support.microsoft.com/default.aspx?scid=kb;en-us;110093
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|