|
Is the IsDialogMessage[^] function in your message pump? If not it will not work as you expect as it's the function which contains all the dialog box navigation magic.
Steve
|
|
|
|
|
So you're saying I just need to add IsDialogMessage() to my GetMessage() loop? Would I switch the message on the spot, or would I switch it in the WindowProc?
Thank you so far for you help.
|
|
|
|
|
The message pump would have to look something like this:
MSG m;
while (GetMessage(&m, NULL, 0, 0))
{
if (!IsDialogMessage(hDialog, &m))
{
TranslateMessage(&m);
DispatchMessage(&m);
}
}
Note that things just work for modal dialogs as they implement their own message pumps which do the right thing. For modeless dialog and other windows you have to do it yourself.
Steve
|
|
|
|
|
Okay, that helps out. Thank you very much Steve.
|
|
|
|
|
Hi,
is there any possible to having an communication between client side ( ASP .Net or others), server side is C++,MFC on the internet using SOCKET programing...
if it is possible means please tell me how they communicating...?
thanks in advance....
|
|
|
|
|
You said you wanted to communicate over the Internet with sockets (and previously worked with MFC and Win32).
Do you have a specific question or are you looking for tutorials?
/M
|
|
|
|
|
I am trying to build a VC++ POCKET PC 2003(ARMV4) application in visual studio 2005,It compile successfully but i am getting runtime error
C:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\PocketPC2003\include\winnt.h(648) : fatal error C1189: #error : Must define a target architecture.
Thanks in advance.
|
|
|
|
|
|
See the "blue" suggestion posted by gexaman here.
"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
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
In a template project I am working on I have basic matrix product fine.
so given I have that working, I was looking at how to deal with matrix and vector product correctly as my books lack the algorithm I need.
vector operator*(const matrix that) {
vector result;
for (int i = 0; i < that.data.size{}; i++)
for (int j = 0; j < that.data[].size(); j++)
....
return vector;
}
I am not sure how this loop needs to work
|
|
|
|
|
Here, this[^] link should help.
|
|
|
|
|
I just need some code, now I am dealing with another problem, overloading []
http://www.contract-developer.tk
|
|
|
|
|
vector[i] += that[i][j] * (*this)[j];
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I want to disable some shortcuts in CRichEdit control. Using PreTranslateMsg it is done but how to block some shortcut events ??
For example Left align , right align.
Thanks in advance.
Yes U Can ...If U Can ,Dream it , U can do it ...ICAN
|
|
|
|
|
Have you tried adding handlers for those events and doing nothing there?
Workout progress:
Current arm size: 14.4in
Desired arm size: 18in
Next Target: 15.4in by Dec 2010
Current training method: HIT
|
|
|
|
|
Hi,
I'd like write a function doing sth like that.
if(a == 5)
val = val | 1000
if( b == 20)
val= val | 100
in the end if i have the both condictions corrects i'd like to have 1100 as result on val. but i always do 1000.
which operator should i use to have the 1100 as resut.
"The Ultimate Limit Is Only Your Imagination."
|
|
|
|
|
why are you using bitwise OR, if what you really want is addition ?
|
|
|
|
|
Being slightly cynical addition sounds like the operator you neeed... With your statements val is going to end up containing 1004 as there's a large overlap in the bits set between the bit pattern for 1000 (1111101000b) and the bit pattern for 100 (1100100b).
If you're trying to fiddle individual bits (i.e. turn bits with OR 1, turn them off with AND 0) then perhaps encode your numbers as powers of two and/or use hex:
if( a == 5 )
val |= 0x1000;
if( b == 20 )
val |= 0x100;
Cheers,
Ash
PS: Another way of setting and resetting individual bits is to use bit fields. Perhaps they might be more in tune with what you want?
|
|
|
|
|
int blo=0;
for(int i=0; i< New.GetLength(); i++ )
{
if(isalpha(New.GetAt(i)))
{
blo |=0x1000;
if(isupper(New.GetAt(i)))
blo |= 0x100;
else
blo |=0x10;
}
}
if i try it with Blood what will give me is 4352 or what i need is 1100 (1000 for being an alpha and 100 for being uppercase¨.
"The Ultimate Limit Is Only Your Imagination."
|
|
|
|
|
Blood_HaZaRd wrote: if i try it with Blood what will give me is 4352 or what i need is 1100...
You are confusing base-10 with base-16.
"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
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
So are you trying to get a count of the number of alpha characters, the number of uppercase and the number of lowercase and encode them into a set of decimal digits?
|
|
|
|
|
i dont need to count them but what i need is
if the user typed all uppercases the res will be 1000. if he typed only locases it ll be 100 if he typed both it will 1100.
i need sth like this coz i have more checking to do for numbers, dots. so let's say if he typed one upper, 5 low, 3 digits and zero dot the result ll be 1101
"The Ultimate Limit Is Only Your Imagination."
|
|
|
|
|
const DWORD TypeUpper = 0x00001000;
const DWORD TypeLower = 0x00000100;
const DWORD TypeDot = 0x00000001;
...
DWORD characterTypes = 0;
loop
{
if (isupper(...))
characterTypes |= TypeUpper;
else if (isdot(...))
characterTypes |= TypeDot;
else if (...)
...
}
if (characterTypes == TypeUpper)
cout << "contains only uppercase letters\n";
else if (characterTypes & TypeUpper)
cout << "contains at least one uppercase letter\n";
if (characterTypes == TypeLower)
cout << "contains only lowercase letters\n";
else if (characterTypes & TypeLower)
cout << "contains at least one lowercase letter\n";
...
cout.flush();
|
|
|
|
|
In that case I'd use a union of bit fields and an integer. Then you can set bits to your hearts content and read it as a number, something like:
union
{
struct
{
unsigned has_upper_case_ : 1;
unsigned has_lower_case_ : 1;
unsigned has_a_digit_ : 1;
unsigned has_dot_ : 1;
} bits_;
unsigned as_number_;
}
text_flags;
Then you can use it like:
text_flags.as_number_ = 0;
text_flags.bits_.has_a_digit_ = 1;
std::cout << text_flags.as_number_ << std::endl;
That'll print 2 on any compiler that arranges the bit fields from lowest significance to highest. I can't remember if the standard says anything about the ordering of bits - it's not the sort of thing I play with that often - so check that the ordering is what you'd expect.
IF you do use something like this you can add a constructor and members to your union. That might be an idea to save fannying about remembering to zero the thing and you could have set and reset methods.
Cheers,
Ash
PS: There's a good description of bit fields in "The C++ Programming Language" 3rd edition if you get stuck and want help from the great man himself. I think he uses the page tables of a RISC processor as somewhere you could use bit fields like this.
PPS: Corrected a typo in the code, bits in the declaration of the union didn't have the trailing underscore I gave it in use.
modified on Thursday, June 10, 2010 4:02 AM
|
|
|
|
|
Thank you soo much the first one runs great the secondm francly i didn't undestand it so i ll try it later anyway thank you again for your great help
"The Ultimate Limit Is Only Your Imagination."
|
|
|
|