|
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;
}
|
|
|
|
|
Access it via a pointer pointer.
==============================
Nothing to say.
|
|
|
|
|
Does the problem you're working on particularly need 2 dimensional addressing like that? Quite often you'll find that in a table each column has different semantics and each row represents another entity with the same type of attributes as the one immediately above and below.
So instead of using a vector of vectors or (shudder) a raw 2D array look to see if what you've is actually a simple, 1D, array of structures. You'll find that's particularly true if you're using a database.
e.g. if instead of having:
string table[5][1024];
you might find something like this represents what your app is up to a bit more.
struct thingy
{
std::string name_;
std::string favourite_blanchmange_manufacturer_;
std::string why_they_want_world_peace_;
std::string smurf_theyd_most_like_to_stangle_;
std::string this_will_never_be_used_youll_just_have_to_initialise_it_forever_;
};
thingy thingies[ 1024 ];
If you still need a 2D array come back and I'll try and add something else in here about it (but it won't be for a while).
Cheers,
Ash
|
|
|
|
|
I have changed the properties of the existing regular button to owner-drawn. changed the button variable to custom type that's derived from CButton.
In my custom type class I am handling DrawItem.
But now this button stays flat and I cannot press it. While I debug I notice that I do get the DrawItem notification but when I click on the button, I am not able to draw the sunk button. Also, I cannot execute the on-btn-click event.
What am I missing?
|
|
|
|
|
you should write the class detail.
|
|
|
|
|
on-btn-click event is not an event.
It is a handler for WM_COMMAND message and BN_CLICKED notification code receives as message parameter.
Are you by any chance handling WM_LBUTTONDOWN or WM_LBUTTONUP? If yes, do you call base class handler?
You should perform all custom drawing in DrawItem function. Is it a case?
JohnCz
|
|
|
|
|
Hi,
I was just wondering is there a way to open up a solution file created on newer version of Visual Studio with a older version e.g solution created under VS 2008 and I am using VS 2005
Thankx
|
|
|
|