|
Chrome uses a version of the WebSockets protocol that is different than provided by some of the libraries i tested. The protocol is RFC 6455 and the standard is (draft-ietf-hybi-thewebsocketprotocol-10 as of August 2011. I am not sure which version they use in the new Chrome browser, but either way, the libraries do not work with it.
The reference to Chrome comes me wanting WebSockets and not Sockets. I want WebSockets to use with HTML5. Hence the reference to Chrome with does in fact support HTML5. I do not want to make a websockets server as a javascript/php/python script that will serve the HTML5 WebSocket application I am making. I need it done in C++.
Once again, I do not need BSD style sockets! I need a websockets library for the WebSockets protocol that correctly performs the Handshake used by Chrome and possibly other HTML5 supporting browsers.
Nothing is impossible, It's merely a matter of finding an answer to the question of HOW? ... And answering that question is usually the most difficult part of the job!!!
|
|
|
|
|
|
enhzflep wrote: I'd also be keen to consider modifying a non-working library such that the handshake operation mirrored that exhibited by the C# code you already have (but prefer not to use)
Thank you for the idea about modifying the existing library based on code from another language that works. I was able to get the libwebsockets working in C++ now so I no longer need to use managed C++ or C# for the project. I found that there were a few problems, one being that the SHA1 and Base64 encoding schemes were not functioning correctly for some reason. Once I fixed those, and re-ordered the way the packets is sent, the library works wonderfully. So, thanks for the idea. The links really helped to understand how I needed to modify the existing code to get it working.
Nothing is impossible, It's merely a matter of finding an answer to the question of HOW? ... And answering that question is usually the most difficult part of the job!!!
|
|
|
|
|
It's a pleasure. I thought my idea would prove unpopular, though have read RFCs and modified code to conform in the past. The value of what I learned far exceeds the value of the time taken to do it, sure beats simply downloading a working implementation.
On a side note - nice sig! I've said for a long time "Everything's easy.... You just have to know how. Building a nuclear bomb is easy - _if_ you know how"
|
|
|
|
|
Hello,
I have a dialog that contains some radio buttons and a list box I wondered how can I pass a message to another object that the user chaghed his selection by press one of the redio buttons, I need to call to a method of the second object accordeing the user selction .
thanks
|
|
|
|
|
What is the second object?
"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
|
|
|
|
|
Object of a non dialog class
|
|
|
|
|
It depends how the objects are subclassed (or derived) and who their parent is. Just about all buttons in MFC are CWnd derived, but their event handlers are usually managed by the parent window (usually some CDialog or some sort of form).
If the second object that you're referring to is another button type of object, that is owned by the same parent window, then it's ok to make direct calls to access the other object. On the other hand, if that other object is in a separate dialog or form, then you should pass a message using SendMessage or PostMessage to the parent window and let it handle the event.
It's going to make quite a big difference as to what these "objects" you are talking about are and who the owner is. A number of different solutions will probably work, but you should be careful and follow framework guidelines as you may end up with an unstable solution.
|
|
|
|
|
Its a simple process with a number of small steps.
1. Wire-up the message handling of the radio buttons so that you get a WM_NOTIFY (or whatever the pertinent message is) whenever the active radio-button in the group changes.
2. Call method of object 2 with the selected option passed in as a variable somehow - either as text, or (preferably) as an INT that represents the choice number.
Here's a dialog-based app that demonstrates the principle. Whether you call the method of the second object when the selection changes or when an 'action' button is pressed, is up to you.
(And yes, I do realize that as they're radio-buttons, one of the options should be checked by default - just can't remember how just this minute - it was easier and quicker to add a test case to check if an option had been selected yet or not )
resource.rc
// Generated by ResEdit 1.5.8
// Copyright (C) 2006-2011
// http://www.resedit.net
#include <windows.h>
#include <commctrl.h>
#include <richedit.h>
#include "resource.h"
//
// Dialog resources
//
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
DLG_MAIN DIALOGEX 6, 5, 194, 106
STYLE DS_3DLOOK | DS_CENTER | DS_SETFONT | WS_CAPTION | WS_VISIBLE | WS_GROUP | WS_THICKFRAME | WS_SYSMENU
CAPTION "Code::Blocks Template Dialog App"
FONT 8, "Tahoma", 0, 0, 1
{
PUSHBUTTON "&Test", IDC_BTN_TEST, 138, 5, 46, 15
PUSHBUTTON "&Quit", IDC_BTN_QUIT, 138, 29, 46, 15
GROUPBOX "Static", IDC_STATIC, 13, 16, 114, 68
AUTORADIOBUTTON "Radio Button 1", IDC_RADIO1, 38, 32, 63, 8
AUTORADIOBUTTON "Radio Button 2", IDC_RADIO2, 38, 45, 63, 8
AUTORADIOBUTTON "Radio Button 3", IDC_RADIO3, 38, 59, 63, 8
}
resource.h
#ifndef IDC_STATIC
#define IDC_STATIC (-1)
#endif
#define DLG_MAIN 101
#define IDC_BTN_TEST 1000
#define IDC_BTN_QUIT 1001
#define IDC_RADIO1 1002
#define IDC_RADIO2 1003
#define IDC_RADIO3 1004
main.cpp
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <stdio.h>
#include "resource.h"
HINSTANCE hInst;
int curRadioOption = -1;
BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
char msgBuffer[1024];
switch(uMsg)
{
case WM_INITDIALOG:
return TRUE;
case WM_CLOSE:
EndDialog(hwndDlg, 0);
return TRUE;
case WM_COMMAND:
switch(LOWORD(wParam))
{
case IDC_BTN_QUIT:
EndDialog(hwndDlg, 0);
return TRUE;
case IDC_BTN_TEST:
if (curRadioOption != -1)
sprintf(msgBuffer, "You clicked the \"test\" button\nCurrent radio selection: #%d", curRadioOption);
else
sprintf(msgBuffer, "No radio-button option selected...\nPlease select an option then try again");
MessageBox(hwndDlg, msgBuffer, "Information", MB_ICONINFORMATION);
return TRUE;
case IDC_RADIO1:
curRadioOption = 1;
return true;
case IDC_RADIO2:
curRadioOption = 2;
return true;
case IDC_RADIO3:
curRadioOption = 3;
return true;
}
}
return FALSE;
}
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
hInst = hInstance;
return DialogBox(hInstance, MAKEINTRESOURCE(DLG_MAIN), NULL, (DLGPROC)DialogProc);
}
|
|
|
|
|
Thanks for your replay , I didnt understand where is the calling to the method of object 2,
if you can mark this section it will be helpfull for me.
by the way I forgot to specify that I am using MFC but as I realized it doesnt matter.
thanks
|
|
|
|
|
That's okay. In fact - I didn't make any call to the method of object 2. Please accept my apology for being unclear.
As I alluded to earlier, I can see two places where such a call would make sense.
In the first case, there would be action immediately after a radio button was pressed.
I imagine you would not have the same need to keep track of the currently selected option, so I've omitted that code from the following case statements.
Example 1: Immediate response
case IDC_RADIO1:
object2.handleSelectedRadioButton(1);
return true;
case IDC_RADIO2:
object2.handleSelectedRadioButton(2);
return true;
case IDC_RADIO3:
object2.handleSelectedRadioButton(3);
return true;
In this second example, you'll need to remember which radio-button is selected somewhere, before taking the appropriate action when the trigger is received (in this case, the pressing of the button labelled Test)
Example 2: Action taken in response to another input
case IDC_BTN_TEST:
if (curRadioOption == -1)
MessageBox(hwndDlg, "Select a radio button first!", "Error", MB_ICONERROR);
else
object2.handleSelectedRadioButton(curRadioOption);
return TRUE;
Something else I should mention, is that MFC will most likely allow the state of any control to be quickly and easily queried (not sure if there's an object used to represent a group of radio buttons - I'd imagine that there was) This will make my global variable curRadioOption redundant.
|
|
|
|
|
Pass a pointer to the object you want to notify in the constructor of the dialog, and have the dialog save that in a member variable.
Then when events occur, make a call to that object.
|
|
|
|
|
Hello
Thanks in advance.I have created different dialog for which are link by the main menu,but my problem is if i go from one dialog to another , how can i close it and save its contents
Waiting for reply soon
|
|
|
|
|
johnjitu wrote: ...if i go from one dialog to another , how can i close it and save its contents
The dialog is closed by clicking the Cancel button, the X, Esc, Alt+F4, or by calling EndDialog() . Where are you wanting to save its data to? Some internal data structure, or some external storage like a file?
"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
|
|
|
|
|
Thanks
I did not put any cancel or close,it is without title bar.I make sdi application with
full screen and in menu of upper level i put the chose where you can open the new
dialog.I am calling dialog boxes from the Viewclass.but didnot find how to close or switch to other dialog when user click the other options of open other dialogs
Do yo have any coding to calling mulitple dialogboxes in SDI applicaiton
Thanks
|
|
|
|
|
johnjitu wrote: Do yo have any coding to calling mulitple dialogboxes in SDI applicaiton
You need to first understand the difference between modal and modeless dialogs.
"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
i looking to load the image in an window how can i do it i tried with CpictureHolder .does any alternative way to do it.
note am not looking to load on background
Reply as soon as possible .
thanks sarfaraz

|
|
|
|
|
Perhaps CImage[^] is what you need.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Hello,
is there any c++ tutorial or (simple) open source sample how to write an OLE object that can be embedded into MS Office applications such as powerpoint?
Just like, for example, an Origin Graph or a corel draw image which are directly embedded into a powerpoint presentation.
When I search for OLE, I most often only find how to automate Office...
Alex
|
|
|
|
|
|
Thank you - this was easier than I expected.
Alex
|
|
|
|
|
I can insert my ActiveX object into Powerpoint and save/restore the data.
Now, I would like to automatically create a new object from a certain file type - ideally by drag and drop into Powerpoint. How can I achieve this?
Thank you in advance.
Alex
|
|
|
|
|
I never did that, however, I suppose you have to write a Shell Extension for that, check out the great article series[^] of Michael Dunn, here at CodeProject .
Veni, vidi, vici.
|
|
|
|
|
|
|