|
Why don't you continue reading MSDN ?
#pragma pack documentation[^] states:
Valid values are 1, 2, 4, 8, and 16.
Hence 0 is 'not valid' (I wouldn't try to make assumptions on a value marked as such).
Veni, vidi, vici.
|
|
|
|
|
Just after read MSDN, I found that the case n=0 is ignored. I do not know why.
|
|
|
|
|
Simply because it's not explicitly handled.
Without giving the directive a special meaning for n=0, it makes perfect sense - it keeps the use of the directive consistent.
|
|
|
|
|
yu-jian wrote: But if n is zero, what will do?
Add /WX to your compiler settings and recompile. You should pay more attention to compiler warnings.
Best Wishes,
-David Delaune
|
|
|
|
|
There is a error that Visual Studio 2008 only supports 1, 2, 4, 8... After add /WX to compiter.
|
|
|
|
|
See the documentation[^], which clearly states that the only valid values for n are 1, 2, 4, 8 and 16. Thus using 0 is an invalid #pragma and will be ignored: the default packing (8) will be used.
Binding 100,000 items to a list box can be just silly regardless of what pattern you are following. Jeremy Likness
|
|
|
|
|
Thank you for everyone's replies.
|
|
|
|
|
According to the C++ standard it can do whatever it likes. It's a way of implementors switching on non-standard features of the compiler. I think Griff and the others have told you enough about what it does on VC++ though!
Cheers,
Ash
PS: Except this is the one thread Griff hasn't posted in. Let's try "Chris and the others..." instead!
|
|
|
|
|
I want to click a button, load the dialog with progress bar, run a validator in a new thread, and then close the dialog.
So I used the toolbars WndProc to load DialogBox( sdfsdfsdf
Then in the Dialog Proc, WM_INITDIALOG, created the dialog controls, the dialog box is at top level, and fully painted, the dialog proc exits.
Is there a message sent after the dialog box intializes and loads, that I can capture so I can send the next message to run the validator?
I tried adding the SendMessage to the end of the WM_INITDIALOG, but the box won't show until the validator exits. Bad Idea.
switch (message) {
case WM_INITDIALOG:
{
_project_SQLExplorer_Dialog_hWnd = hWndDlg;
_project_SQLExplorer_Dialog_Validate_CreateControls( hWndDlg );
return (INT_PTR)FALSE;
}
case WM_ENTERIDLE:
SendMessage( hWndProject_SQLExplorer, WM_COMMAND, (WPARAM) IDM_SQL_EXPLORER_VALIDATE_START, (LPARAM) 0 );
break;
case WM_COMMAND:
switch LOWORD(wParam) {
case IDCANCEL:
EndDialog(hWndDlg, LOWORD(wParam));
return (INT_PTR)TRUE;
}
break;
case WM_PAINT:
_project_SQLExplorer_Dialog_Validate_Paint( hWndDlg );
break;
case WM_CLOSE:
EndDialog( hWndDlg, 0 );
break;
}
|
|
|
|
|
Well so far, I have learned that I have to let the Dialog Proc exit in order for the Dialog box to show.
So I edited my Create Thread Function to just create the thread and let it fly through, without waiting for any exit codes or messages, and then the thread takes over to update the Dialog Box, and closes the dialog box with another message.
It works, and looks clean, if there's a better way let me know.
|
|
|
|
|
Hi,
I have one text file which stores the hex values in different lines(APDU.txt).
Eg; 02 01 00 BE 10 04 0E 08 00 06
10 00 2B 61 29 A1 09 06 07
And I need to process this line by line.
Here is a sample code that m used so far;
FILE *myFile = fopen("D:\\APDU.txt", "rb");
BYTE *buffer,*buffer1;
int lengthFile=0;
char temp[3];
if(myFile!=NULL)
{
fseek(myFile,0,SEEK_END);
lengthFile=ftell(myFile);
fseek(myFile,0,SEEK_SET);
buffer=new BYTE[lengthFile+1];
memset(buffer,0,lengthFile+1);
fread(buffer,sizeof(BYTE),lengthFile,myFile);
fclose(myFile);
}
buffer1=new BYTE[lengthFile/2];
memset(buffer1,0,lengthFile/2);
memset(temp,0,sizeof(temp));
for(int i=0,j=0;i
|
|
|
|
|
Do you have some sort of a question?
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
|
|
|
|
|
are you giving us the code .....
or you forgot the question
|
|
|
|
|
|
or liquid nitrogen
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
42.
Veni, vidi, vici.
|
|
|
|
|
Member 8747425 wrote: memset(buffer,0,lengthFile+1);
Since buffer has not been properly initialized, what are you expecting this to do?
Member 8747425 wrote: for(int i=0,j=0;i
Did you fail to notice your incomplete for() loop?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Hi all,
How can i move my output screen from Primary monitor to Secondary monitor.
Thanks
Sharan
|
|
|
|
|
here[^] there is an example to ensure coming back to primary monitor and don't lose the program in the secondary one (thing that you are going to need anyways). I think you can adapt those functions for your requirements
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
I'm developing an app that needs to shut off the monitor after a given time, much like a screensaver.
I've done some googling but cannot seem to find anything that works or is relevant.
My example function:
void CMyAppDlg::OnTimer(UINT nIDEvent) {
//Turn off monitor / standby - (depends on monitor)
//my lcd only goes to "sleep".
SendMessage(WM_SYSCOMMAND, SC_MONITORPOWER, 2); //<- this works, but is aborted ad soon as user move mouse or keys...
//Here is where I need to "freeze" mouse and keybrd.
//for 5 sec. or so, to prevent user from activating / wake up the
//monitor again aborting the shutoff-command, so they realize it's shut
//off.
CDialog::OnTimer(nIDEvent);
}
Thanx!
(VC++ 6.0 MFC, Win-XP)
|
|
|
|
|
#include<WINABLE.H> // For Visual Studio 6.0
:
BlockInput( true );
Sleep( 5000 );
BlockInput( false );
Is this of any use for you??Please include the proper header
|
|
|
|
|
Thanks BlockInput() was what I was looking for.
|
|
|
|
|
I need to implement a class like a CMyResultSet class.
The client code which call CMyResultSet would look like this:
CMyResultSet res;
GetResultSet(res);
for (int i = 0; i < res.rows(); ++i)
{
string res1 = res[i][0].tostring();
}
I have no idea how to implement [][] to let the client code calling like that. How would the method's prototype look like? And How can I save the searched result set in two dimension array, using std::vector or what?
Thanks in advance!
|
|
|
|
|
|
I have tried it in this way:
#include <iostream>
#include <vector>
#include <string>
using namespace std;
class CMyResultSet
{
public:
CMyResultSet(){}
~CMyResultSet(){}
string GetResult(unsigned int i, unsigned int j)
{
return m_Data[i][j];
}
void SetResult(string Result, unsigned int i)
{
if( i >= m_Data.size())
{
vector<string> vec;
vec.push_back(Result);
m_Data.push_back(vec);
}
else
{
m_Data[i].push_back(Result);
}
}
private:
vector< vector<string> > m_Data;
};
void main()
{
CMyResultSet objResultSet;
objResultSet.SetResult("00",0);
objResultSet.SetResult("01",0);
objResultSet.SetResult("10",1);
objResultSet.SetResult("11",1);
objResultSet.SetResult("20",2);
cout<<"Value at 00:"<<objResultSet.GetResult(0,0)<<endl;
cout<<"Value at 01:"<<objResultSet.GetResult(0,1)<<endl;
cout<<"Value at 10:"<<objResultSet.GetResult(1,0)<<endl;
cout<<"Value at 11:"<<objResultSet.GetResult(1,1)<<endl;
cout<<"Value at 20:"<<objResultSet.GetResult(2,0)<<endl;
}
|
|
|
|
|