|
thanks for your reply i will send what i make in the receive function
void CConnect::OnReceive(int nErrorCode)
{
// TODO: Add your specialized code here and/or call the base class
char *Buf=new char[10000];
int i=Receive (Buf,10000);
Buf[i]=NULL;
AfxMessageBox("a");
if (Buf[0] == '1')
{
if (Buf[0] == '<')
{
do
{
int i=0;
UserName[i]=Buf[i+2];
i++;
}
while (Buf[i+2] != '>');
}
}
else if (Buf[0] == '2')
{
if (Buf[0] == '<')
{
do //User
{
int j=0;
User[j]=Buf[i+1];
j++;
i++;
}
while (Buf[i+1] != '>');
if (Buf[i+2] == '<')
{
do //message
{
int x=0;
Message[x]=Buf[i+3];
i++;
x++;
}
while (Buf[i+3] != '>');
}
}
}
Send(User,10000);
AfxGetMainWnd()->PostMessage(UM_AII,(WPARAM)Buf,0);
CSocket::OnReceive(nErrorCode);
}
/////////////////////////////////////////////////////////////////
void CConnect::GetPeople (CString IP, UINT Port)
/* get the IP and Port from getpeername function from OnAccept and send it here so i can save the connected poeple on it with thier user name*/
{
CListen L;
LOP[Index].IP=L.IP;
LOP[Index].Port=L.Port;
LOP[Index].UserName=UserName[Index];
Index++;
}
///////////////////////////////////////////////////////////////////////
int CConnect:: Search(char User[])
/* this function to search for people in the struct but i don't know how to send thier IP and Port to the other Client who want to connect to them i don't make any use from it*/
{
for(Index=0;Index<100;Index++)
{
if(LOP[Index].UserName==User[Index])
{
CString IP=LOP[Index].IP;
UINT Port=LOP[Index].Port;
}
else
Index++;
}
return Index;
}
|
|
|
|
|
I use an external DVD burner connected through firewire, and want to be able to dynamically detect when it's switched on and off while my app is running, so I know when it's available or not.
I have seen the following CP article, which suggests using the WM_DEVICECHANGE broadcast message but wasn't exactly sure how to handle this message. I need it to run on Win 95 so I cannot use SHChangeNotifyRegister() which is only for Win 2000 and above.
http://www.codeproject.com/shell/shchangenotifyregister.asp[^]
|
|
|
|
|
|
I've got a lot of help of user
_AnShUmAn_
with a question of formating a DateTimePicker. He suggested me, to use a CDateTimeCtrl value instead of an COleDateTime value. And it works fine in the dialog, but I cannot get the values back at the and of my dialog. Can anyone help me?
Thanks, Gerhard
|
|
|
|
|
// Using ClassWizard, create a member variable for the CDateTimeCtrl "value"
class CMyDialog : public CDialog
{
// Construction
public:
CMyDialog(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CMyDialog)
enum { IDD = IDD_DIALOG1 };
CTime m_TimeValue;
//}}AFX_DATA
...
// Then if, for example, your dialog is shown on a menu item selection...
void CMyView::OnShowdialog()
{
// TODO: Add your command handler code here
CMyDialog dlg;
dlg.m_TimeValue=CTime::GetCurrentTime(); // Init time
if (dlg.DoModal()==IDOK) {
TRACE("%s\n",dlg.m_TimeValue.Format("%Y/%m/%d %H:%M:%S"));
}
}
-- modified at 18:34 Sunday 11th June, 2006
|
|
|
|
|
Thanks for your reply, but I have the same problem as with COleDateTime.
If I use CTime or COleDateTime, I can read the entered values in the
"if (dlg.DoModal()==IDOK) {..."-block, but I cannot format the dialog-field.
If I use CDateTimeCtrl, I can format my dialog-field with
m_begin.SetFormat("yyyy/MM");
in the OnInitDialog, but in the "if (dlg.DoModal()==IDOK) {..."-block I don't get the values for year or month.
Thanks, Gerhard
|
|
|
|
|
ensger wrote: He suggested me, to use a CDateTimeCtrl value instead of an COleDateTime value.
I'm not sure why this was suggested. They are mutually exclusive classes. The former is actually attached to a control, and thus only exists as long as the dialog itself does, whereas the latter is just used to manipulate date/time values, and exists as long as the CDialog -derived class exists.
ensger wrote: ...but I cannot get the values back at the and of my dialog.
As long as the dialog's OnOK() method is updating the COleDateTime object, you can get the correct values.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
That's it, so I only have to use the GetTime-function of the CDateTimeCtrl with a COleDateTime-variable as an parameter in the OnOK() method.
I searched for this solution for about 4 days. Thank you very much!!!!
|
|
|
|
|
I've created an atl object like this
HWND hCtrl=CreateWindowEx(0,"AtlAxWin","Shockwaveflash.Shockwaveflash.1",WS_VISIBLE|WS_CHILD,
0,0,100,100,hParent,NULL,Hinstance,0);
So I want to set its Movie Property to SWF file.
So what should i do next .This is not a MFC application.
thanx
Kanchana
|
|
|
|
|
Can you put the "ProgId" in the windowname parameter?
|
|
|
|
|
yes.object created successfully
just want to set the property
Kanchana
|
|
|
|
|
Fair enough. I had never seen it done that way before (I've never heard of "AtlAxWin"). I guess I learn something new every day it seems.
|
|
|
|
|
While this may be a Visual Studio feature request, does anyone know how to get the task list to scan all files in the solution rather than the current file. This is very annoying, and frankly the lack of it makes it useless.
Keep having to resort to Find in Files.
Not very slick.
Using VS 2005.
"Je pense, donc je mange." - Rene Descartes 1689 - Just before his mother put his tea on the table.
Shameless Plug - Distributed Database Transactions in .NET using COM+
|
|
|
|
|
Hello, could you please help me?
Here's an article:
http://www.codeproject.com/menu/bmpmenu.asp
The last comment is about using bitmap menu in dialog:
"I will use the MSDN example project dlgcbr32 to demonstrate this. Dlgcbr32 demonstrates how to add control bars to a dialog based application. Build dlgcbr32 and then follow these steps (the first 5 steps are essentially the same steps given in the original article):
1. Add these files to your project:
BitmapMenu.cpp, BitmapMenu.h, and winuser2.h
2. In Mdlsmain.h add this line:
#include "BitmapMenu.h"
3. In Mdlsmain.h inherit your modeless dialog from BitmapMenu:
class CModelessMain : public BitmapMenu<cmodelessdialog>
4. In Mdlsmain.cpp add two message handlers (the third message handler ON_WM_INITMENUPOPUP() is already there):
ON_WM_MEASUREITEM()
ON_WM_DRAWITEM()
5. In Mdlsmain.cpp at the end of the CModelessMain::OnInitDialog() function add the tool bar:
AddToolBar(&m_toolBar);
6. At the beginning of BitmapMenu.cpp add this line:
#include "Modeless.h"
7. At the end of BitmapMenu.cpp add this line:
template BitmapMenu<cmodelessdialog>;
8. In Mdlsmain.cpp at the beginning of the function CModelessMain::OnInitMenuPopup() add this line:
BitmapMenu<cmodelessdialog>::OnInitMenuPopup(pPopupMenu, nIndex, bSysMenu);
9. At the top of BitmapMenu.h add this line:
#include <afxcmn.h>"
The only thing that can't be compiled after perfoming all steps to use bitmap menu in dialog is this line:
CColorLBTestDlg::CColorLBTestDlg(CWnd* pParent /*=NULL*/):CDialog(CColorLBTestDlg::IDD, pParent)
The error i get:
error C2614: 'CColorLBTestDlg' : illegal member initialization: 'CDialog' is not a base or member
Thanks in advance!
|
|
|
|
|
Check your header file (.h) that contains the declaration for ColorLBTestDlg . If should include a line like this:
class ColorLBTestDlg : public CDialog {
Software Zen: delete this;
|
|
|
|
|
Nope, the class must be defined like this:
class CModelessMain : public BitmapMenu<CModelessDialog>
This is the author's idea.
|
|
|
|
|
You need to modify your constructor call to match the signature of his constructor, then.
Software Zen: delete this;
|
|
|
|
|
|
I've added a XML file to my resources which I load with FindResource/LoadResource.
My problem now is that I need to detect at runtime wheter it is UTF8 or UTF16. Is there any function that tells if a string is UTF8 or UTF16?
Thanks
|
|
|
|
|
If you created the resource string using MSXML then the string will be a BSTR which is UTF-16 by definition. Microsoft warns that the string will not contain the byte order mark that you normally can check for at the beginning of a disk file.
The thing to remember when parsing a BSTR string created with MSXML is that the line indicating the encoding will not reflect the actual encoding of the string.
In other words,
<?xml version="1.0" encoding="UTF-8"?>
in a BSTR representation should be ignored as the encoding will always be UTF-16.
|
|
|
|
|
|
|
Hi all,
i am required to write a simple BHO which changes the "User-Agent" Header for every HTTP-Request (has to be a BHO). I already had success with IWebBrowser2::Navigate for a single specific website. Is it possible to do this inline (Without (re-)navigate) and for any request done with the IE?
<br />
void CComServer::IEBeforeNavigate2(DISPPARAMS* pDispParams)<br />
{<br />
pDispParams = pDispParams;<br />
<br />
CComBSTR url = ((*pDispParams).rgvarg)[5].pvarVal->bstrVal;<br />
if (url == "http://www.url.com" )<br />
{<br />
CComPtr<IWebBrowser2> spBrowser;<br />
CComPtr<IDispatch> spDisp = ((*pDispParams).rgvarg)[6].pdispVal;<br />
spDisp->QueryInterface(IID_IWebBrowser2, (void**)&spBrowser);<br />
spBrowser->Stop();<br />
<br />
CComBSTR newURL = "http://www.google.com/";<br />
spBrowser->Navigate(newURL, NULL, NULL, NULL, NULL);<br />
((*pDispParams).rgvarg)[0].boolVal = TRUE;<br />
<br />
return;<br />
}<br />
Thanks in advance
|
|
|
|
|
hi..
i have an array of data i want to sort the data linearly..is there any way to do it..?
|
|
|
|
|
Use std::sort from the STL. For example to sort an array of int s:
int NumArray[] = {3, 1, 4, 1, 5, 9, 2, 6, 5};
int *pNumOnePartEnd = NumArray + sizeof(NumArray)/sizeof(NumArray[0]);
std::sort(NumArray, pNumOnePartEnd);
Remember to #include <algorithm> .
Steve
|
|
|
|