|
Thanks Viorel.
I removed ON_COMMAND then ON_COMMAND_EX taking effect .And as it is tanking nID so it is useful
and proves that it is just an extension to ON_COMMAND .
|
|
|
|
|
Suppose send buffer has 2 bytes free
n=send(s,buf,16,0)
Will 2 bytes of buf be sent?
I call send in FD_READ according to the received data. If I can't send the data entirely, how can I send it after that.
-- modified at 3:02 Thursday 29th June, 2006
|
|
|
|
|
followait wrote: Suppose send buffer has 2 bytes free
n=send(s,buf,16,0)
Will 2 bytes of buf be sent?
I call send in FD_READ according to the received data. If I can't send the data entirely, how can I send it after that.
Since it's not possible to send/receive whole data at a time subject to size of the data.
so before sending or putting the data into buffer, clean up the buffer and after put the data into it or simply use some delimiters to identify the end of the data.
and wait and receive until you will get all the data based on delimiter(s).
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
The send buffer of the socket depends on the system--be cleaned when the data is really sent, I shouldn't clean it manually.
-- modified at 3:48 Thursday 29th June, 2006
|
|
|
|
|
followait wrote: The send buffer of the socket depends on the system--be cleaned when the data is really sent, I shouldn't clean it manually
Agreed,
But i am talking about buf which you are using..it should be clean up before puting the data into it.
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
followait wrote: Suppose send buffer has 2 bytes free
n=send(s,buf,16,0)
Will 2 bytes of buf be sent?
Normally, the send() function will block until threre's enough room in the buffer (16 bytes in this case). If the socket is in nonblocking mode, then send() might send 2 bytes or it could return SOCKET_ERROR with errno set to WSAEWOULDBLOCK .
If you are using non-blocking sockets, you must handle WSAEWOULDBLOCK situations and partial sends.
|
|
|
|
|
Thanks.
I use a nonblocking mode. If send return SOCKET_ERROR which is WSAEWOULDBLOCK, how can I handle this situation? I don't know how to take use of FD_WRITE. Could you give me some help? Thanks a lot.
|
|
|
|
|
Hi,
How to change the color of a dialog box, I need to change the Color of dialog box to the background color of window. Any help can be appreciated.
Thanks,
Krishna.
|
|
|
|
|
Use SetDialogBkColor() to set the color of the dialog box.
Regards,
Brahmma
You have an apple and me too. We exchange those and We have an apple each.
You have an idea and me too. We exchange those and We have two ideas each.
|
|
|
|
|
WM_CTLCOLOR WM_PAINT WM_ERASEBKGND and see COLOR_WINDOW
whitesky
|
|
|
|
|
Krishnatv wrote: How to change the color of a dialog box, I need to change the Color of dialog box to the background color of window. Any help can be appreciated.
See the following code:
BRUSH CMyDialog::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
if(nCtlColor==CTLCOLOR_DLG)
hbr=CreateSolidBrush(RGB(128,45,128));
return hbr;
}
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
I think this is better
COLORREF Color;
Color=GetDC()->GetBkColor();
<code>(1)
void CtetDlg::OnPaint()
{
CPaintDC dc(this);
dc.FillSolidRect(0,0,GetSystemMetrics (SM_CXSCREEN),GetSystemMetrics (SM_CYSCREEN),
Color);
CDialog::OnPaint();
}
-------------------------------
(2)
HBRUSH CtetDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
return (HBRUSH)GetStockObject(WHITE_BRUSH);
}
(3)
BOOL CtetDlg::OnEraseBkgnd(CDC* pDC)
{
return CDialog::OnEraseBkgnd(pDC);
}
</code>
whitesky
|
|
|
|
|
|
Hi,
I have a problem with app icons. I developed an app that can be compiled for different users. Each of this users has it's own app icon and a splash screen. The splash screen is not a problem but the icon is. For now I'm doing the copy/paste of user icons over the old ones before compiling the app. Is there a way to automate this (set an ifdef in the rc file, set some precompile options in VS...)?
I,m using VS.NET 7.0
Thanks
|
|
|
|
|
yea,
use #ifdef to do the same.
On Loading Icon,
#ifdef __CUSTOM1
HICON hIcon LoadIcon(ICON_CUSTOM1);
#else __CUSTOM2
HICON hIcon LoadIcon(ICON_CUSTOM1);
SetIcon(hICon,true);
SaRath.
"It is your attitude, not your aptitude, that determines your altitude - Zig Ziglar."
My Blog | Understanding State Pattern in C++
|
|
|
|
|
I suppose that this works when I must load the icon on app runtime or not ... (if not where I must put this code)? I have to compile the app with the selected icon - the selected icon must be visible in windows explorer (explorer, desktop...)
|
|
|
|
|
Hello Friends,
I am working on Outlook Object Model(Beginner).
I am developing Addin for Outlook 2002.(There is No Version problem.I think So)
If I create a project in VC6.0 Environment then its DLL works properly in Outlook .
But if I develop same type of project In Visual Studio.NET environment it does not give any error but unable to work in Outlook.
What is the problem with .Net Environment?
Please Tell Me.
Thanking You.
The secret of life is not enjoyment
but education through experience.
- Swami Vivekananda.
|
|
|
|
|
Which VS.NET version are you using? Did you add the correct dll references for the outlook and office libraries?
Mahesh KulkarniWhat is the problem with .Net Environment?
There is no problem. If you are using VS2005 then you need Visual Studio Tools for Office (VSTO) to create add-ins.
---
Hakuna-Matada
It means no worries for the rest of your days...
It's our problem free, Philosophy
|
|
|
|
|
Firstly Thanks For The Reply.
I am working on VS.NET 2003.
I am following standard method for creating Addins which is working on VS 6.0 editor. Does I need to add any thing extra in VS.NET. If yes then what and from where?
The secret of life is not enjoyment
but education through experience.
- Swami Vivekananda.
|
|
|
|
|
Mahesh KulkarniI am following standard method for creating Addins which is working on VS 6.0 editor
Ok, so what is the standard method? Man, why don't you google? There are a whole bunch of websites which teach you how to create Office add-ins in .NET 2003.
Check out
this[^] and this[^]
---
Hakuna-Matada
It means no worries for the rest of your days...
It's our problem free, Philosophy
|
|
|
|
|
Again Thanks...
But as this is Visual C++/MFC forum I asked question on MFC. And unfortunatly u gave me the links related to VB.NET and C#.NET.
But Thanks For your Try.
The secret of life is not enjoyment
but education through experience.
- Swami Vivekananda.
|
|
|
|
|
Oh. By Visual Studio.NET you mean VC++7.0 and I thought you meant managed code. Well, I create an unmanaged add-in in VC++7.0 the same way I create it in VC++6.0 and it works fine. Have you imported the correct type libraries?
---
Hakuna-Matada
It means no worries for the rest of your days...
It's our problem free, Philosophy
<marquee behavior="alternate" scrollamount="5" scrolldelay="50">
|
|
|
|
|
The question is as the title. I want to know where can I find the instruction
about this aspect. thank you!
|
|
|
|
|
hi !
I am facing a problem loading a DLL file in client application. I am using a LoadLibrary() function to load a dll file. The problem is that ; load library does not return NULL. I cheked this using value of the handle its returning. But getLastError gives error code 6 :: "Invalid Handle".
I checked the path several times. There is no problem in path for sure.
I dont know where i am goin wrong??
Plz help me out.
I am posting my code here
NewDll.cpp (win32 DLL project)
#include "stdafx.h"
HINSTANCE gl_hModule = NULL;
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
{
gl_hModule = (HINSTANCE)hModule;
break;
}
case DLL_PROCESS_DETACH:
break;
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
break;
return TRUE;
}
}
void getString(HINSTANCE hInst)
{
char load_str[80];
LoadString(hInst,1,load_str,80);
MessageBox(NULL,load_str,"STring Retrieved",NULL);
}
TestDllDlg.cpp( Client app , I am loadin dll in OnOK() function just to test)
[code]
#include "stdafx.h"
#include "TestDll.h"
#include "TestDllDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
typedef void (*MYAPP)(HINSTANCE);
MYAPP gets1=NULL;
HINSTANCE ghInst =NULL;
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
enum { IDD = IDD_ABOUTBOX };
protected:
virtual void DoDataExchange(CDataExchange* pDX);
protected:
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
END_MESSAGE_MAP()
CTestDllDlg::CTestDllDlg(CWnd* pParent )
: CDialog(CTestDllDlg::IDD, pParent)
{
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CTestDllDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CTestDllDlg, CDialog)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
END_MESSAGE_MAP()
BOOL CTestDllDlg::OnInitDialog()
{
CDialog::OnInitDialog();
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
SetIcon(m_hIcon, TRUE);
SetIcon(m_hIcon, FALSE);
return TRUE;
}
void CTestDllDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}
void CTestDllDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this);
SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
HCURSOR CTestDllDlg::OnQueryDragIcon()
{
return (HCURSOR) m_hIcon;
}
void CTestDllDlg::OnOK()
{
HMODULE hMod ;
BOOL bRes;
ghInst= LoadLibrary("F:\\MyProjects2\\NewDll\\Debug\\NewDll.dll");
if(ghInst==NULL)
{
MessageBox("CANT LOAD THE LIBRARY","ER0ROR",NULL);
}
gets1 = (MYAPP) GetProcAddress(ghInst,"getString");
HINSTANCE tempInst=GetModuleHandle(NULL);
(*gets1)(tempInst);
bRes = FreeLibrary(hMod);
CDialog::OnOK();
}
|
|
|
|
|
And what is the problem exactly ? If the function returns a valid handle, you can use, you only need to check GetLastError when there is a problem. Can you retrieve successfully the function address ?
Cédric Moonen
Software developer
Charting control
|
|
|
|