|
|
Sometimes I really wonder how i search in my MSDN ... Sorry and thanks !
~RaGE();
|
|
|
|
|
Hi:
Ok guys let me narrate the prob:
i've installed a windows hook monitoring some system events ,infact i am capturing the keb-keys,arrival of each message is followed by some writing of values in a text file .the writing of this key event was done in the
KeyboardProc()
present in the dll,but this did'nt work well because obviously i had to call the next hook in the chain as soon as possible but i was doing some file processing...
the result of this was that when i typed the keyboard-keys quickly ,i found that the file has not recorded the exact sequence of the keys, rather some keys were swaped ...for example
when i typed
"my name is ahmed"
i received something like this in the file
"my anme si ......"
this behavior is seen when i type quickly
i tried an alternative using Critical section in key keboardproc but this could not work also ,perhaps we can't block the system who calls the KeyboardProc().....
/************************************************/
ok guys i've changed my approach now but still some problems are there as explained below
now i am simply Posting the character(key) received in the keyboardproc() to a thread in a seperate process and calling the next hook imidiately as shown below
... KeboardProc(.........)
{
..............................................
/*hThread is the handle of the window associated with a thread in a seperate process*/
//imediately return after posting unlike SendMessage()
PostMessage(hThread,...,...,..);
return CallNextHook(..);
}
/***********************************************/
Message loop in the thread that is receiving messages from hook
while( GetMessage( &msg, NULL, 0, 0 ))
{
1: TranslateMessage(&msg);
2: AfxMessageBox(" key notification ");
//DispatchMessage(&msg);
}
My target is that the next key in the message que is not extracted from the que untill the previous has been processed..
Problem:
the problem here is that when i press a key i get an AfxMessageBox() as desired in the message loop , now when i press the second key without dismissing the "AfxMessageBox" that was showed for the first key,a new "AfxMessageBox" box appears and this keeps happening as long as i keep pressing keys so message window keep on increasing why is this happening.....?
Because the rule says if do not dimiss a messagebox the control should not go to the next statement.. so why the next message is processes while the previous message is still not completely processed
1: while( GetMessage( &msg, NULL, 0, 0 ))
{
2 TranslateMessage(&msg);
3 AfxMessageBox(" key notification ");
//DispatchMessage(&msg);
}
why the control goes to line 1 althogh the function on line 2 has not returned?..........................i dont want this to happen i used critical sections in the thread also but to no avail.........
ahmed
|
|
|
|
|
Hi all,
I've got some files from our source control system, these are .c, .h, .Mak, and a MAKEFILE, and they compile to make a program.
My problem is I'd like to put them into a workspace and project, but am stuck on how to do this. Do I create the workspace then create a blank win32 console project, add the files in, and compile that way? I did this, but I get errors (I know the code works) concerning near and far keywords in the files, so I think I need to build according to the MAKEFILE but am unsure as to how to tell visual c++ to do this.
Any thoughts? I hope this is clear enough!
Obseve everything, remember more...
|
|
|
|
|
From the File menu, select Open Workspace. Look for files of type *.mak.
|
|
|
|
|
|
You could extract the highest significant bit of your integer, then just shift it left. But I'm not too sure how faster it would really be than using the well known log() and pow() fonctions.
|
|
|
|
|
Try :
unsigned long RoundUpPow2( unsigned long x )
{
x = x - 1;
x = x | (x >> 1);
x = x | (x >> 2);
x = x | (x >> 4);
x = x | (x >> 8);
x = x | (x >>16);
return( x + 1 );
}
for x >= 2
...cmk
|
|
|
|
|
Can any one tell me that what is the meaning of real data type. I've seen and heard this term "real data type" many times specially in COM where certain constructs are common like RT_8, RT_16 e.t.c.
So what is a real data type? Is it a signed data type or not. What is it ?
|
|
|
|
|
The data types that are supported by the system/language directly are called as real DT. Like in C/C++ 'int' and 'float' etc are real data types (i.e directly supported by compiler/system). on the other hand there are adstract or user defined data types such as structures/classes.
I hope this explains ur query...
___________________________
"Think big, think fast, think ahead. Ideas are no one's monopoly"
|
|
|
|
|
Data types commonly referred to as real are basically the language's way of saying it is a floating point number.
I think the term real comes from the mathematical classification of numbers:
- Natural Numbers: 1,2,3,4,..
- Whole Numbers: 0,1,2,3,4..
- Integers: -2,-1,0,1,2,3,..
- Real: 3.4, 1.0, 2.0, -5.664, 3.142
- Complex Numbers: 5+3i
So the real data type can be used to represents numbers that can be whole (3,5,6) or a fraction of a number (2.1, 5.6, 1.333..).
In C++, real data type can be defined as a float, or a double variable. Double uses a higher level of precision than a float value.
COM Objects represents real values using the VARIANT type of
VT_R4 (float) or VT_R8 (double). VT_R4, RT_4 and float are just language specific ways of representing the same number, just expressed differently.
I'm sure there are more detailed explaination on data types on this topic, but I just wanted to give a general view, without going into to much details and specifics. Maywell be that Its not as accurate, but you should get the idea.
"..Even my comments have bugs!"
Inspired by Toni78
|
|
|
|
|
RChin wrote:
I think the term real comes from the mathematical classification of numbers:
It's an actual data type in Pascal (and related languages).
|
|
|
|
|
Hi,
I am trying to read thru a .txt file using ODBC.but when i create a CRecordset derived class using Class Wizard specifying the DSN and filename in usual way,Only 1 field value is reflected in my CRecordset derived class , mean In the text file there are 6 columns namely A,B,C,D,E,F.But I am getting only 1 member variable m_A in my specialized recordset class,all other fields are not mapped.
Please help.
|
|
|
|
|
What does your .TXT file look like?
In your CRecordset-derived class' header file, there should be a Field/Param Data section with a member variable for each "column" in your .TXT file. In the DoFieldExchange() method of this class, there should be a RFX_xxx mapping statement for each of these member variables.
|
|
|
|
|
Did you map/define the 6 fields in your ODBC DSN setup? You need to do this to access the fields in a text file correctly (including field delimiter, Field name, logical data type, etc...).
|
|
|
|
|
Arghhhhh! Shouldn't this work????
------------------------------------
POINT pt;
<later...>
case WM_MOUSEMOVE:
pt.x = GET_X_LPARAM(lParam);
pt.y = GET_Y_LPARAM(lParam);
<etc...>
------------------------------------
I keep getting the error in the subject! I don't know what's wrong!
-untwisted
www.uber-ware.com
brian@uber-ware.com
|
|
|
|
|
Did you remember to include:
#define GET_X_LPARAM(lp) ((int)(short)LOWORD(lp))
#define GET_Y_LPARAM(lp) ((int)(short)HIWORD(lp))
in your file?
|
|
|
|
|
Isn't that already defined for me though?
Edit: I definded it, and now it's working! Thanks!
-untwisted
www.uber-ware.com
brian@uber-ware.com
|
|
|
|
|
#include <windowsx.h> usually does the trick, but I got used to
#ifndef GET_X_LPARAM
#define GET_X_LPARAM(lParam) ((int)(short)LOWORD(lParam))
#endif
#ifndef GET_Y_LPARAM
#define GET_Y_LPARAM(lParam) ((int)(short)HIWORD(lParam))
#endif
(WTL does the same, btw.)
"Der Geist des Kriegers ist erwacht / Ich hab die Macht" StS
sighist | Agile Programming | doxygen
|
|
|
|
|
peterchen wrote:
#include usually does the trick, but I got used to
He meant #include <window.h>.
Hey Peterchen, after all this time, I cannot believe you've fallen in the so-known < > trap
~RaGE();
|
|
|
|
|
|
It goes like this:
When I finished changing items in a ListCtrl I wanna make all the columns the actually width like I just double clicked the header-divider. But I don't know exaclty how to put codes in my program.
Anyone please help me figure it out or give me some tips.
Thanks very much! ^_^
|
|
|
|
|
CListCtrl *pLC = (CListCtrl *)GetDlgItem(IDC_MYLVCTRL);
pLC->SetColumnWidth(0,LVSCW_AUTOSIZE);
|
|
|
|
|
|
(first sorry if the topic doesnt fit to this board but i didnt find a better place)
Well,
Id like to have a class and derivate several classes from it. Then id like to have a container that could contain object from any of the derivated classes. Example:
class A {public: int a; virtual void print() {printf("a\n");}; };
class B:public A {public: void print() {printf("b\n");}; };
class C:public A {public: int b;};
int main(int argc, char* argv[])
{
A a; B b; C c;
vector <A> X;
X.push_back(a);X.push_back(b);X.push_back(c);
for (int i=0;i<x.size();i++) X[i].show();
// HERE I WANT TO CALL THE RIGHT print METHOD
return 0;
}
It might be basic but its been a long time im wondering how to do that,
any help would be greatly appreciated....
Remy
|
|
|
|