|
Maybe it's very stupid question. I'm talking about application working on LAN. I can get IP adress but i need send a broadcast message. IMO is simplest way replace part of IP adress with 0xFF(or something like this depending on adressing of LAN) and send UDP packet. But i don't know how to get mask and find right part of adress to replace. Can anybody help me?
|
|
|
|
|
I'm not sure what you're talking about here. Mask? Anyways, if you want to send a broadcast message just set the destination IP address to 255.255.255.255 and set the port to whatever port you're going to be using. I believe most routers will block that (not routeable) so it won't go out on the Internet but remain on your LAN and probably won't cross any segments.
|
|
|
|
|
Ok, after doing some research on a related topic, I stumbled across what you were talking about. You're asking about the subnet mask.
I don't know how you get it. But, as I stated earlier you can send 255.255.255.255 as a broadcast for all subnets. If your IP address was 192.168.1.22 and your subnet mask was 255.255.255.0 then sending a broadcast message with IP address 192.168.1.255 would work also. Thus, that becomes a broadcast message for that subnet only.
The procedure I read said negate OR the subnet mask with your IP address to get that value.
e.g. ip |= ~mask to get broadcast address.
|
|
|
|
|
I have to supply documentation for the user of the app (not docs for the code). Things like features and instructions and troubleshooting etc. I'd like to make this like the help system we see that pops up with tabs for index, search, contents etc. Can you please point me to links, sample code etc on how to do this?
Thanks,
ns
|
|
|
|
|
try HtmlHelp released by microsoft
I am seeking...
For what?
Why did you ask me for what? I don't know!
|
|
|
|
|
|
In the Solution Explorer window, right-click on your project and select Properties. In the dialog box, unfold the Linker folder, click on Input. Then add your .lib file(s) in Additional Dependencies.
MS quote (http://www.microsoft.com/ddk) : As of September 30, 2002, the Microsoft® Windows® 2000 DDK, the Microsoft Windows 98 DDK, and the Microsoft Windows NT® 4.0 DDK will no longer be available for purchase or download on this site. Support for development will ship at the same time as the Windows XP Service Pack 1 (SP1) release.
|
|
|
|
|
-Projects
-Add existing item...
Kuphryn
|
|
|
|
|
|
If you have a "simple" ADO application in C++ that shows the usage of stored procedures, then please write the code here .
|
|
|
|
|
Yes Sir!
// AdoHelper.cpp: implementation of the CAdoHelper class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "AdoHelper.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CConnection* CConnection::m_pInstance = NULL;
void CConnection::SetConnection(const CString& strConnectString)
{
m_strConnectString = strConnectString;
}
CConnection::CConnection()
{
m_pInstance = NULL;
m_bConnect = FALSE;
}
CConnection::~CConnection()
{
}
void CConnection::Disconnect()
{
try
{
if (m_Conn != NULL)
m_Conn->Close();
}
catch (...)
{
}
}
CString CConnection::GetConnectString()
{
return m_strConnectString;
}
BOOL CConnection::Connect()
{
BOOL bRet = FALSE;
CString str;
try
{
m_Conn = _ConnectionPtr(__uuidof( Connection ));
_bstr_t bstrConn(GetConnectString());
_bstr_t n;
if (SUCCEEDED(m_Conn->Open(bstrConn,n,n,0)))
{
bRet = TRUE;
}
else
{
CString str;
str.Format("%s Connection Failed",bstrConn);
AfxMessageBox(str);
}
}
catch (_com_error& e)
{
}
m_bConnect = bRet;
return bRet;
}
BOOL CConnection::IsConnected()
{
return m_bConnect;
}
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
CAdoCmd::CAdoCmd()
{
m_pConnection = NULL;
m_bParamSet = false;
}
CAdoCmd::CAdoCmd(const CString& strSP, CConnection* pConnection)
{
m_bParamSet = false;
m_pConnection = pConnection;
ASSERT(pConnection != NULL);
ASSERT(m_pConnection->m_Conn != NULL);
m_cmd = _CommandPtr(__uuidof(Command));
ASSERT(m_cmd != NULL);
m_cmd->ActiveConnection = m_pConnection->m_Conn;
m_cmd->CommandText = _bstr_t(strSP);
m_cmd->CommandType = adCmdStoredProc;
m_cmd->CommandTimeout = 15;
}
void CAdoCmd::SetProcedureName(const CString& strSP, CConnection* pConnection)
{
m_pConnection = pConnection;
ASSERT(pConnection != NULL);
ASSERT(m_pConnection->m_Conn != NULL);
m_strSP = strSP;
m_cmd = _CommandPtr(__uuidof(Command));
ASSERT(m_cmd != NULL);
m_cmd->ActiveConnection = m_pConnection->m_Conn;
m_cmd->CommandText = _bstr_t(strSP);
m_cmd->CommandType = adCmdStoredProc;
m_cmd->CommandTimeout = 15;
}
BOOL CAdoCmd::CreateParameter(DataTypeEnum dtEnum, ParameterDirectionEnum pdEnum, int nSize)
{
_ParameterPtr pParam = _ParameterPtr(__uuidof(Parameter));
pParam = m_cmd->CreateParameter("", dtEnum, pdEnum, nSize);
m_cmd->Parameters->Append(pParam);
m_unkArray.Add(pParam);
m_bParamSet = true;
return TRUE;
}
BOOL CAdoCmd::CreateReturnParameter(DataTypeEnum dtEnum, int nSize)
{
// Return Parameter MUST be create first
ASSERT(m_bParamSet == 0);
if (m_bParamSet)
return FALSE;
m_pRetParam = _ParameterPtr(__uuidof(Parameter));
ASSERT(m_pRetParam != NULL);
m_pRetParam = m_cmd->CreateParameter("", dtEnum, adParamReturnValue, nSize);
m_cmd->Parameters->Append(m_pRetParam);
return TRUE;
}
BOOL CAdoCmd::Execute()
{
BOOL b = TRUE;
try
{
m_cmd->Execute(NULL, NULL, 0);
}
catch (_com_error& e)
{
ASSERT(0);
b = FALSE;
}
return b;
}
_variant_t CAdoCmd::GetReturnValue()
{
return m_pRetParam->Value;
}
_variant_t CAdoCmd::GetParamValue(int nParam)
{
_ParameterPtr pParam = m_unkArray.GetAt(nParam);
_variant_t v = pParam->Value;
if (v.vt == VT_NULL)
v = "";
return v;
}
void CAdoCmd::SetParamValue(int nParam, _variant_t val)
{
_ParameterPtr pParam = m_unkArray.GetAt(nParam);
pParam->Value = val;
}
void CAdoCmd::SetParamValue(int nParam, _bstr_t val)
{
_ParameterPtr pParam = m_unkArray.GetAt(nParam);
pParam->Value = val;
}
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
Normski. - the next bit of code is self modifying ... jmp 0xCODE
|
|
|
|
|
My window (CWnd derived) is created by <font color=blue>CWnd</font>::CreateEx(WS_EX_TOPMOST,..., WS_POPUP, hwndParent) .
hwndParent has WS_CHILD style, for it's the only way I could find to create my window without taskbar icon (My wnd is a tooltip-like).
I also used:
<font color=blue>CWnd</font>::SetWindowPos(&wndTopMost,0,0,0,0,SWP_NOSIZE | SWP_NOMOVE) ;
My window couldn't top the taskbar . Very funky...
Any ideas why this occurs? Any at all?
--BlackSmith--
/*The roof is on fire, we don't need no water, let the MF burn*/. BHG.
|
|
|
|
|
In a previous post, I sugested setting the desktop as the parent of your pop-up with Cwnd::SetParent . Didn't this work? (just curious)
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
use this code
::SetWindowPos (m_hWnd , m_Options_AlwaysOnTop ? HWND_TOPMOST :HWND_NOTOPMOST,
0, 0, 0, 0,
SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE) ;
|
|
|
|
|
I write following code In Win98
CClientDC dc(this);
CBitmap bmpTemp;
BOOl bRes = bmpTemp.CreateCompatibleBitmap(&dc, 4000, 2000);
ASSERT(bRes != 0); // It failed in Win98, But in Win2k it's OK !!!
When I changed it to:
"BOOl bRes = bmpTemp.CreateCompatibleBitmap(&dc, 4000, 1000);"
It's OK
I want to know:
What's biggest size bitmap in Win98 can create ??
It's me, code_cold
|
|
|
|
|
Windows 95/98/Me: The created bitmap cannot exceed 16MB in size.
Normski. - the next bit of code is self modifying ... jmp 0xCODE
|
|
|
|
|
You are right
Then, How can I create a more than 16M bitmap
I need this bitmap to buffer a bitmap file
It's me, code_cold
|
|
|
|
|
Does the CreateBitmap has the same limitation as CreateCompatibleBitmap(No more than 16M size bitmap create) ??
It's me, code_cold
|
|
|
|
|
Whether it is possible to change the caret in CEdit with a vertical line to another (for example: blinking or solid rectangle)
Best regards,
Eugene Pustovoyt
|
|
|
|
|
void CMyDlg::OnChangeCaret()
{
CBitmap* pBitmap = new CBitmap;
pBitmap->LoadBitmap(IDB_HAPPY_BITMAP);
m_editCtrl.CreateCaret(pBitmap);
m_editCtrl.ShowCaret();
}
MS quote (http://www.microsoft.com/ddk) : As of September 30, 2002, the Microsoft® Windows® 2000 DDK, the Microsoft Windows 98 DDK, and the Microsoft Windows NT® 4.0 DDK will no longer be available for purchase or download on this site. Support for development will ship at the same time as the Windows XP Service Pack 1 (SP1) release o
|
|
|
|
|
Yes in such a way will change the caret, but before the first click the mouse in the CEdit . After that the kind of the caret comes back to a vertical line.
Best regards,
Eugene Pustovoyt
|
|
|
|
|
How send some bitmap with winsock?
|
|
|
|
|
You can send data over a socket. Bitmap is a data type.
Kuphryn
|
|
|
|
|
BITMAP bitmap;<br />
char *szBuff;<br />
int nBmpSize;<br />
<br />
::GetObject(HBITMAP, sizeof(BITMAP), &bitmap);<br />
<br />
nBmpSize = bitmap.bmWidth * bitmap.bmHeight;<br />
szBuff = new char[nBmpSize];
//You can copy any other data the will help you to create a bitmap(its size)
memcpy((void*)szBuff), bitmap.bmBits, nBmpSize);<br />
<br />
send(theSocket, lpBuff, sizeof(lpBuff),...);
//Use the received buffer to create a bitmap on the client/server side.
CBitmap bmp;<br />
bmp.create(...); <br />
bmp.SetBitmapBits(<font color=green></font>);
Email me if this works well, or for any other help!
--BlackSmith--
/*The roof is on fire, we don't need no water, let the MF burn*/. BHG.
|
|
|
|
|
I think it is easier to:
BITMAP bitmap;
char *szBuff;
int nBmpSize;
::GetObject(HBITMAP, sizeof(BITMAP), &bitmap);
nBmpSize = sizeof(BITMAP) + bitmap.bmWidth * bitmap.bmHeight;
szBuff = new char[nBmpSize];
//You can copy any other data the will help you to create a bitmap(its size)
memcpy((void*)szBuff), &bitmap, sizeof(bitmap)); // we will ignore 'bmBits' pointer
memcpy((void*)szBuff), bitmap.bmBits, nBmpSize);
send(...)
// now Create can use receive buffer that hold information on the bitmap
CBitmap bmp;
char* szBuff = (received buffer...)
BITMAP bitmap;
memcpy(&bitmap, szBuff, sizeof(bitmap));
bitmap.bmBits = szBuffer+sizeof(bitmap);
bmp.CreateBitmapIndirect(&bitmap);
ÿVOTD:5 "Keep your lives free from the love of money and be content with what you have, because God has said,
"Never will I leave you; never will I forsake you." " - Heb 13:5
|
|
|
|
|