View Full Version : C++ Questions
Any ideas why I get a trigger on WM_SIZE but not WM_MOVE?
This
MESSAGE_HANDLER(WM_SIZE, Realign)calls
LRESULT CArcadeOxControl::Realign(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
if (m_Embed != 0) {
ToggleEmbed();
ToggleEmbed();
}
return 0;
}
When ever the window is resized.
This
MESSAGE_HANDLER(WM_MOVE, Realign)should call the same function whenever the window is moved but does not. Why?
Incubator
07-24-2012, 06:50 AM
Any ideas why I get a trigger on WM_SIZE but not WM_MOVE?
This
MESSAGE_HANDLER(WM_SIZE, Realign)calls
LRESULT CArcadeOxControl::Realign(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
if (m_Embed != 0) {
ToggleEmbed();
ToggleEmbed();
}
return 0;
}
When ever the window is resized.
This
MESSAGE_HANDLER(WM_MOVE, Realign)should call the same function whenever the window is moved but does not. Why?
That source is a little small for debugging, because it all seems fine to me...
Are you sure the program gets to that line?
or maybe there's something wrong with the WM_MOVE constant...
WM_MOVE message hook broken on IE8 (http://social.msdn.microsoft.com/Forums/en/ieextensiondevelopment/thread/ed4182b8-2d01-4298-917f-c3d84ea4e91f)
Windows UAC breaks WM_MOVE for security reasons. Not sure what kind of security risk it provides but I only have access to the coordinates of the tab in relation to the window. Since it is the Window that is moving the tab never fires the WM_MOVE.
I will try it in JavaScript.
Or does anyone have a suggestion of another way to access window move?
---------- Post added at 10:19 AM ---------- Previous post was at 10:13 AM ----------
Could someone convert this short PHP script to c++ please.
Code Examples -> PHP Function to Encrypt/Decrypt a string without a known key. The string itself has his own different key for every character. (http://www.weberdev.com/get_example.php3?ExampleID=4118)
---------- Post added at 11:05 AM ---------- Previous post was at 10:19 AM ----------
JavaScript onmove doesn't work in IE either. As far as I can tell the only way to detect if the window moves is to check the X,Y cords every X milliseconds which would be too slow.
I'm going to give up and accept this bug but if anyone has a solution let me know.
What I am trying to do.
AOX can embed the game window in the web page.
In some cases the game window will not move when the web page moves. So moving, resizing or scrolling will cause the game to be in the wrong place.
My solution. Unembed the game window and then re-embed it. This will put it in the correct place and it happens fast enough that the user can not detect anything changed.
This works perfectly if you just resize the window.
If you move the window nothing happens because onmove and wm_move are not available in IE.
Scrolling the window triggers WM_SIZE hundreds of times causing my embed toggle to flicker. Very annoying and obvious to the user.
So I need something that is fired only on resize and on finish scrolling but not on currently scrolling and hopefully on move. Ideas?
Incubator
07-24-2012, 12:17 PM
i tried to convert your code
string ENCRYPT_DECRYPT(string Str_Message) {
int Len_Str_Message = strlen(Str_Message);
string Str_Encrypted_Message = "";
for(int Position = 0; Position < Len_Str_Message; Position++){
// long code of the function to explain the algoritm
//this function can be tailored by the programmer modifyng the formula
//to calculate the key to use for every character in the string.
int Key_To_Use = ((Len_Str_Message + Position)+1); // (+5 or *3 or ^2)
//after that we need a module division because can“t be greater than 255
Key_To_Use = (255 + Key_To_Use) % 255;
char Byte_To_Be_Encrypted = Str_Message.substr(Position, 1);
int Ascii_Num_Byte_To_Encrypt = (int)Byte_To_Be_Encrypted;
char Xored_Byte = Ascii_Num_Byte_To_Encrypt ^ Key_To_Use; //xor operation
string Encrypted_Byte = (char)Xored_Byte;
Str_Encrypted_Message += Encrypted_Byte;
//short code of the function once explained
//$str_encrypted_message .= chr((ord(substr($str_message, $position, 1))) ^ ((255+(($len_str_message+$position)+1)) % 255));
}
return Str_Encrypted_Message;
} //end function you need to include the string library for this to work.
It should be something like the code above...
Thanks. Stuff like that takes me probably 10 times longer than you.
---------- Post added 07-27-2012 at 06:34 PM ---------- Previous post was 07-24-2012 at 04:37 PM ----------
I hate how C has so many different types. I have no idea what the difference is in most of them.
This is expecting ErrorCode to be LONG. I want to change ErrorCode to const TCHAR* or some other type of text. Any idea on how to do that? DISPPARAMS expects a VARIANTARG. I have no idea what VARIANTARG or DISPPARAMS are.
CComVariant avarParams[1];
avarParams[0] = ErrorCode;
avarParams[0].vt = VT_I4;
CComVariant varResult;
DISPPARAMS params = { avarParams, NULL, 1, 0 };
hr = pConnection->Invoke(2, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, ¶ms, &varResult, NULL, NULL);
It will compile even with ErrorCode being TCHAR but it converts them back to random numbers. The text value of ErrorCode stays the same but the displayed number is different every time.
Thanks.
vBulletin® v3.8.7, Copyright ©2000-2026, Jelsoft Enterprises Ltd.